forked from grimme-lab/CRENSO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrenso
executable file
·621 lines (598 loc) · 26 KB
/
crenso
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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
#!/bin/bash
echo ' '
echo ' =================================================='
echo ' == crenso V 1.0.6, SG, FB Feb 2021, MCTC UBonn =='
echo ' =================================================='
echo ""
# V 1.0.1 Sun Jan 31 23:37:16 CET 2021 -kow/oa_fine flag added, part3 on
# V 1.0.2 We Feb 10 12:04:11 CET 2021 -nmr, -help, -P, -O flags added
# V 1.0.3 Mo Feb 22 15:22:35 CET 2021 added printout
# V 1.0.4 Mo Jul 05 11:04:10 CET 2021 added vapor pressure option
# V 1.0.5 Mo Aug 09 15:41:23 CET 2021 added extended PES search again
mode=""
argcheck=y
or=off
nmr=off
OUT=crenso.out
T=6
setT=off # logical for T = threads in CREST
P=3 # threads in CENSO
O=2 # cores per thread in CENSO
censorc="$HOME/.censorc"
p3=off
printhelp=off
progress=on
change_solvent="off"
vp="off"
xt_search="off"
while [ "$argcheck" = "y" ]; do
if [ -n "$1" ]; then
case $1 in
"-l0" ) mode=0; p2=off ;; # single structure single-point xTB
"-l0opt" ) mode=0; p2=on ;; # " " DFT opt (check for geom. effect)
"-l1" ) mode=1; p2=off ;; # quick crest_combi + part0/1
"-l1opt" ) mode=1; p2=on ;; # " " + part0/1/2 ie DFT opt
"-l2" ) mode=2 ;; # full crest_combi + gesc+ part0/1/2 ie DFT opt
"-l3" ) mode=3; p2=on ;; # full crest_combi, NO-gesc, part0/1/2 in CENSO
# EWINS: CREST part0 part1
# 2.0 kcal here yields reasonable thermal averages while more for OR are taken
# 8 kcal in crest is required because we really wanna have the best in spectro mode while in thermo mode, a close to best is ok
# 3/4 kcal for part0 is something in between
"-pka" ) ec=6; ep0=3; ep1=2.0; run=pka; s1=h2o; s2=h2o; olev=lax p1=on;; # thermo mode
"-kow" ) ec=6; ep0=3; ep1=2.0; run=kow; s1=h2o; s2=woctanol; olev=lax; p3=off; p1=on ;; # thermo mode
"-kow_fine") ec=6; ep0=3; ep1=2.0; run=kow; s1=h2o; s2=woctanol; olev=lax; p3=on; p1=off ;; # thermo mode
"-khw" ) ec=6; ep0=3; ep1=2.0; run=kow; s1=h2o; s2=hexane; olev=lax; p3=off; p1=on ;; # thermo mode
"-khw_fine") ec=6; ep0=3; ep1=2.0; run=kow; s1=h2o; s2=hexane; olev=lax; p3=on; p1=off ;; # thermo mode
"-koa" ) ec=6; ep0=3; ep1=2.0; run=kow; s1=gas; s2=octanol; olev=lax; p3=off; p1=on ;; # thermo mode
"-koa_fine") ec=6; ep0=3; ep1=2.0; run=kow; s1=gas; s2=octanol; olev=lax; p3=on; p1=off ;; # thermo mode
"-khda" ) ec=6; ep0=3; ep1=2.0; run=kow; s1=gas; s2=hexadecane; olev=lax; p3=off; p1=on ;; # thermo mode
"-khda_fine") ec=6; ep0=3; ep1=2.0; run=kow; s1=gas; s2=hexadecane; olev=lax; p3=on; p1=off ;; # thermo mode
"-or" ) shift; s1=$1; ec=8; ep0=4; ep1=2.5; run=or; or=on; olev=normal ;; # spectro mode
"-or_fine") shift; s1=$1; ec=10;ep0=5; ep1=3.0; run=or; or=on; olev=normal ;; # spectro mode
"-nmr" ) shift; s1=$1; ec=7; ep0=4; ep1=2.5; run=nmr; nmr=on; olev=lax; p1=on; p3=off ;; # property/spectra mode
"-T" ) shift; T=$1; setT=on ;;
"-P" ) shift; P=$1 ;; # independent parallel threads in CENSO --> P * O = T
"-O" ) shift; O=$1 ;; # number of cores for independent threads in CENSO --> P * O = T
"-inprc" ) shift; censorc=$1 ;; # explicit path to censorc
"-vp" ) shift; s1_alpb=$1; shift; s1_eps=$1; shift; s1_dcosmors=$1; s1='same'; s2=gas; run="vaporpressure"; vp="on"; ec=6; ep0=3; ep1=2.0; olev=lax; p3=off; p1=on ;; # calculate vapor pressure
"-vp_fine") shift; s1_alpb=$1; shift; s1_eps=$1; shift; s1_dcosmors=$1; s1='same'; s2=gas; run="vaporpressure"; vp="on"; ec=6; ep0=3; ep1=2.0; olev=lax; p3=on; p1=on ;; # calculate vapor pressure
"-temperature") shift; temperature=$1 ;;
"-xt" ) xt_search="on" ;;
"-h" ) printhelp="on";;
"--help" ) printhelp="on";;
esac
shift
else
argcheck=n
fi
done
if [ $printhelp == on ];then
echo ""
echo "Printing help message:"
echo ""
echo "-l0 = single structure mode for GFN2 opt input geometries"
echo "-l0opt = single structure mode for DFT opt input geometries (check for geom. effect)"
echo "-l1 = quick crest_combi + CENSO[part0/1]"
echo "-l1opt = quick crest_combi + CENSO[part0/1/2] i.e. DFT optimization"
echo "-l2 = DEPRECATED !!!!!!!! full crest_combi + gESC + CENSO[part0/1/2]"
echo "-l3 = full crest_combi + CENSO[part0/1/2] (NO gESC)"
echo "-pka = pka calculation for acid (A) and base (B) in water"
echo "-kow = 1-octanol/water partition coefficent calculation"
echo "-kow_fine = 1-octanol/water partition coefficient calculation using CENSO[part3] for COSMO-RS[FINE]"
echo "-khw = hexane/water partition coefficient calculation"
echo "-khw_fine = hexane/water partition coefficient calculation using CENSO[part3] for COSMO-RS[FINE]"
echo "-koa = 1-octanol/air partition coefficient calculation"
echo "-koa_fine = 1-octanol/air partition coefficient calculation using CENSO[part3] for COSMO-RS[FINE]"
echo "-khda = hexadecane/air partition coefficient calculation"
echo "-khda_fine = hexadecane/air partition coefficient calculation"
echo "-or [solvent] = optical roatatory dispersion calculation"
echo "-or_fine [solvent] = optical roatatory dispersion calculation using larger energy windows/thresholds"
echo "-nmr [solvent] = NMR calculation, settings are determined from the CENSO global configuration file"
echo "-vp [solvent_alpb] [epsilon] [solvent_dcosmors] = vapor pressure calculation: e.g. -vp thf 7.8 thf "
echo " only available with COSMO-RS "
echo "-vp_fine [solvent_alpb] [epsilon] [solvent_dcosmors] = vapor pressure calculation: e.g. -vp thf 7.8 thf "
echo " only available with COSMO-RS "
echo "-temperature [temperature] = temperature used in free energy evaluation in CENSO: e.g. -temperature 298.15"
echo "-T = number of threads used in CREST, can also be set by using P and O"
echo "-P = number of independent parallel threads in CENSO (P * O = T)"
echo "-O = number of cores per independent thread in CENSO (P * O = T)"
echo "-inprc = provide explicit absolute path to a CENSO global configuration file"
echo "-xt = Perform crest_combi with the extended FF and GFN2 PES search"
echo "-h = print help message"
echo ""
echo "General information:"
echo "Note: for -pka, the main (coord) dir must contain the correct .CHRG file for the acid"
echo "Many settings concerning CENSO are determined by the global configuration file ~/.censorc and"
echo "can be adjusted by the user."
echo "crest_combi and CENSO print their progress to stderr so that the overall run can be tracked."
echo "To keep this tracking information the stderr has to be saved as well, see example usage."
echo ""
echo "Example usage:"
echo " $ crenso -l1opt -pka -P 2 -O 3 >> output.crenso 2>&1 &"
echo ""
echo "Produce printout for pka kow after previous calculation:"
echo " $ crenso -pka > output.crenso &"
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
# determine T from P and O
if [ $setT != on ];then
T=$((P * O))
printf "Total number of CPUs(threads) (T) is set to $T \n\n"
fi
startdir=$PWD
if [ -z "$temperature" ]; then
temperature=298.15
fi
if [ "$mode" != "" ]; then # run block (else just print)
########################## prepare
chrga=0
chrgb=0
uhfa=0
uhfb=0
if test -f .CHRG; then
chrga=$(cat .CHRG)
chrgb=$(cat .CHRG)
fi
if test -f .UHF; then
uhfa=$(cat .UHF)
uhfb=$(cat .UHF)
fi
if test -f .UHFA; then
uhfa=$(cat .UHFA)
uhfb=$(cat .UHFB)
fi
if [ "$run" == "pka" ]; then
echo 'Note: for -pka, the main (coord) dir must contain the correct .CHRG file for the acid'
chrgb=$(echo "scale=10; ($chrga-1)" | bc -l | gawk '{print $1}')
if test ! -d A; then
echo "generate A/B dirs first using pkaquick!"
exit
fi
if test ! -d B; then
echo "generate A/B dirs first using pkaquick!"
exit
fi
fi
for value in 'kow' 'kow_fine' 'koa' 'koa_fine' 'khw' 'khw_fine' 'khda' 'khda_fine'
do
if [ "$run" == "$value" ]; then
rm -rf A B
mkdir A
mkdir B
cp coord A
cp coord B
fi
done
if [ "$run" == "or" ]; then
rm -rf A
mkdir A
cp coord A
fi
if [ "$run" == "nmr" ]; then
echo 'Performing NMR property calculations'
echo 'All CENSO settings concerning NMR are read from your CENSO global configuration file .censorc'
rm -rf A
mkdir A
cp coord A
fi
if [ "$run" == "vaporpressure" ]; then
echo 'Performing vapor pressure calculation'
rm -rf A B
mkdir A
mkdir B
cp coord A
cp coord B
fi
censoversion=$(censo --version)
xtbversion=$(xtb --version 2>&1 |grep "version"|gawk '{print $4}')
crestversion=$(crest --version 2>&1 | grep "Version"|gawk '{print $2}')
echo "**************************************"
echo "CREST energy window : $ec kcal/mol"
echo "CENSO threshold part0: $ep0 kcal/mol"
echo "CENSO threshold part1: $ep1 kcal/mol"
echo "applied solvent1 : $s1"
echo "applied solvent2 : $s2"
echo "level treatment : $mode"
echo "property : $run"
echo "output file : $OUT"
echo "--------------------------------------"
echo "CENSO version : $censoversion"
echo "xTB version : $xtbversion"
echo "crest version : $crestversion"
echo "**************************************"
########################## run
for m in A B
do
s=$s1
uhf=$uhfa
chrg=$chrga
[ "$m" == "B" ] && { s=$s2; uhf=$uhfb; chrg=$chrgb; }
#echo "system " $m ":" $chrg $uhf $s
if [ "$m" == "B" ] && [ "$run" == "or" ]; then
echo -e "\n#>>># CRENSO: All done!"
exit
elif [ "$m" == "B" ] && [ "$run" == "nmr" ]; then
echo -e "\n#>>># CRENSO: All done!"
exit
fi
cd $m
echo -e "\n#>>># Starting calculation in $m charge= $chrg uhf= $uhf solvent= $s" |tee -a $OUT
if [ "$run" == "vaporpressure" ] && [ "$s" != "gas" ]; then
if [ -f "../same_solvents.json" ]; then
echo "Copying file same_solvents.json !!!"
cp ../same_solvents.json .
else
echo '{' >> same_solvent.json
echo ' "same":{' >> same_solvent.json
echo ' "cosmors": ["same", "same"],' >> same_solvent.json
echo ' "dcosmors": [null, "'$s1_dcosmors'"],' >> same_solvent.json
echo ' "xtb": [null, "'$s1_alpb'"],' >> same_solvent.json
echo ' "cpcm": [null, null],' >> same_solvent.json
echo ' "smd": [null, null],' >> same_solvent.json
echo ' "DC": '$s1_eps >> same_solvent.json
echo ' }' >> same_solvent.json
echo '}' >> same_solvent.json
fi
if [ "$mode" != "0" ]; then
echo "CREST is using alpb $s1_alpb"
fi
elif [ "$run" == "vaporpressure" ] && [ "$s" == "gas" ]; then
vp='off'
fi
echo "$uhf" > .UHF
echo "$chrg" > .CHRG
rm -rf enso* CONF*
if [ "$mode" = "0" ]; then
############## single structure mode for GFN2 opt input geometries ####
echo -e "#>>># Running single-structure mode in $m"
echo -e "#>>># Running single-structure mode in $m" >> $OUT
t2x coord > inp.xyz 2>/dev/null
if [ "$run" == "vaporpressure" ] && [ "$s" != "gas" ]; then
s=$s1_alpb
change_solvent="on"
fi
xtb inp.xyz --alpb $s --opt vtight >> $OUT
mv xtbopt.xyz gfn2_opt.xyz
x2t gfn2_opt.xyz > coord 2>/dev/null
echo -e "#>>># Running CENSO single-structure mode in $m"
echo -e "\n#>>># Running CENSO single-structure mode in $m \n" >> $OUT
if [ "$run" == "vaporpressure" ] && [ "$change_solvent" == "on" ]; then
s="same"
change_solvent="off"
fi
PARAMS0=(
-solvent "$s"
-chrg "$chrg"
-u "$uhf"
-inp gfn2_opt.xyz
-part0 off
-part1 "$p1"
-part2 "$p2"
-part3 "$p3"
-part4 "$nmr"
-OR "$or"
--vapor_pressure "$vp"
-optlevel2 "$olev"
-inprc "$censorc"
-P "$P"
-O "$O"
-progress "$progress"
)
time censo "${PARAMS0[@]}" >> $OUT
echo -e "#>>># CENSO: All done!"
echo -e "\n#>>># CENSO: All done!" >> $OUT
if [ "$run" == "nmr" ]; then
echo -e "#>>># Creating anmr_nucinfo and anmr_rotamer files for $m "
echo -e "\n#>>># Creating anmr_nucinfo and anmr_rotamer files for $m \n" >> $OUT
# create anmr_nucinfo and anmr_rotamer
t2x coord.enso_best > crest_rotamers_0.xyz 2>/dev/null
crest coord.enso_best -cregen -nmr >> $OUT
fi
fi
if [ "$mode" = "1" ]; then
############## quick crest_combi #############
echo -e "#>>># Running quick crest_combi in $m"
echo -e "#>>># Running quick crest_combi in $m" >> $OUT
if [ "$run" == "vaporpressure" ] && [ "$s" != "gas" ]; then
s=$s1_alpb
change_solvent="on"
fi
if [ "$run" == "nmr" ]; then
time crest_combi -s "$s" -q -ewin "$ec" -T "$T" -nmr >> $OUT
else
time crest_combi -s "$s" -q -ewin "$ec" -T "$T" >> $OUT
fi
echo -e "#>>># Running CENSO after quick crest_combi in $m"
echo -e "\n#>>># Running CENSO after quick crest_combi in $m \n" >> $OUT
if [ "$run" == "vaporpressure" ] && [ "$change_solvent" == "on" ]; then
s="same"
change_solvent="off"
fi
PARAMS1=(
-solvent "$s"
-chrg "$chrg"
-u "$uhf"
-inp crest_combi.xyz
-part0 on
-part0_threshold "$ep0"
-part1 on
-part1_threshold "$ep1"
-part2 "$p2"
-part3 "$p3"
-part4 "$nmr"
-OR "$or"
--vapor_pressure "$vp"
-optlevel2 "$olev"
--temperature "$temperature"
-inprc "$censorc"
-P "$P"
-O "$O"
-progress "$progress"
)
time censo "${PARAMS1[@]}" >> $OUT
echo -e "#>>># CENSO: All done!"
echo -e "\n#>>># CENSO: All done!" >> $OUT
fi
if [ "$mode" == "2" ]; then
############## full crest_combi GESC GFN2 + DFT opt #############
echo -e "#>>># Running full crest_combi in $m"
echo -e "#>>># Running full crest_combi in $m" >> $OUT
if [ "$run" == "vaporpressure" ] && [ "$s" != "gas" ]; then
s=$s1_alpb
change_solvent="on"
fi
#----------------------------------------------------------------------
PARAMS2crest=(
-s "$s"
-ewin "$ec"
-T "$T"
)
if [ "$run" = "nmr" ]; then
# create anmr_nucinfo anmr_rotamers
PARAMS2crest+=("-nmr")
elif [ "$run" = "or" ]; then
# increases number of clusters in crest_combi
PARAMS2crest+=("-or")
fi
if [ "$xt_search" == "on" ]; then
# search with FF + GFN2
PARAMS2crest+=("-xt")
fi
time crest_combi "${PARAMS2crest[@]}" >> $OUT
#----------------------------------------------------------------------
echo -e "#>>># Running CENSO after full crest_combi in $m "
echo -e "\n#>>># Running CENSO after full crest_combi in $m \n" >> $OUT
if [ "$run" == "vaporpressure" ] && [ "$change_solvent" == "on" ]; then
s="same"
change_solvent="off"
fi
PARAMS2start=(
-solvent "$s"
-chrg "$chrg"
-u "$uhf"
-inp crest_combi.xyz
-evaluate_rrho off
-part0 on
-part0_threshold "$ep0"
-part1 on
-part1_threshold "$ep1"
-part2 off
-part3 off
-part4 off
-OR off
--vapor_pressure off
--temperature "$temperature"
-inprc "$censorc"
-P "$P"
-O "$O"
-progress "$progress"
)
time censo "${PARAMS2start[@]}" >> $OUT
echo -e "#>>># CENSO: All done!"
echo -e "\n#>>># CENSO: All done!" >> $OUT
cp coord.enso_best coord
echo -e "#>>># Running CREST with geometric Energy Surface Correction (gESC) in $m"
echo -e "\n#>>># Running CREST with geometric Energy Surface Correction (gESC) in $m \n" >> $OUT
if [ "$run" == "vaporpressure" ] && [ "$s" != "gas" ]; then
s=$s1_alpb
change_solvent="on"
fi
time crest -gesc+ enso_ensemble_part1.xyz -gescopt loose -alpb "$s" -nocross -norotmd -mdlen x1.0 -ewin "$ep0" -T "$T" >> "$OUT"
crest -for crest_conformers.xyz --cluster tightincr -T "$T" >> $OUT
rm -rf enso* CONF*
echo -e "#>>># Running CENSO after CREST[gESC] search in $m"
echo -e "\n#>>># Running CENSO after CREST[gESC] search in $m \n" >> $OUT
if [ "$run" == "vaporpressure" ] && [ "$change_solvent" == "on" ]; then
s="same"
change_solvent="off"
fi
PARAMS2final=(
-solvent "$s"
-chrg "$chrg"
-u "$uhf"
-inp crest_clustered.xyz
-part0 on
-part0_threshold "$ep0"
-part1 on
-part1_threshold "$ep1"
-part2 on
-optlevel2 "$olev"
-part3 "$p3"
-part4 "$nmr"
-OR "$or"
--vapor_pressure "$vp"
--temperature "$temperature"
-inprc "$censorc"
-P "$P"
-O "$O"
-progress "$progress"
)
time censo "${PARAMS2final[@]}" >> $OUT
echo -e "#>>># CENSO: All done!"
echo -e "\n#>>># CENSO: All done!" >> $OUT
fi
################################################################################
if [ "$mode" == "3" ]; then
# MODE3 = CREST_COMBI + CENSO with optimization (NO gESC)
############## full crest_combi GFN2 + DFT opt #############
echo -e "#>>># Running full crest_combi in $m in MODE 3 (no gESC)"
echo -e "#>>># Running full crest_combi in $m in MODE 3 (no gESC)" >> $OUT
if [ "$run" == "vaporpressure" ] && [ "$s" != "gas" ]; then
s=$s1_alpb
change_solvent="on"
fi
#----------------------------------------------------------------------
PARAMS3crest=(
-s "$s"
-ewin "$ec"
-T "$T"
)
if [ "$run" = "nmr" ]; then
# create anmr_nucinfo anmr_rotamers
PARAMS3crest+=("-nmr")
elif [ "$run" = "or" ]; then
# increases number of clusters in crest_combi
PARAMS3crest+=("-or")
fi
if [ "$xt_search" == "on" ]; then
# search with FF + GFN2
PARAMS2crest+=("-xt")
fi
time crest_combi "${PARAMS3crest[@]}" >> $OUT
#----------------------------------------------------------------------
rm -rf enso* CONF*
echo -e "#>>># Running CENSO after full crest_combi in $m "
echo -e "\n#>>># Running CENSO after full crest_combi in $m \n" >> $OUT
if [ "$run" == "vaporpressure" ] && [ "$change_solvent" == "on" ]; then
s="same"
change_solvent="off"
fi
PARAMS3=(
-solvent "$s"
-chrg "$chrg"
-u "$uhf"
-inp crest_combi.xyz
-part0 on
-part0_threshold "$ep0"
-part1 on
-part1_threshold "$ep1"
-part2 on
-optlevel2 "$olev"
-part3 "$p3"
-part4 "$nmr"
-OR "$or"
--vapor_pressure "$vp"
--temperature "$temperature"
-inprc "$censorc"
-P "$P"
-O "$O"
-progress "$progress"
)
time censo "${PARAMS3[@]}" >> $OUT
echo -e "#>>># CENSO: All done!"
echo -e "\n#>>># CENSO: All done!" >> $OUT
fi
################################################################################
cd "$startdir"
done
fi # run block
if [ "$run" == "vaporpressure" ]; then
printf "\n====================================================\n"
echo "Vapor pressure evaluation: "
# p = p0 * exp(-ΔG/RT)
# ΔG = Gvapor -Gliquid
temperature=$(echo "$temperature" | gawk '{printf " %12.2f\n", $1}')
for i in 1 2 3
do
gvap=$(grep "<<==part$i==" B/crenso.out | tail -n 1 | gawk '{printf" %12.7f\n", $4}')
fromvap=$(grep "<<==part$i==" B/crenso.out | tail -n 1 | gawk '{print $5}')
gliq=$(grep "<<==part$i==" A/crenso.out | tail -n 1 | gawk '{printf" %12.7f\n", $5}')
fromliq=$(grep "<<==part$i==" A/crenso.out | tail -n 1 | gawk '{print $6}')
if [ $i == 3 ]; then
fromvap="<<==part$i=="
fromliq="<<==part$i=="
fi
if [ "$gvap" != "" ]; then
echo "G_vap = $gvap a.u. $fromvap"
echo "G_liq = $gliq a.u. $fromliq"
dG=$(echo "$gvap $gliq" |gawk '{printf " %12.2f\n", ($1-$2)*627.50947428}')
echo "ΔG = $dG kcal/mol"
vwork=$(echo "$temperature" | gawk '{printf" %12.2f\n", 0.001987204258641*$1*log(1/24.789561955/298.15*$1)}')
echo "vwork = $vwork kcal/mol"
p=$(echo "$gvap $vwork $gliq $temperature" |gawk '{printf " %12.5f\n", exp(-(($1+$2/627.50947428-$3)*627.50947428)/($4 * 0.001987204258641))*100}')
echo "temperature = $temperature K"
echo "vapor pressure = $p kPa"
echo ""
fi
done
echo "===================================================="
echo -e "\n#>>># CRENSO: All done!"
exit
fi
########################## print result (if no part1/2 out is present, a printout error message appears which can be ignored)
# the pKa fit is specific for r2SCAN-3c and H2O
dg1=0
dg2=0
dg3=0
echo "================================================"
if [ "$s1" == "gas" ]; then
g13=`grep '<<==part3==' A/$OUT | tail -1 | gawk '{print $4}'`
else
g13=`grep '<<==part3==' A/$OUT | tail -1 | gawk '{print $5}'`
fi
g23=`grep '<<==part3==' B/$OUT | tail -1 | gawk '{print $5}'`
if [ "$g13" != "" ]; then
dg3=$(echo "scale=10; ($g23-($g13))*627.50947428" | bc -l | gawk '{printf " %12.6f\n", $1}')
logk3=$(echo "scale=10; ($dg3)" | bc -l | gawk '{printf " %12.6f\n", ($1/0.592452)/2.302585}')
pkal3=$(echo "scale=10; ($logk3)" | bc -l | gawk '{printf " %12.3f\n", $1*0.890-170.0}')
pka33=$(echo "scale=10; ($logk3)" | bc -l | gawk '{printf " %12.3f\n", -1656.7+23.185*$1-0.11103*$1*$1+0.0001835*$1*$1*$1}')
echo $g13 $g23 " G (A/B) part3"
fi
if [ "$s1" == "gas" ]; then
g11=`grep '<<==part1==' A/$OUT | tail -1 | gawk '{print $4}'`
else
g11=`grep '<<==part1==' A/$OUT | tail -1 | gawk '{print $5}'`
fi
g21=`grep '<<==part1==' B/$OUT | tail -1 | gawk '{print $5}'`
if [ "$g11" != "" ]; then
dg1=$(echo "scale=10; ($g21-($g11))*627.50947428" | bc -l | gawk '{printf " %12.6f\n", $1}')
logk1=$(echo "scale=10; ($dg1)" | bc -l | gawk '{printf " %12.6f\n", ($1/0.592452)/2.302585}')
pkal1=$(echo "scale=10; ($logk1)" | bc -l | gawk '{printf " %12.3f\n", $1*0.890-170.0}')
pka31=$(echo "scale=10; ($logk1)" | bc -l | gawk '{printf " %12.3f\n", -1656.7+23.185*$1-0.11103*$1*$1+0.0001835*$1*$1*$1}')
echo $g11 $g21 " G (A/B) part1"
fi
if [ "$s1" = "gas" ]; then
g12=`grep '<<==part2==' A/$OUT | tail -1 | gawk '{print $4}'`
else
g12=`grep '<<==part2==' A/$OUT | tail -1 | gawk '{print $5}'`
fi
g22=`grep '<<==part2==' B/$OUT | tail -1 | gawk '{print $5}'`
if [ "$g12" != "" ]; then
dg2=$(echo "scale=10; ($g22-($g12))*627.50947428" | bc -l | gawk '{printf " %12.6f\n", $1}')
logk2=$(echo "scale=10; ($dg2)" | bc -l | gawk '{printf " %12.6f\n", ($1/0.592452)/2.302585}')
pkal2=$(echo "scale=10; ($logk2)" | bc -l | gawk '{printf " %12.3f\n", $1*0.890-170.0}')
pka32=$(echo "scale=10; ($logk2)" | bc -l | gawk '{printf " %12.3f\n", -1656.7+23.185*$1-0.11103*$1*$1+0.0001835*$1*$1*$1}')
echo $g12 $g22 " G (A/B) part2"
fi
if test -f A/coord.enso_best; then
a=`head -1 A/coord.enso_best | gawk '{print $5}'`
b=`head -1 B/coord.enso_best | gawk '{print $5}'`
echo $a $b
fi
if [ "$run" == "pka" ]; then
echo $pka31 $pkal1 " pka (qubic fit), pka(lin fit) part1"
echo $pka32 $pkal2 " pka (qubic fit), pka(lin fit) part2"
else
logk1=$(echo "scale=10; ($dg1)" | bc -l | gawk '{printf " %12.6f\n", (-$1/0.592452)/2.302585}')
logk2=$(echo "scale=10; ($dg2)" | bc -l | gawk '{printf " %12.6f\n", (-$1/0.592452)/2.302585}')
logk3=$(echo "scale=10; ($dg3)" | bc -l | gawk '{printf " %12.6f\n", (-$1/0.592452)/2.302585}')
echo "$logk1 logK $s2-$s1 part1"
echo "$logk2 logK $s2-$s1 part2"
echo "$logk3 logK $s2-$s1 part3"
fi
echo "================================================"
echo -e "\n#>>># CRENSO: All done!"