dockonsurf / global_script.sh @ 86112fec
Historique | Voir | Annoter | Télécharger (6,15 ko)
1 |
#!/bin/bash |
---|---|
2 |
|
3 |
user="$(pwd | awk -F"/" '{print $3}')" |
4 |
|
5 |
file_path="$(find /home/${user} -name "DockOnSurf_path")" |
6 |
|
7 |
### Mise en place de l'arborescence |
8 |
|
9 |
source ${file_path} |
10 |
|
11 |
### Récupération des vecteurs de cellule |
12 |
|
13 |
a1="$(grep "A\ " ${CP2K_input_MolOnSurf} | awk '$1 ~/^A/ {print}' | awk '{print $2}')" |
14 |
if [[ $a1 =~ "E+00" ]]; then a1="$(echo $a1 | cut -d "E" -f1)"; fi ; export a1 |
15 |
a2="$(grep "A\ " ${CP2K_input_MolOnSurf} | awk '$1 ~/^A/ {print}' | awk '{print $3}')" |
16 |
if [[ $a2 =~ "E+00" ]]; then a2="$(echo $a2 | cut -d "E" -f1)"; fi ; export a2 |
17 |
a3="$(grep "A\ " ${CP2K_input_MolOnSurf} | awk '$1 ~/^A/ {print}' | awk '{print $4}')" |
18 |
if [[ $a3 =~ "E+00" ]]; then a3="$(echo $a3 | cut -d "E" -f1)"; fi ; export a3 |
19 |
b1="$(grep "B\ " ${CP2K_input_MolOnSurf} | awk '$1 ~/^B/ {print}' | awk '{print $2}')" |
20 |
if [[ $b1 =~ "E+00" ]]; then b1="$(echo $b1 | cut -d "E" -f1)"; fi ; export b1 |
21 |
b2="$(grep "B\ " ${CP2K_input_MolOnSurf} | awk '$1 ~/^B/ {print}' | awk '{print $3}')" |
22 |
if [[ $b2 =~ "E+00" ]]; then b2="$(echo $b2 | cut -d "E" -f1)"; fi ; export b2 |
23 |
b3="$(grep "B\ " ${CP2K_input_MolOnSurf} | awk '$1 ~/^B/ {print}' | awk '{print $4}')" |
24 |
if [[ $b3 =~ "E+00" ]]; then b3="$(echo $b3 | cut -d "E" -f1)"; fi ; export b3 |
25 |
c1="$(grep "C\ " ${CP2K_input_MolOnSurf} | awk '$1 ~/^C/ {print}' | awk '{print $2}')" |
26 |
if [[ $c1 =~ "E+00" ]]; then c1="$(echo $c1 | cut -d "E" -f1)"; fi ; export c1 |
27 |
c2="$(grep "C\ " ${CP2K_input_MolOnSurf} | awk '$1 ~/^C/ {print}' | awk '{print $3}')" |
28 |
if [[ $c2 =~ "E+00" ]]; then c2="$(echo $c2 | cut -d "E" -f1)"; fi ; export c2 |
29 |
c3="$(grep "C\ " ${CP2K_input_MolOnSurf} | awk '$1 ~/^C/ {print}' | awk '{print $4}')" |
30 |
if [[ $c3 =~ "E+00" ]]; then c3="$(echo $c3 | cut -d "E" -f1)"; fi ; export c3 |
31 |
|
32 |
### Paramètres initiaux |
33 |
|
34 |
echo 'Name of the molecule (without .mol) ' |
35 |
read molecule |
36 |
|
37 |
echo '' |
38 |
|
39 |
module load rdkit |
40 |
|
41 |
### Generation des conformeres |
42 |
|
43 |
${DockOnSurf_path}/modules/generation_conformeres.py $molecule 5000 |
44 |
echo ' -- CONFORMERS HAVE BEEN GENERATED --' |
45 |
|
46 |
### Conversion des fichiers .mol en .xyz |
47 |
|
48 |
${DockOnSurf_path}/modules/mol_to_xyz.sh $molecule |
49 |
|
50 |
### Lancement des calculs pour les molecules seules |
51 |
|
52 |
${DockOnSurf_path}/modules/launch_cp2k_molecule_seule.sh $molecule |
53 |
|
54 |
### Attente jusqu'à ce que tous les calculs aient fini |
55 |
|
56 |
mol="$(echo $molecule | cut -c1-10)" |
57 |
while [ "$(qstat | grep $mol | wc -l)" != 0 ]; |
58 |
do |
59 |
sleep 300 |
60 |
done |
61 |
|
62 |
echo ' -- ALL CALCULATIONS FOR MOLECULE ALONE HAVE BEEN DONE --' |
63 |
|
64 |
### Suppression des fichiers inutiles |
65 |
|
66 |
rm -r ${Molecule_results_path}/${molecule}/*/*RESTART* |
67 |
rm -r ${Molecule_results_path}/${molecule}/*/*restart* |
68 |
rm -r ${Molecule_results_path}/${molecule}/*/*BFGS* |
69 |
rm -r ${Molecule_results_path}/${molecule}/*/*.p* |
70 |
|
71 |
echo ' ' |
72 |
echo ' -- RESULTS --' |
73 |
|
74 |
min_energy_molecule=0 |
75 |
for struct in ${Molecule_results_path}/${molecule}/${molecule}*; do |
76 |
energy_molecule="$(awk '/ENERGY/{E=$NF} END{print E}' ${struct}/*${molecule}.out)" |
77 |
if [[ "${energy_molecule}" > "${min_energy_molecule}" ]] |
78 |
then |
79 |
min_energy_molecule=${energy_molecule} |
80 |
numero_mol_stable="$(echo $struct | awk -F'/' '{print $NF}')" |
81 |
fi |
82 |
done |
83 |
echo " Most stable structure for molecule alone: ${numero_mol_stable} with energy ${min_energy_molecule} Ha" |
84 |
|
85 |
echo ' ' |
86 |
echo ' -- ARGUMENTS FOR ADSORPTION -- ' |
87 |
echo ' ' |
88 |
echo 'Name of the file to use for the surface (without .xyz) ' |
89 |
read surface |
90 |
echo 'Number of the central atom of the molecule' |
91 |
read center |
92 |
read -a list_atom_1_mol -p 'List of atoms of the molecule to adsorb ' |
93 |
read -a list_atom_2_mol -p 'List of neighboring atoms of the molecule (linked to the atoms to adsorb) ' |
94 |
nombre_atom_mol=${#list_atom_1_mol[@]} |
95 |
if [ ${#list_atom_2_mol[@]} != ${nombre_atom_mol} ] |
96 |
then |
97 |
echo " Problem: number of atoms different in the two lists" |
98 |
exit |
99 |
fi |
100 |
read -a list_atom_surf -p 'List of the atoms of the surface that can be adsorption sites ' |
101 |
echo 'Value of cutoff energy for reoptimisation (eV)' |
102 |
read cutoff |
103 |
echo '' |
104 |
|
105 |
### Adsorption de la molecule sur la surface |
106 |
|
107 |
${DockOnSurf_path}/modules/script_add_adsorbate+diss.sh $molecule $surface "${list_atom_1_mol[*]}" "${list_atom_2_mol[*]}" "${list_atom_surf[*]}" |
108 |
|
109 |
echo ' -- ADSORPTION SUTRUCTURES HAVE BEEN CALCULATED --' |
110 |
|
111 |
# Changes labels of elements to its original definition, thus allowing different kinds of same element (Fe1 Fe2) with different properties (e.g. spin state in compounds with magnetic coupling) |
112 |
|
113 |
${DockOnSurf_path}/modules/fe_change.sh $molecule $surface ${MolOnSurf_results_path}/${molecule} |
114 |
|
115 |
### Lancement des calculs pour les molecules adsorbees |
116 |
|
117 |
${DockOnSurf_path}/modules/launch_script+diss.sh $molecule |
118 |
|
119 |
### Attente jusqu'à ce que tous les calculs aient fini |
120 |
|
121 |
mol2="$(echo $molecule | cut -c1-5)" |
122 |
while [ "$(qstat | grep surf_${mol2} | wc -l)" != 0 ]; |
123 |
do |
124 |
sleep 300 |
125 |
done |
126 |
|
127 |
echo ' -- ALL CALCULATIONS FOR ADSORPTION STRUCTURES HAVE BEEN DONE --' |
128 |
|
129 |
### Suppression des fichiers inutiles |
130 |
|
131 |
rm -r ${MolOnSurf_results_path}/${molecule}/*/*RESTART* |
132 |
rm -r ${MolOnSurf_results_path}/${molecule}/*/*BFGS* |
133 |
rm -r ${MolOnSurf_results_path}/${molecule}/*/*.p* |
134 |
|
135 |
### Clustering et lancement des structures centres des clusters |
136 |
|
137 |
nb_at_surf="$(awk 'NR==1{print}' ${Surface_path}/${surface}.xyz)" |
138 |
num_center="$(expr ${nb_at_surf} + $center )" |
139 |
|
140 |
${DockOnSurf_path}/modules/script_grandes_molecules+diss.sh $molecule $num_center ${nb_at_surf} ${cutoff} |
141 |
|
142 |
echo ' -- CLUSTERING HAS BEEN DONE AND CLUSTER CENTERS CALCULATIONS HAVE BEEN LAUNCHED --' |
143 |
|
144 |
### Attente jusqu'à ce que tous les calculs aient fini |
145 |
|
146 |
while [ "$(qstat | grep surf_${mol2} | wc -l)" != 0 ]; |
147 |
do |
148 |
sleep 300 |
149 |
done |
150 |
|
151 |
echo ' -- ALL CLUSTER CENTERS CALCULATIONS HAVE BEEN DONE --' |
152 |
|
153 |
|
154 |
echo " " |
155 |
echo ' -- RESULTS --' |
156 |
|
157 |
echo ' ' |
158 |
echo "Most stable structure for molecule alone: ${numero_mol_stable} with energy ${min_energy_molecule} Ha" |
159 |
|
160 |
min_energy_global=0 |
161 |
for global_struct in ${MolOnSurf_results_path}/${molecule}/relaunched_calculations/* ; do |
162 |
if [[ "$global_struct" != *.inp ]] |
163 |
then |
164 |
if [[ "$global_struct" != *.j ]] |
165 |
then |
166 |
energy_global="$(awk '/ENERGY/{E=$NF} END{print E}' ${global_struct}/*${molecule}.out)" |
167 |
if [[ "${energy_global}" > "${min_energy_global}" ]] |
168 |
then |
169 |
min_energy_global=${energy_global} |
170 |
numero_global_stable="$(echo ${global_struct} | awk -F'/' '{print $NF}')" |
171 |
fi |
172 |
fi |
173 |
fi |
174 |
done |
175 |
|
176 |
echo "Most stable structure for adsorption: ${numero_global_stable} with energy ${min_energy_global} Ha" |
177 |
|
178 |
|