# QMMM Free Energy

### From NWChem

(moved QMMM Free Energy to QMMM Free Energy Old) |
|||

Line 1: | Line 1: | ||

- | # | + | ==Overview== |

+ | Free energy capabilities of QM/MM module are at this point restricted to calculations of free energy differences | ||

+ | between two fixed configurations of the QM region. | ||

+ | |||

+ | '''Users must be warned that this the least automated QM/MM functionality containing several calculation stages. Solid understanding of free energy calculations is required to achieve a meaningful calculation.''' | ||

+ | |||

+ | Description of the implemented methodology can be found in [http://jcp.aip.org/jcpsa6/v127/i5/p051102_s1 the following paper]. In this approach the free energy difference between the two configurations of the QM region (e.g. A and B): | ||

+ | |||

+ | <center><math> | ||

+ | \Delta W_{A\to B}=-1/\beta \ln \langle (e^{-\beta (E_B-E_A)}) \rangle_{A} | ||

+ | </math></center> | ||

+ | |||

+ | is approximated as a sum of internal QM contribution and solvation: | ||

+ | |||

+ | <center><math> | ||

+ | \Delta W_{A\to B}\approx\Delta W_{A\to B}^{int}+\Delta W_{A\to B}^{solv} | ||

+ | </math></center> | ||

+ | |||

+ | It is presumed that structures of A and B configurations are available as restart files sharing '''common''' topology file. | ||

+ | |||

+ | ==Internal contribution== | ||

+ | The internal QM contribution is given by the differences in the internal QM energies evaluated at the '''optimized''' MM environment: | ||

+ | |||

+ | <center><math> | ||

+ | \Delta W_{A\to B}^{int}=E_{B}^{int}-E_{A}^{int} | ||

+ | </math></center> | ||

+ | |||

+ | The internal QM energy is nothing more but a gas phase expression total energy but evaluated with the wavefunction obtained in the presence of the environment. To calculate internal QM contribution to free energy difference one has to | ||

+ | |||

+ | #Optimize MM environment for each configuration | ||

+ | #Perform total energy calculation for each configuration | ||

+ | #Calculate internal energy difference | ||

+ | |||

+ | Note that internal QM energy can be found | ||

+ | in the QM/MM output file under "quantum energy internal" name. | ||

+ | |||

+ | ==Solvation contribution== | ||

+ | |||

+ | The solvation contribution is evaluated by averaging energy difference between A and B configurations of the QM system represented by a set of ESP charges. | ||

+ | |||

+ | <center><math> | ||

+ | \Delta W_{A\to B}^{solv}=-1/\beta \ln \langle (e^{-\beta (E_B^{ESP}-E_A^{ESP})}) \rangle_{A} | ||

+ | </math></center> | ||

+ | where <math>E_A^{ESP}</math> is the total energy of the system where QM region is replaced by a set of fixed point ESP charges. | ||

+ | |||

+ | In majority of cases the A and B configuration are "too far apart" and one step free energy calculation as shown above will not lead to meaningful results. | ||

+ | One solution is to introduce intermediate points that bridge A and B configurations by linear interpolation | ||

+ | |||

+ | <center><math> | ||

+ | R_{\lambda_i} = (1-\lambda_i)R_A + \lambda_i R_B | ||

+ | </math></center> | ||

+ | |||

+ | |||

+ | <center><math> | ||

+ | Q_{\lambda_i} = (1-\lambda_i)Q_A + \lambda_i Q_B | ||

+ | </math></center> | ||

+ | |||

+ | where | ||

+ | |||

+ | <center><math> | ||

+ | \lambda_i = \frac {i}{n}, \quad i=0,..,n | ||

+ | \,\!</math></center> | ||

+ | |||

+ | |||

+ | The solvation free energy difference can be then written as sum of differences for the subintervals <math> \,\! [\lambda_i\to\lambda_{i+1}]</math>: | ||

+ | <center><math>\begin{matrix} | ||

+ | \Delta W_{A\to B}^{\rm esp} = \sum_{i=0}^{n}\Delta W_{\lambda_i\to\lambda_{i+1}}^{\rm esp} | ||

+ | \end{matrix}</math></center> | ||

+ | |||

+ | To expedite the calculation it is convenient to use a double wide sampling strategy where | ||

+ | the free energy differences for the intervals <math> \,\! [\lambda_{i-1}\to\lambda_{i}]</math> and <math> \,\! [\lambda_i\to\lambda_{i+1}]</math> | ||

+ | are calculated simultaneously by sampling around <math> \,\!\lambda_{i}</math> point. In the simplest case | ||

+ | where we use two subintervals (n=2) | ||

+ | |||

+ | <center><math> | ||

+ | \Delta W_{A\to B}^{solv} \equiv \Delta W_{0\to 1}= \Delta W_{0\to 0.5}^{solv}+\Delta W_{0.5\to 1}^{solv} | ||

+ | </math></center> | ||

+ | |||

+ | or | ||

+ | |||

+ | <center><math> | ||

+ | \Delta W_{A\to B}^{\rm solv} = -\Delta W_{0.5\to 0}^{\rm solv}+\Delta W_{0.5 \to 1}^{\rm solv} | ||

+ | </math></center> | ||

+ | |||

+ | |||

+ | The following items are necessary: | ||

+ | |||

+ | #Restart file corresponding to either A or B configuration of the QM region (sharing the same topology file) | ||

+ | #ESP charges for QM region in .esp format for both configurations | ||

+ | #Coordinates for QM regions in .xyzi format for both configurations | ||

+ | |||

+ | Both .esp and .xyzi files would be typically obtained during the calculation of internal free energy (see above). ESP charges would be generated in the perm directory | ||

+ | during optimization of the MM region. | ||

+ | The xyzi is basically xyz structure file with an extra column that | ||

+ | allows to map coordinates of QM atoms to the overall system. The xyzi file can also be obtained as part of calculation of internal free energy by inserting | ||

+ | set qmmm:region_print .true. | ||

+ | anywhere in the input file during energy calculation. | ||

+ | |||

+ | In the input file coordinates of QM region (xyzi files) and ESP charges (esp files) are set using the following directives | ||

+ | |||

+ | set qmmm:fep_geom xxx_A.xyzi xxx_B.xyzi | ||

+ | set qmmm:fep_esp xxx_A.esp xxx_B.esp | ||

+ | |||

+ | The current interpolation interval <math> \,\! [\lambda_i\to\lambda_{i+1}]</math> for which free energy difference is calculated is defined as | ||

+ | |||

+ | set qmmm:fep_lambda lambda_i lambda_i+1 | ||

+ | |||

+ | To enable double wide sampling use the following directive | ||

+ | |||

+ | set qmmm:fep_deriv .true. | ||

+ | |||

+ | If set, the above directive will perform both <math> \,\! [\lambda_i\to\lambda_{i+1}]</math> and <math> \,\! [\lambda_i\to\lambda_{i-1}]</math> calculations, where | ||

+ | |||

+ | <center><math> \,\! | ||

+ | \lambda_{i-1}=\lambda_i - (\lambda_{i+1}-\lambda_i) | ||

+ | </math></center> | ||

+ | |||

+ | The calculation proceeds in cycles. First a classical MD trajectory is generated around <math> \,\! \lambda_i</math> point. The parameters of this classical trajectory are set in the md block and must include | ||

+ | data <integer nsteps> | ||

+ | record coord <integer nfreq> | ||

+ | directives, where nsteps is total number of MD steps and nfreq (typically set to 1) indicates the sampling frequency. | ||

+ | |||

+ | The resulting trajectory containing nsteps/nfreq frames is then processed by the QM/MM module to calculate average energy differences over all the frames. This processesing is controlled by the QM/MN block which must include the following | ||

+ | qmmm | ||

+ | region mm | ||

+ | density espfit | ||

+ | trajectory <string trajectory_file> 1 nsteps/nfreq 1 | ||

+ | ncycles <integer n> | ||

+ | end | ||

+ | |||

+ | where trajectory_file indicates the MD trajectory file that should be processed. This file has an extension .trj and is typically named as <system>.trj. The ncycles setting indicates how many times the sampling process (consisting of generating if MD trajectory and its processing) should be repeated. It is possible to continue free energy sampling from the prior run | ||

+ | by using | ||

+ | set qmmm:extend .true. | ||

+ | directive, which will rely on the availability of .thm file containing information from prior calculation. | ||

+ | |||

+ | The solvation contribution calculation to QM/MM free energy is initiated through fep task directive | ||

+ | |||

+ | task qmmm fep |

## Revision as of 11:34, 24 August 2010

## Overview

Free energy capabilities of QM/MM module are at this point restricted to calculations of free energy differences between two fixed configurations of the QM region.

**Users must be warned that this the least automated QM/MM functionality containing several calculation stages. Solid understanding of free energy calculations is required to achieve a meaningful calculation.**

Description of the implemented methodology can be found in the following paper. In this approach the free energy difference between the two configurations of the QM region (e.g. A and B):

is approximated as a sum of internal QM contribution and solvation:

It is presumed that structures of A and B configurations are available as restart files sharing **common** topology file.

## Internal contribution

The internal QM contribution is given by the differences in the internal QM energies evaluated at the **optimized** MM environment:

The internal QM energy is nothing more but a gas phase expression total energy but evaluated with the wavefunction obtained in the presence of the environment. To calculate internal QM contribution to free energy difference one has to

- Optimize MM environment for each configuration
- Perform total energy calculation for each configuration
- Calculate internal energy difference

Note that internal QM energy can be found in the QM/MM output file under "quantum energy internal" name.

## Solvation contribution

The solvation contribution is evaluated by averaging energy difference between A and B configurations of the QM system represented by a set of ESP charges.

where is the total energy of the system where QM region is replaced by a set of fixed point ESP charges.

In majority of cases the A and B configuration are "too far apart" and one step free energy calculation as shown above will not lead to meaningful results. One solution is to introduce intermediate points that bridge A and B configurations by linear interpolation

where

The solvation free energy difference can be then written as sum of differences for the subintervals :

To expedite the calculation it is convenient to use a double wide sampling strategy where the free energy differences for the intervals and are calculated simultaneously by sampling around point. In the simplest case where we use two subintervals (n=2)

or

The following items are necessary:

- Restart file corresponding to either A or B configuration of the QM region (sharing the same topology file)
- ESP charges for QM region in .esp format for both configurations
- Coordinates for QM regions in .xyzi format for both configurations

Both .esp and .xyzi files would be typically obtained during the calculation of internal free energy (see above). ESP charges would be generated in the perm directory during optimization of the MM region. The xyzi is basically xyz structure file with an extra column that allows to map coordinates of QM atoms to the overall system. The xyzi file can also be obtained as part of calculation of internal free energy by inserting

set qmmm:region_print .true.

anywhere in the input file during energy calculation.

In the input file coordinates of QM region (xyzi files) and ESP charges (esp files) are set using the following directives

set qmmm:fep_geom xxx_A.xyzi xxx_B.xyzi set qmmm:fep_esp xxx_A.esp xxx_B.esp

The current interpolation interval for which free energy difference is calculated is defined as

set qmmm:fep_lambda lambda_i lambda_i+1

To enable double wide sampling use the following directive

set qmmm:fep_deriv .true.

If set, the above directive will perform both and calculations, where

The calculation proceeds in cycles. First a classical MD trajectory is generated around point. The parameters of this classical trajectory are set in the md block and must include

data <integer nsteps> record coord <integer nfreq>

directives, where nsteps is total number of MD steps and nfreq (typically set to 1) indicates the sampling frequency.

The resulting trajectory containing nsteps/nfreq frames is then processed by the QM/MM module to calculate average energy differences over all the frames. This processesing is controlled by the QM/MN block which must include the following

qmmm region mm density espfit trajectory <string trajectory_file> 1 nsteps/nfreq 1 ncycles <integer n> end

where trajectory_file indicates the MD trajectory file that should be processed. This file has an extension .trj and is typically named as <system>.trj. The ncycles setting indicates how many times the sampling process (consisting of generating if MD trajectory and its processing) should be repeated. It is possible to continue free energy sampling from the prior run by using

set qmmm:extend .true.

directive, which will rely on the availability of .thm file containing information from prior calculation.

The solvation contribution calculation to QM/MM free energy is initiated through fep task directive

task qmmm fep