-
Notifications
You must be signed in to change notification settings - Fork 0
/
dftb+_22.1.sh
152 lines (105 loc) · 3.32 KB
/
dftb+_22.1.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#!/bin/bash
#
#SBATCH --job-name=calculation
#SBATCH --output=output_%j.out
#SBATCH --error=error_%j.err
#SBATCH --ntasks=Nan
#SBATCH --time=Nan
#SBATCH --partition=Nan
#SBATCH [email protected]
#SBATCH --mail-type=FAIL,REQUEUE,INVALID_DEPEND,STAGE_OUT
#Name of the directory where you will do the calculation
directory_name=${SLURM_JOB_ID}_${SLURM_JOB_NAME}
directory=/tmp/job_${directory_name}
# Create working directory
mkdir ${directory}
# directories where datas are stored
DD=${SLURM_SUBMIT_DIR}
# copy files in the working directory
for i in *.gen *.xyz *.hsd POSCAR* *.vasp CONTCAR* ; do
cp -rv ${i} ${directory}/.
done
#write that the calculation start
echo ${directory} ${SLURM_JOB_NODELIST}>> /home/users/${USER}/slurm.log.working
echo $SLURM_JOB_NODELIST >> ${DD}/mpd.hosts
cat >> /home/users/${USER}/slurm.log <<EOF
################################################################
$(date +'%A %d %B (%D) %Hh%M')
${SLURM_JOB_ID}
${SLURM_JOB_NAME}
${SLURM_SUBMIT_DIR}
${SLURM_JOB_NODELIST}
nodes=${SLURM_JOB_NUM_NODES}:ppn${SLURM_CPUS_ON_NODE}
${SLURM_NTASKS}
$(squeue -j ${SLURM_JOB_ID} -h --Format TimeLimit)
echo ${SLURM_JOB_PARTITION}
EOF
echo '======================'
echo '======================'
echo ''
echo "Starting at `date +"%D%t%A%t%T"`"
echo ''
echo '======================'
echo '======================'
echo ''
# go to working directory
cd ${directory}
# Def function of periodic copy
recopie-periodique ()
{
tjsPresent=`ls -l $TMPDIR | wc -l`
delai=10 # pour recopie des le demarrage du calcul
while [ $tjsPresent -gt 0 ]
do
sleep $delai
touch *
echo "Copie fichier : `date`"
cp -rv ${directory} ${DD}/working_save.tmp
tjsPresent=`ls -l $TMPDIR | wc -l`
delai=3000 # augmentation du delai pour limiter l'utilisation de la bande passante
done
}
recopie-periodique &
# Run the code
ulimit -s hard
export OMP_NUM_THREADS=${SLURM_NTASKS}
#export OMP_NUM_THREADS=36
if [[ $SLURM_JOB_PARTITION == *"AMD"* ]]; then
. /opt/intel/oneapi/setvars.sh
else
source /opt/intel/intel_2020/compilers_and_libraries/linux/bin/compilervars.sh intel64
fi
/cluster_cti/bin/DFTB+/dftbplus-22.1/_install/bin/dftb+ > ${directory}/output_dftb_${SLURM_JOB_NAME}_${SLURM_JOB_ID}.out
bash /home/users/atetenoire/scripts/dftb_plus_output_analysis.sh ${directory}/output_dftb_${SLURM_JOB_NAME}_${SLURM_JOB_ID}.out
if [ $SLURM_JOB_PARTITION == 'mach_post' ]; then
ipython /home/users/atetenoire/scripts/dftb_plus_output_analysis.py
else
python3.4 /home/users/atetenoire/scripts/dftb_plus_output_analysis.py
fi
cd ${DD}
# Retrieve data
mv ${DD}/mpd.hosts ${directory}/.
mv ${directory} ${DD}/.
rm -r ${DD}/working_save.tmp
# Write that calculation ended
cat >> /home/users/${USER}/slurm.log.end <<EOF
################################################################
$(date +'%A %d %B (%D) %Hh%M')
${SLURM_JOB_ID}
${SLURM_JOB_NAME}
${SLURM_SUBMIT_DIR}
${SLURM_JOB_NODELIST}
nodes=${SLURM_JOB_NUM_NODES}:ppn${SLURM_CPUS_ON_NODE}
${SLURM_NTASKS}
$(squeue -j ${SLURM_JOB_ID} -h --Format TimeLimit)
echo ${SLURM_JOB_PARTITION}
EOF
sed -i "s/${directory} ${SLURM_JOB_NODELIST}//" /home/users/${USER}/slurm.log.working
echo '======================'
echo '======================'
echo ''
echo "Ending at `date +"%D%t%A%t%T"`"
echo ''
echo '======================'
echo '======================'
echo ''