User Tools

Site Tools


exercises:2019_uzh_acpc2:ex03

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
exercises:2019_uzh_acpc2:ex03 [2019/05/13 21:33] keimreexercises:2019_uzh_acpc2:ex03 [2020/08/21 10:15] (current) – external edit 127.0.0.1
Line 5: Line 5:
 $$ \text{Cl}^- + \text{CH}_3\text{Cl} \longleftrightarrow \text{Cl}\text{CH}_3 + \text{Cl}^-. $$ $$ \text{Cl}^- + \text{CH}_3\text{Cl} \longleftrightarrow \text{Cl}\text{CH}_3 + \text{Cl}^-. $$
  
-For energy and force evaluation, we will use the Parameterization Method 6 (PM6), which is a relatively inexpensive semiempirical model for electronic structure. For accurate reaction characterizations, ab initio methods, such as DFT or higher, should be used.+For energy and force evaluation, we will use the Parameterization Method 6 (PM6), which is a relatively inexpensive semiempirical model for electronic structure evaluation. For accurate reaction characterizations, ab initio methods, such as DFT or higher level, should be used.
  
-===== Activation barrier =====+===== NEB activation barrier =====
  
 In order to find the activation barrier for the reaction we will use the NEB method. The NEB method provides a way to find the minimum energy path (MEP) between two different conformations of the system corresponding local potential energy minima. The MEP is a one-dimensional path on the $3N$-dimensional potential energy landscape and every point on the MEP is a potential energy minimum in all directions perpendicular to the path. MEP passes at least one saddle point and the energy of the highest saddle point is the peak of the activation barrier of the reaction. In order to find the activation barrier for the reaction we will use the NEB method. The NEB method provides a way to find the minimum energy path (MEP) between two different conformations of the system corresponding local potential energy minima. The MEP is a one-dimensional path on the $3N$-dimensional potential energy landscape and every point on the MEP is a potential energy minimum in all directions perpendicular to the path. MEP passes at least one saddle point and the energy of the highest saddle point is the peak of the activation barrier of the reaction.
Line 13: Line 13:
 === Geometry optimizations === === Geometry optimizations ===
  
-To start the NEB calculation, we first need two geometries of the local minima, which we can obtain by running geometry optimization calculations. Use the following CP2K input script to obtain the first geometry:+To start the NEB calculation, we first need two different geometries at local energy minima, which we can obtain by running geometry optimization calculations. Use the following CP2K input script to obtain the first geometry:
  
 <code - geo.inp> <code - geo.inp>
Line 81: Line 81:
 === NEB === === NEB ===
  
-Now we are ready to start the NEB. Obtain the two optimized geometries from the GEO_OPT trajectories (last step in the `ch3cl-pos-1.xyzfile) to a separate folder and name them `init.xyzand `final.xyz`.+Now we are ready to start the NEB. Obtain the two optimized geometries from the GEO_OPT trajectories (last step in the ''ch3cl-pos-1.xyz'' file) to a separate folder and name them ''init.xyz'' and ''final.xyz''.
 Now the NEB calculation can be run by the following input script: Now the NEB calculation can be run by the following input script:
  
Line 135: Line 135:
 </code> </code>
  
-In the main output of the NEB calculation, you will find the following type of sections:+In the main output of the NEB calculation, you will find a number of the following sections:
 <code> <code>
 ******************************************************************************* *******************************************************************************
Line 151: Line 151:
  *******************************************************************************  *******************************************************************************
 </code> </code>
-The sections show for every replica geometry along the NEB trajectory, the distance to its neighbors and its energy. The final section corresponds to the converged NEB trajectory.+These sections show for every replica geometry along the NEB trajectory, the distance to its neighbors and its energy. The final section corresponds to the converged NEB trajectory.
  
 <note>**TASK 2** <note>**TASK 2**
Line 161: Line 161:
 ===== Free energy surface ===== ===== Free energy surface =====
  
 +Sampling the free energy surface (FES) of a chemical system is a convenient method to explore various stable conformations and possible reaction pathways. To calculate the FES for complicated systems, advanced sampling methods (such as umbrella sampling, metadynamics, parallel tempering, ...) have to be used. However, for our simple $S_N2$ reaction, we will use unbiased Molecular Dynamics (MD). 
  
 +The FES is a projection of the high-dimensional free energy landscape into a small number, usually two, dimensions. These two dimensions are called collective variables (CV) and they must be chosen such that various stable conformations can be distinguished and the reaction pathways can be adequately described by the FES. For complex systems, the choice of CVs is a non-trivial task. Fortunately for our simple system, the choice is simple: we take the distances of the two Cl anions from the central C as the CVs.
  
 +To help the calculation sample the parts of FES we care about, we will include restraints in the MD run, which prevent the Cl anions from going too far from the molecule.
  
 +The following CP2K input script runs our MD calculation and prints out the CV values for every step:
 +
 +<code - md.inp>
 +&GLOBAL
 +  PRINT_LEVEL LOW
 +  PROJECT ch3f
 +  RUN_TYPE MD                 # Molecular Dynamics
 +&END GLOBAL
 +&MOTION
 +  &MD                         # MD parameters
 +    ENSEMBLE NVT
 +    STEPS 200000
 +    TIMESTEP 0.5
 +    TEMPERATURE 1000.0
 +    &THERMOSTAT
 +      TYPE NOSE
 +      &NOSE
 +        TIMECON 100.
 +      &END NOSE
 +    &END THERMOSTAT
 +  &END MD
 +  &CONSTRAINT                 # Restraints to keep Cl from going too far
 +    &COLLECTIVE
 +      INTERMOLECULAR
 +      COLVAR 1
 +      TARGET 1.8
 +      &RESTRAINT
 +        K 0.005
 +      &END
 +    &END
 +    &COLLECTIVE
 +      INTERMOLECULAR
 +      COLVAR 2
 +      TARGET 1.8
 +      &RESTRAINT
 +        K 0.005
 +      &END
 +    &END
 +  &END
 +
 +  &FREE_ENERGY                 # Section to print out the values of CVs every step
 +    &METADYN
 +      DO_HILLS .FALSE.
 +      &METAVAR
 +        SCALE 0.2
 +        COLVAR 1
 +      &END
 +      &METAVAR
 +        SCALE 0.2
 +        COLVAR 2
 +      &END
 +      &PRINT
 +        &COLVAR
 +          COMMON_ITERATION_LEVELS 3
 +          &EACH
 +            MD 1
 +          &END
 +        &END COLVAR
 +      &END PRINT
 +    &END METADYN
 +  &END FREE_ENERGY
 +&END MOTION
 +
 +&FORCE_EVAL
 +  METHOD Quickstep
 +  &DFT
 +   ... Same as before ...
 +  &END DFT
 +
 +  &SUBSYS
 +    &CELL
 +      ABC 10.0 10.0 10.0
 +      PERIODIC NONE
 +    &END CELL
 +    &COORD
 +C      -4.03963494       0.97427857      -0.29785096
 +H      -3.97152206       2.11080568      -0.35500445
 +H      -3.95108814       0.19729141       0.53163699
 +H      -3.95810737       0.47922964      -1.32151084
 +Cl     -5.77885435       1.07089312      -0.04609427
 +Cl     -1.77974793       0.99422072      -0.29785096
 +    &END COORD
 +
 +    &COLVAR                    # CV definitions
 +      &DISTANCE
 +        ATOMS 1 5
 +      &END
 +    &END COLVAR
 +    &COLVAR
 +      &DISTANCE
 +        ATOMS 1 6
 +      &END
 +    &END COLVAR
 +   &END SUBSYS
 +&END FORCE_EVAL
 +</code>
 +
 +Free energy is expressed by 
 +
 +$$ F(s) = -k T \log(P(s)),$$
 +
 +where $s$ is the set CVs and $P(s)$ is the probability that the system has the set of CV values $s$.
 +
 +The following Python script can be used to calculate the FES from the ''ch3f-COLVAR.metadynLog'' file produced by the MD run. (Don't forget to change the temperature in Python script!)
 +
 +<code>
 +import numpy as np
 +import matplotlib.pyplot as plt
 +
 +bohr_2_angstrom = 0.529177
 +kb = 8.6173303e-5 # eV * K^-1
 +
 +temperature = 1000.0                          #Change temperature according to your MD simulations!
 +colvar_path = "./ch3f-COLVAR.metadynLog"
 +
 +# Load the colvar file
 +colvar_raw = np.loadtxt(colvar_path)
 +
 +# Extract the two CVs
 +d1 = colvar_raw[:, 1] * bohr_2_angstrom
 +d2 = colvar_raw[:, 2] * bohr_2_angstrom
 +
 +# Create a 2d histogram corresponding to the CV occurances
 +cv_hist = np.histogram2d(d1, d2, bins=50)
 +
 +# probability from the histogram
 +prob = cv_hist[0]/len(d1)
 +
 +# Free energy surface
 +fes = -kb * temperature * np.log(prob)
 +
 +# Save the image
 +extent = (np.min(cv_hist[1]), np.max(cv_hist[1]), np.min(cv_hist[2]), np.max(cv_hist[2]))
 +plt.figure(figsize=(8, 8))
 +plt.imshow(fes.T, extent=extent, aspect='auto', origin='lower', cmap='hsv')
 +cbar = plt.colorbar()
 +cbar.set_label("Free energy [eV]")
 +plt.xlabel("d1 [ang]")
 +plt.ylabel("d2 [ang]")
 +plt.savefig("./fes.png", dpi=200)
 +plt.close()
 +</code>
 +
 +Here is an example output for temperature 1000K. We clearly see the two local minima corresponding to the one of the chlorine atoms being covalently bonded (distance 1.8 Å) while the other one is around distance 2.5 Å.
 +
 +{{  :exercises:2019_uzh_acpc2:fes1000.png ?direct&500 |}}
 +
 +<note>**TASK 3**
 +  * Run the MD calculation for 400K, 800K, 1200K and 1600K. (The calculations can a take a while.)
 +  * Create the corresponding FES plots and discuss the temperature dependence.
 +  * In general, how does potential energy differ from free energy? For our reaction, what are the activation barriers from the different free energy surfaces? How and why do they differ from the NEB barrier?
 +</note>
exercises/2019_uzh_acpc2/ex03.1557783189.txt.gz · Last modified: 2020/08/21 10:15 (external edit)