# QMMM Free Energy Old

### From NWChem

## 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