Nuclephile Substitution CH3Cl - BM: Difference between revisions
Line 46: | Line 46: | ||
== Calculation == | == Calculation == | ||
In the blue moon method, the free energy difference is computed by integration of the free energy gradients computed for several points differing in the value of the collective variable distributed between known inital and final states. The gradients for each point are computed within a constrained molecular dynamics simulation (note the value of ''STATUS''=0 for the collective variable defined in the {{TAG|ICONST}} file). | |||
=== Running the calculation === | === Running the calculation === | ||
Line 96: | Line 98: | ||
let step=step+1 | let step=step+1 | ||
done | done | ||
done | |||
=== Free-energy profile === | |||
The free energy gradient is obtained as a ratio of two averages (see {{TAG|Constrained molecular dynamics}}). This is done by the script ''fgradBM.sh'': | |||
#!/bin/bash | |||
#c equilibration period | |||
equil=2000 | |||
if [ -f "grad.dat" ]; then | |||
rm grad.dat | |||
fi | |||
touch grad.dat | |||
for i in 1 2 3 4 5 6 7 | |||
do | |||
rm rep.* | |||
j=1 | |||
while [ $j -le 100 ] | |||
do | |||
if test -f $i/report.$j | |||
then | |||
grep b_m $i/report.$j >> rep.$i.1 | |||
fi | |||
let j=j+1 | |||
done | |||
#c obtain ingredients for FE-gradfient calculation | |||
#c (cf. eq. 12 in JPCM 20, 064211 (2008)) | |||
if test -f $i/report.1 | |||
then | |||
#c value of the constrained coordinate | |||
x1=$(grep cc $i/report.1|head -1|awk '{print $3}') | |||
nlines=$(wc -l rep.$i.1|awk '{print $1}') | |||
let prod=nlines-equil | |||
#c calculation of the FE-gradfient | |||
#c (cf. eq. 12 in JPCM 20, 064211 (2008)) | |||
zet=$(grep b_m rep.$i.1|tail -$prod |awk 'BEGIN {a=0.} {a+=$3} END {print a/NR}') | |||
g1=$(grep b_m rep.$i.1|tail -$prod |awk 'BEGIN {a=0.} {a+=$5} END {print a/NR/"'${zet}'"}') | |||
echo $x1 $g1 >> grad.dat | |||
fi | |||
done | done | ||
Revision as of 09:46, 4 October 2019
Task
In this example the nucleophile substitution of a Cl- by another Cl- in CH3Cl is simulated using bluemoon sampling.
Input
POSCAR
In the blue moon sampling method several POSCAR files are used for different values of the collective variable.
KPOINTS
Automatic 0 Gamma 1 1 1 0. 0. 0.
- For isolated atoms and molecules interactions between periodic images are negligible (in sufficiently large cells) hence no Brillouin zone sampling is necessary.
INCAR
PREC=Low EDIFF=1e-6 LWAVE=.FALSE. LCHARG=.FALSE. NELECT=22 NELMIN=4 LREAL=.FALSE. ALGO=VeryFast ISMEAR=-1 SIGMA=0.0516 ############################# MD setting ##################################### IBRION=0 # MD simulation NSW=1000 # number of steps POTIM=1 # integration step TEBEG=600 # simulation temperature MDALGO=11 # Andersen thermostat ANDERSEN_PROB=0.10 # collision probability LBLUEOUT=.TRUE. # write down output needed to # compute free-energy gradient ##############################################################################
- The setting LBLUEOUT=.TRUE. tells VASP to write out the information needed for the computation of free energies.
Calculation
In the blue moon method, the free energy difference is computed by integration of the free energy gradients computed for several points differing in the value of the collective variable distributed between known inital and final states. The gradients for each point are computed within a constrained molecular dynamics simulation (note the value of STATUS=0 for the collective variable defined in the ICONST file).
Running the calculation
The mass for hydrogen in this example is set 3.016 a.u. corresponding to the tritium isotope. This way larger timesteps can be chosen for the MD (note that the free energy is independent of the masses of atoms). The simulation for each of the points along the reaction coordinate is performed in a separate directory called 1, 2, ..., 7. These are created automatically by the run script. For practical reasons, we split our (presumably long) blue moon calculation into shorter runs of length of 1000 fs (NSW=1000; POTIM=1). This is done automatically in the script run which looks as follows:
#!/bin/bash drct=$(pwd) runvasp="mpirun -np x executable_path" # ensure that this sequence of MD runs is reproducible - not needed # in a real-world application rseed="RANDOM_SEED = 311137787 0 0" #c loop over "points" (i.e. structures #c with difference value of CV) for j in 1 2 3 4 5 6 7 do cd $drct mkdir ${j} cp POSCAR.$j ${j}/POSCAR cp POTCAR KPOINTS ICONST $j cd $j #c here we perform sequence of MD runs #c for each point step=1 while [ $step -le 7 ] do if ! test -f report.${step} then # ensure that this sequence of MD runs is reproducible cp ${drct}/INCAR . echo $rseed >> INCAR cp POSCAR POSCAR.$step $runvasp # ensure that this sequence of MD runs is reproducible rseed=$(grep RANDOM_SEED REPORT |tail -1) #c backup some important files cp CONTCAR POSCAR cp REPORT report.$step grep F OSZICAR > osz.$step cp vasprun.xml vasprun.xml.$step fi let step=step+1 done done
Free-energy profile
The free energy gradient is obtained as a ratio of two averages (see Constrained molecular dynamics). This is done by the script fgradBM.sh:
#!/bin/bash #c equilibration period equil=2000 if [ -f "grad.dat" ]; then rm grad.dat fi touch grad.dat for i in 1 2 3 4 5 6 7 do rm rep.* j=1 while [ $j -le 100 ] do if test -f $i/report.$j then grep b_m $i/report.$j >> rep.$i.1 fi let j=j+1 done #c obtain ingredients for FE-gradfient calculation #c (cf. eq. 12 in JPCM 20, 064211 (2008)) if test -f $i/report.1 then #c value of the constrained coordinate x1=$(grep cc $i/report.1|head -1|awk '{print $3}') nlines=$(wc -l rep.$i.1|awk '{print $1}') let prod=nlines-equil #c calculation of the FE-gradfient #c (cf. eq. 12 in JPCM 20, 064211 (2008)) zet=$(grep b_m rep.$i.1|tail -$prod |awk 'BEGIN {a=0.} {a+=$3} END {print a/NR}') g1=$(grep b_m rep.$i.1|tail -$prod |awk 'BEGIN {a=0.} {a+=$5} END {print a/NR/"'${zet}'"}') echo $x1 $g1 >> grad.dat fi done