-
Notifications
You must be signed in to change notification settings - Fork 2
/
launch_speedup (BSC).sh
110 lines (85 loc) · 2.82 KB
/
launch_speedup (BSC).sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
set -euo pipefail
read -rp "Minimum cores: " min_core
read -rp "Maximum cores: " max_core
read -rp "Step: " step_core
if [[ ! -f "MDEMI.x" ]]
then
echo "No executable has been found, submitting the compiling script. Please, relaunch once the compilation is done"
# qsub compile_paralel.sh
exit 1
fi
base_dir="$(pwd)"
if [[ ! -d "speedup" ]]
then
mkdir speedup
fi
cd speedup
for ((core_num=min_core; core_num<=max_core; core_num=core_num+step_core))
do
echo "$core_num"
mkdir sp_${core_num}
cd sp_${core_num}
working_dir="$(pwd)"
# Creating the parameter file
cat << EOF > parameters.nml
&PARAMS
! Particle related variables
lj_epsilon = 1.77, ! [kJ/mol]
lj_sigma = 4.10, ! [Ang]
mass = 131.29, ! [g/mol]
! Simulation related variables
n_steps = 50000 ! Number of simulation steps
timestep = 0.025, ! Timestep [ps]
n_particles = 2000, ! Number of particles
density = 0.1, ! Density [g/mL]
cell_type = "sc", ! Initial positions cell (sc,bcc,fcc)
init_velocities = "bimodal", ! Initial velocities (zero, bimodal)
! The number of particles must follow the formula n_particles = f*M^3
! where f is the number of atoms in the selected cell and M an integer.
! f(sc)=1, f(bcc)=2, f(fcc)=4
cutoff = 0.4 ! Cut-off for the energy and force potential truncation
vlcutoff = 0.5 ! Cut-off to construct the verlet list buffer zone
! I/O variables
sim_name = "simulation", ! Simulation name
write_stats = 10, ! Steps between each stats writing
write_frame = 1000, ! Steps between each trajectory writing
write_file = 100,
! Thermostat variables
andersen_nu = 0.7, ! Thermostat probability
temperature = 300, ! Temperature [K]
! Analysis dependent variables
gdr_num_bins = 100 ! Number of bins for RDF calculation
n_sweeps = 100 ! Number of sweeps to compute for the MSD
/
EOF
# Creating the submission file
cat << EOF > submit_${core_num}.sh
#!/bin/bash
######################
# SGE options and parameters
######################
# (1) Name of the jobs
#SBATCH --job-name=speedup_${core_num}
# (2) Number of cores
#SBATCH -N 1
#SBATCH -n ${core_num}
# (5) Output files
#$ -cwd
#SBATCH --output=speedup_c${core_num}.out
#SBATCH --error=speedup_c${core_num}.err
#SBATCH --time=50:55:00
module switch impi openmpi
module load gcc/11.2.0_binutils
module load openmpi/4.1.2
echo "Execution dir: \$(pwd)"
echo "Starting computation at \$(date)"
mpirun -np ${core_num} ${base_dir}/MDEMI.x ${working_dir}/parameters.nml
echo "Computation done at \$(date)"
exit 0
EOF
sbatch submit_${core_num}.sh
cd ..
sleep 3
done
exit 0