dockonsurf / global_script.sh @ f43a1b4c
Historique | Voir | Annoter | Télécharger (5,6 ko)
1 |
#!/bin/bash |
---|---|
2 |
|
3 |
user="$(pwd | awk -F"/" '{print $3}')" |
4 |
file_path="$(find $HOME -name "DockOnSurf_path")" |
5 |
echo $file_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 |
echo ' -- ALL CALCULATIONS FOR MOLECULE ALONE HAVE BEEN DONE --' |
55 |
|
56 |
### Suppression des fichiers inutiles |
57 |
|
58 |
rm -r ${Molecule_results_path}/${molecule}/*/*RESTART* |
59 |
rm -r ${Molecule_results_path}/${molecule}/*/*restart* |
60 |
rm -r ${Molecule_results_path}/${molecule}/*/*BFGS* |
61 |
rm -r ${Molecule_results_path}/${molecule}/*/*.p* |
62 |
|
63 |
echo ' ' |
64 |
echo ' -- RESULTS --' |
65 |
|
66 |
min_energy_molecule=0 |
67 |
for struct in ${Molecule_results_path}/${molecule}/${molecule}*; do |
68 |
energy_molecule="$(awk '/ENERGY/{E=$NF} END{print E}' ${struct}/*${molecule}.out)" |
69 |
if [[ "${energy_molecule}" > "${min_energy_molecule}" ]] |
70 |
then |
71 |
min_energy_molecule=${energy_molecule} |
72 |
numero_mol_stable="$(echo $struct | awk -F'/' '{print $NF}')" |
73 |
fi |
74 |
done |
75 |
echo " Most stable structure for molecule alone: ${numero_mol_stable} with energy ${min_energy_molecule} Ha" |
76 |
|
77 |
echo ' ' |
78 |
echo ' -- ARGUMENTS FOR ADSORPTION -- ' |
79 |
echo ' ' |
80 |
echo 'Name of the file to use for the surface (without .xyz) ' |
81 |
read surface |
82 |
echo 'Number of the central atom of the molecule' |
83 |
read center |
84 |
read -a list_atom_1_mol -p 'List of atoms of the molecule to adsorb ' |
85 |
read -a list_atom_2_mol -p 'List of neighboring atoms of the molecule (linked to the atoms to adsorb) ' |
86 |
nombre_atom_mol=${#list_atom_1_mol[@]} |
87 |
if [ ${#list_atom_2_mol[@]} != ${nombre_atom_mol} ] |
88 |
then |
89 |
echo " Problem: number of atoms different in the two lists" |
90 |
exit |
91 |
fi |
92 |
read -a list_atom_surf -p 'List of the atoms of the surface that can be adsorption sites ' |
93 |
echo 'Value of cutoff energy for reoptimisation (eV)' |
94 |
read cutoff |
95 |
echo '' |
96 |
|
97 |
### Adsorption de la molecule sur la surface |
98 |
|
99 |
${DockOnSurf_path}/modules/script_add_adsorbate+diss.sh $molecule $surface "${list_atom_1_mol[*]}" "${list_atom_2_mol[*]}" "${list_atom_surf[*]}" |
100 |
|
101 |
echo ' -- ADSORPTION SUTRUCTURES HAVE BEEN CALCULATED --' |
102 |
|
103 |
# 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) |
104 |
|
105 |
${DockOnSurf_path}/modules/fe_change.sh $molecule $surface ${MolOnSurf_results_path}/${molecule} |
106 |
|
107 |
### Lancement des calculs pour les molecules adsorbees |
108 |
|
109 |
${DockOnSurf_path}/modules/launch_script+diss.sh $molecule |
110 |
|
111 |
echo ' -- ALL CALCULATIONS FOR ADSORPTION STRUCTURES HAVE BEEN DONE --' |
112 |
|
113 |
### Suppression des fichiers inutiles |
114 |
|
115 |
rm -r ${MolOnSurf_results_path}/${molecule}/*/*RESTART* |
116 |
rm -r ${MolOnSurf_results_path}/${molecule}/*/*BFGS* |
117 |
rm -r ${MolOnSurf_results_path}/${molecule}/*/*.p* |
118 |
|
119 |
### Clustering et lancement des structures centres des clusters |
120 |
|
121 |
nb_at_surf="$(awk 'NR==1{print}' ${Surface_path}/${surface}.xyz)" |
122 |
num_center="$(expr ${nb_at_surf} + $center )" |
123 |
|
124 |
${DockOnSurf_path}/modules/script_grandes_molecules+diss.sh $molecule $num_center ${nb_at_surf} ${cutoff} |
125 |
|
126 |
echo ' -- ALL CLUSTER CENTERS CALCULATIONS HAVE BEEN DONE --' |
127 |
|
128 |
|
129 |
echo " " |
130 |
echo ' -- RESULTS --' |
131 |
|
132 |
echo ' ' |
133 |
echo "Most stable structure for molecule alone: ${numero_mol_stable} with energy ${min_energy_molecule} Ha" |
134 |
|
135 |
min_energy_global=0 |
136 |
for global_struct in ${MolOnSurf_results_path}/${molecule}/relaunched_calculations/* ; do |
137 |
if [[ "$global_struct" != *.inp ]] |
138 |
then |
139 |
if [[ "$global_struct" != *.j ]] |
140 |
then |
141 |
energy_global="$(awk '/ENERGY/{E=$NF} END{print E}' ${global_struct}/*${molecule}.out)" |
142 |
if [[ "${energy_global}" > "${min_energy_global}" ]] |
143 |
then |
144 |
min_energy_global=${energy_global} |
145 |
numero_global_stable="$(echo ${global_struct} | awk -F'/' '{print $NF}')" |
146 |
fi |
147 |
fi |
148 |
fi |
149 |
done |
150 |
|
151 |
echo "Most stable structure for adsorption: ${numero_global_stable} with energy ${min_energy_global} Ha" |
152 |
|
153 |
|