dockonsurf / modules / launch_cp2k_molecule_seule.sh @ f43a1b4c
Historique | Voir | Annoter | Télécharger (1,7 ko)
1 |
#!/bin/bash |
---|---|
2 |
|
3 |
molecule=$1 |
4 |
|
5 |
n="$(find ${Molecule_results_path}/${molecule}_confs/xyz_files/${molecule}*.xyz | wc -l)" |
6 |
|
7 |
if [ ! -d "${Molecule_results_path}/${molecule}" ] |
8 |
then mkdir ${Molecule_results_path}/${molecule} |
9 |
else |
10 |
print 'problem there is already a directory for this molecule' |
11 |
exit |
12 |
fi |
13 |
|
14 |
mkdir ${Molecule_results_path}/${molecule}/${molecule}_1 |
15 |
cd ${Molecule_results_path}/${molecule}/${molecule}_1 |
16 |
sed "/PROJECT_NAME/c\PROJECT_NAME ${molecule}" ${CP2K_input_molecule} > ${Molecule_results_path}/${molecule}/${molecule}_1/${molecule}.inp |
17 |
sed "s/XXXX/${molecule}/g" ${CP2K_sub} > ${Molecule_results_path}/${molecule}/${molecule}_1/cp2k_gamma.j |
18 |
cp ${Molecule_results_path}/${molecule}_confs/xyz_files/${molecule}_1.xyz ${Molecule_results_path}/${molecule}/${molecule}_1/coord.xyz |
19 |
new_job_id=$(qsub cp2k_gamma.j | awk '{print $3}') |
20 |
echo "Submitted job $new_job_id" |
21 |
jobs_owned+=($new_job_id) |
22 |
|
23 |
for ((i=2; i<=n; i++)) ; do |
24 |
mkdir ${Molecule_results_path}/${molecule}/${molecule}_$i |
25 |
cd ${Molecule_results_path}/${molecule}/${molecule}_$i |
26 |
ln ${Molecule_results_path}/${molecule}/${molecule}_1/cp2k_gamma.j . |
27 |
ln ${Molecule_results_path}/${molecule}/${molecule}_1/${molecule}.inp . |
28 |
cp ${Molecule_results_path}/${molecule}_confs/xyz_files/${molecule}_${i}.xyz coord.xyz |
29 |
new_job_id=$(qsub cp2k_gamma.j | awk '{print $3}') |
30 |
echo "Submitted job $new_job_id" |
31 |
jobs_owned+=($new_job_id) |
32 |
done |
33 |
|
34 |
### Attente jusqu'à ce que tous les calculs aient fini |
35 |
go_on=true |
36 |
while [ $go_on == true ]; do |
37 |
all_jobs=`qstat | tail -n+3 | awk '{print $1}'` |
38 |
for j1 in ${jobs_owned[@]} ; do |
39 |
for j2 in ${all_jobs[@]}; do |
40 |
if [ $j1 == $j2 ]; then |
41 |
sleep 30 |
42 |
continue 3 |
43 |
fi |
44 |
done |
45 |
done |
46 |
echo "loop finished" |
47 |
go_on=false |
48 |
done |