Nuclephile Substitution CH3Cl - BM: Difference between revisions

From VASP Wiki
Line 44: Line 44:
  {{TAGBL|ANDERSEN_PROB}}=0.10                      # collision probability
  {{TAGBL|ANDERSEN_PROB}}=0.10                      # collision probability
  {{TAGBL|LBLUEOUT}}=.TRUE.                          # write down output needed to  
  {{TAGBL|LBLUEOUT}}=.TRUE.                          # write down output needed to  
                                                    # compute free-energy gradient
                                              # compute free-energy gradient
  ##############################################################################
  ##############################################################################



Revision as of 13:01, 21 January 2020

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.

Click to show/POSCARs


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, which writes the free energy gradient vs. the collective variable to the file grad.dat:

Click to show/fgradBM.sh

To execute that script type:

bash ./fgradBM.sh

For our purposes, a simple trapezoidal rule can be used for the integration of gradients. For accurate calculations, more sohpisticated integration schemes should be considered. The free energy vs. collective variable is obtained by forward integration using the script integrateForward.py:

Click to show/integrateForward.py

To execute that script type and write to the file free_energy.dat:

python integrateForward.py grad.dat > free_energy.dat

Finally to plot that file type:

gnuplot -e "set terminal jpeg; set xlabel 'Collective variable (Ang)'; set ylabel 'Free energy (eV)'; set style data lines; plot 'free_energy.dat'" > free_energy.jpg

The free energy profile should look like the following:

Note that much longer simulations should be performed (typically a few tens or hundreds of ps) in order to achieve well converged averages needed in accurate calculations.

Download

CH3Cl_BM.tgz