-
Notifications
You must be signed in to change notification settings - Fork 3
/
crest_combi
executable file
·236 lines (213 loc) · 9.99 KB
/
crest_combi
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
#!/usr/bin/env bash
###############################################
# script for performing crest runs at FF
# and GFN2 level including clustering in order
# to get prototypical lowest lying structures
# for a subsequent CENSO run. The primary purpose
# is NOT to get a complete ensemble but one that
# includes the globally lowest and many other
# low-lying (at DFT level) with high probability
# 10 crest runs are conducted:
# FF(neutral,v4), FF(+/-scaled disp), FF(+/-(1,2)charge)
# GFN2(neutral,v3)
# a quick version (-q) reduces the number of crest
# runs and their computational demand
# PP & SG, 7/20-1/21
###############################################
# V 1.0.2 Mo Feb 22 15:25:46 CET 2021 added clearer printout
echo ' '
echo ' ========================================================'
echo ' == crest_combi V 1.0.4, SG/PP/FB Feb 2021, MCTC UBonn =='
echo ' ========================================================'
#defaults
solv="gas" # solvent name
ewin="8.0" # energy window, do not take < 8 for larger drugs
gbsa='-alpb' # solvation model
mode="ff" # FF+GFN2(-screen)
# settings for full, non-quick default mode, change by -q
listd="0.0 0.5 1.5 2.0" # artificial dispersion
listc="1 2 -1 -2" # " ES
xtff="x1.0" # neutral run time
xtffm="x2.0" # artifical " "
nclust="500" # of clusters in itermediate steps
vfirst="-v4" # algo for first neutral run
nmr="" # create anmr_nucinfo and anmr_rotamer in first FF(v4) run
threads=$OMP_NUM_THREADS # set OMP threads (equivalent to using the -T option of crest)
printhelp="off"
argcheck="y"
while [ "$argcheck" = "y" ]; do
if [ -n "$1" ]; then
case $1 in
"-q" ) listd="0.5 1.5"; listc="1 -1"; xtffm="x0.5"; vfirst="-v3"; mode="ff"; nclust="400" ;;
"-s" ) shift; solv=$1 ;;
"-solvent" ) shift; solv=$1 ;;
"-g" ) shift; solv=$1 ;;
"-ewin" ) shift; ewin=$1 ;;
"-xt" ) mode="" ;; #xt = extended search with FF + GFN2 PES search
"-T" ) shift; threads=$1 ;;
"-threads" ) shift; threads=$1 ;;
"-nmr" ) nmr="-nmr" ;;
"-or") nclust="1000";;
"-h" ) printhelp="on";;
"--help" ) printhelp="on";;
esac
shift
else
argcheck="n"
fi
done
if [ "$printhelp" == "on" ];then
echo ""
echo "Printing help message:"
echo ""
echo "-q = quick settings"
echo "-s = solvent e.g. h2o or chcl3, equivalent to -g or -solvent"
echo "-g = solvent e.g. h2o or chcl3, equivalent to -s or -solvent"
echo "-solvent = solvent e.g. h2o or chcl3, equivalent to -g or -s"
echo "-ewin = Energy window within which all structures are considered"
echo "-xt = Perform the PES search with GFN-FF and with GFN2"
echo "-T = number of threads used in CREST, equivalent to -threads"
echo "-nmr = create anmr_nucinfo and anmr_rotamer file for subsequent NMR calculation"
echo "-h = print help message"
echo ""
echo "General information:"
echo "This script performs several CREST runs using the GFN-FF and GFN2-xTB methods. The PES search is complemented"
echo "by searching on artificial PES (scaled disp and charge) to overcome possible method deficiencies."
echo "All structures are optimized and ranked by energy."
echo "Information on the run-progress is printed to stderr and stdout."
echo ""
echo "Example usage:"
echo " $ crest_combi -solvent h2o -q -T 8 > crest_combi.out"
echo ""
echo "Please consider citing:"
echo "S. Grimme, F. Bohle, A. Hansen, P. Pracht, S. Spicher, and M. Stahn J. Phys. Chem. A 2021, 125, 19, 4039–4054."
echo "https://doi.org/10.1021/acs.jpca.1c00971"
exit
fi
ewin2=$(echo "$ewin + 4" |bc) # ewin for intermediate FF run re-ranking with GFN2
ewin3=$(echo "$ewin - 2" |bc) # ewin for last GFN2 search (if mode="")
echo ""
echo "*****************************************"
echo "CREST energy window : $ewin kcal/mol"
echo "ewin for FF reranking : $ewin2 kcal/mol"
echo "applied solvent : $solv"
if [ "$mode" == "" ]; then
echo "search method : FF + GFN2 "
echo "ewin for last GFN2 search: $ewin3"
else
echo "search method : $mode"
fi
echo "nclust : $nclust"
echo "*****************************************"
#########################
#search on FF level
#########################
# neutral
rm -f gfnff_topo
echo -e "#>>># Running: CREST 1 (FF,$vfirst)" >&2
echo -e "#>>># Running: CREST 1 (FF,$vfirst)"
if [ "$nmr" == "-nmr" ]; then
echo 'Generating anmr_nucinfo and anmr_rotamers files for possible subsequent NMR calculation'
crest coord "$gbsa" "$solv" -gfnff "$vfirst" -cluster "$nclust" -ewin "$ewin" -norotmd -nocross -mdlen "$xtff" -T "$threads" "$nmr"
else
crest coord "$gbsa" "$solv" -gfnff "$vfirst" -cluster "$nclust" -ewin "$ewin" -norotmd -nocross -mdlen "$xtff" -T "$threads"
fi
# move old files
if [ -f "crest_conformers.xyz" ]; then
mv crest_conformers.xyz crest_tmp.xyz
fi
if [ -f "crest_best.xyz" ]; then
mv crest_best.xyz best_gfnff.xyz
fi
if [ -f "crest_clustered.xyz" ]; then
cat crest_clustered.xyz > search_gfnff.xyz
fi
# artificial 1
for dscal in $listd
do
echo -e "#>>># Running: CREST (FF+/-disp)... $dscal" >&2
echo -e "#>>># Running: CREST (FF+/-disp)... $dscal"
rm -f gfnff_topo
# search with scaled dispersion interaction via the "-dispscal" command
crest best_gfnff.xyz -gfnff -cluster "$nclust" -ewin "$ewin" -dispscal "$dscal" -norotmd -norestart -nocross -mdlen "$xtffm" -T "$threads"
cat crest_clustered.xyz >> search_gfnff.xyz
done
chrg=0
if test -f .CHRG; then
chrg=$(cat .CHRG)
fi
# artificial 2
for c in $listc
do
chrgmod=$((chrg+c))
echo -e "#>>># Running: CREST (FF+/-charge)... $chrgmod" >&2
echo -e "#>>># Running: CREST (FF+/-charge)... $chrgmod"
#echo 'CREST (FF+/-charge)...' $chrgmod
rm -f gfnff_topo
echo "$chrgmod" > .CHRG
# search with modified molecular charge +/-{1,2}
crest best_gfnff.xyz -gfnff -cluster "$nclust" -ewin "$ewin" -norotmd -norestart -nocross -mdlen "$xtffm" -T "$threads"
cat crest_clustered.xyz >> search_gfnff.xyz
done
echo "$chrg" > .CHRG
# GFN2 opt
echo 'CREST screen (GFN2)...'
cp search_gfnff.xyz search_gfnff_save.xyz
rm -f gfnff_topo
#1. energy re-rank (at FF level) because of +/-disp/ES structures (output: crest_ensemble.xyz)
echo -e "#>>># Running: CREST structure optimization and energy reranking because of artificial search" >&2
echo -e "#>>># Running: CREST structure optimization and energy reranking because of artificial search"
crest -mdopt search_gfnff.xyz "$gbsa" "$solv" -opt crude -gfnff -ewin "$ewin2" -T "$threads"
#2. Sorting of the optimized ensemble (output: overwritten crest_ensemble.xyz)
echo -e "#>>># Running: CREST (cregen) ensemble sorting" >&2
echo -e "#>>># Running: CREST (cregen) ensemble sorting"
crest -cregen crest_ensemble.xyz -ewin "$ewin" -ethr 0.1 und -rthr 0.2 -bthr 0.03 -T "$threads"
#3. GFN2 full opt (output: overwritten crest_ensemble.xyz)
echo -e "#>>># Running: CREST GFN2 full optimization" >&2
echo -e "#>>># Running: CREST GFN2 full optimization"
crest "$gbsa" "$solv" -screen crest_ensemble.xyz -opt vtight -gfn2 -ewin "$ewin" -T "$threads"
#4. PCA/k-Means clustering of final ensemble (output: crest_clustered.xyz)
echo -e "#>>># Running: CREST initial FF PCA/k-Means clustering" >&2
echo -e "#>>># Running: CREST initial FF PCA/k-Means clustering"
crest -for crest_ensemble.xyz -cluster "$nclust" -ewin "$ewin" -T "$threads"
mv crest_clustered.xyz search_gfnff.xyz
mv crest_best.xyz best_gfnff.xyz
#########################
# FF only part ends here
#########################
if [ "$mode" = "ff" ]; then
echo -e "#>>># Running: CREST final PCA/k-Means clustering for FF" >&2
echo -e "#>>># Running: CREST final PCA/k-Means clustering for FF"
crest -for search_gfnff.xyz -cluster tightincr -ewin "$ewin" -T "$threads"
mv crest_clustered.xyz crest_combi.xyz
else
###############################################################
#search on GFN2 level starting with best at GFN2 opt from FF SE
###############################################################
echo "CREST 8 (GFN2) ... "
echo -e "#>>># Running: CREST GFN2 search starting from FF SE = CREST 8 (GFN2) " >&2
echo -e "#>>># Running: CREST GFN2 search starting from FF SE = CREST 8 (GFN2) "
crest best_gfnff.xyz "$gbsa" "$solv" -gfn2 -ewin "$ewin3" -norotmd -nocross -mdlen x1.0 -T "$threads"
echo -e "#>>># Running: CREST GFN2 PCA/k-Means clustering into $nclust cluster" >&2
echo -e "#>>># Running: CREST GFN2 PCA/k-Means clustering into $nclust cluster"
crest -for crest_conformers.xyz -cluster "$nclust" -T "$threads"
mv crest_best.xyz best_gfn2.xyz
mv crest_clustered.xyz search_gfn2.xyz
# merge FF/TB
cat search_gfnff.xyz > final.xyz
cat search_gfn2.xyz >> final.xyz
echo 'CREST final cregen ...'
echo -e "#>>># Running: CREST (cregen) sorting final (FF/SQM) ensemble" >&2
echo -e "#>>># Running: CREST (cregen) sorting final (FF/SQM) ensemble"
crest -cregen final.xyz -ewin "$ewin" -T "$threads"
echo -e "#>>># Running: CREST PCA/k-Means clustering for final (FF/SQM) ensemble" >&2
echo -e "#>>># Running: CREST PCA/k-Means clustering for final (FF/SQM) ensemble"
crest -for crest_ensemble.xyz -cluster "$nclust" -ewin "$ewin" -T "$threads"
echo -e "#>>># Running: CREST final PCA/k-Means clustering for final (FF/SQM) ensemble" >&2
echo -e "#>>># Running: CREST final PCA/k-Means clustering for final (FF/SQM) ensemble"
crest -for crest_clustered.xyz -cluster tightincr -ewin "$ewin" -T "$threads"
cp crest_clustered.xyz crest_combi.xyz
fi
# the workflow provides a final ensemble called "crest_combi.xyz" for further processing
echo -e "#>>># CREST_COMBI: All done!" >&2
echo "#>>># CREST_COMBI: All done!"