Nuclephile Substitution CH3Cl - BM: Difference between revisions

From VASP Wiki
Line 21: Line 21:


=== {{TAG|INCAR}} ===
=== {{TAG|INCAR}} ===
{{TAGBL|PREC}}=Low
  {{TAGBL|PREC}}=Low
{{TAGBL|EDIFF}}=1e-6
  {{TAGBL|EDIFF}}=1e-6
{{TAGBL|LWAVE}}=.FALSE.
  {{TAGBL|LWAVE}}=.FALSE.
{{TAGBL|LCHARG}}=.FALSE.
  {{TAGBL|LCHARG}}=.FALSE.
{{TAGBL|NELECT}}=22
  {{TAGBL|NELECT}}=22
{{TAGBL|NELMIN}}=4
  {{TAGBL|NELMIN}}=4
{{TAGBL|LREAL}}=.FALSE.
  {{TAGBL|LREAL}}=.FALSE.
{{TAGBL|ALGO}}=VeryFast
  {{TAGBL|ALGO}}=VeryFast
{{TAGBL|ISMEAR}}=-1
  {{TAGBL|ISMEAR}}=-1
{{TAGBL|SIGMA}}=0.0516
  {{TAGBL|SIGMA}}=0.0516
 
############################# MD setting #####################################
  ############################# MD setting #####################################
{{TAGBL|IBRION}}=0                                          # MD simulation
  {{TAGBL|IBRION}}=0                                          # MD simulation
{{TAGBL|NSW}}=1000                                          # number of steps
  {{TAGBL|NSW}}=1000                                          # number of steps
{{TAGBL|POTIM}}=1                                            # integration step
  {{TAGBL|POTIM}}=1                                            # integration step
{{TAGBL|TEBEG}}=600                                          # simulation temperature
  {{TAGBL|TEBEG}}=600                                          # simulation temperature
{{TAGBL|MDALGO}}=11                                          # Andersen thermostat
  {{TAGBL|MDALGO}}=11                                          # Andersen thermostat
{{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
##############################################################################
  ##############################################################################


*The setting {{TAG|LBLUEOUT}}=''.TRUE.'' tells VASP to write out the information needed for the computation of free energies.
*The setting {{TAG|LBLUEOUT}}=''.TRUE.'' tells VASP to write out the information needed for the computation of free energies.

Revision as of 12:47, 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