# Thermodynamic integration

Thermodynamic integration is a method used to compare the difference in free energy between two given states (e.g., A and B) whose potential energies ${\displaystyle U_{A}}$ and ${\displaystyle U_{B}}$ have different dependences on the spatial coordinates. Because the free energy of a system is not simply a function of the phase space coordinates of the system, but is instead a function of the Boltzmann-weighted integral over phase space (i.e. partition function), the free energy difference between two states cannot be calculated directly. In thermodynamic integration, the free energy difference is calculated by defining a thermodynamic path between the states and integrating over ensemble-averaged enthalpy changes along the path. Such paths can either be real chemical processes or alchemical processes. An example alchemical process is the Kirkwood's coupling parameter method.[1]

## Derivation

Consider two systems, A and B, with potential energies ${\displaystyle U_{A}}$ and ${\displaystyle U_{B}}$. The potential energy in either system can be calculated as an ensemble average over configurations sampled from a molecular dynamics or Monte Carlo simulation with proper Boltzmann weighting. Now consider a new potential energy function defined as:

${\displaystyle U(\lambda )=U_{A}+\lambda (U_{B}-U_{A})}$

Here, ${\displaystyle \lambda }$ is defined as a coupling parameter with a value between 0 and 1, and thus the potential energy as a function of ${\displaystyle \lambda }$ varies from the energy of system A for ${\displaystyle \lambda =0}$ and system B for ${\displaystyle \lambda =1}$. In the canonical ensemble, the partition function of the system can be written as:

${\displaystyle Q(N,V,T,\lambda )=\sum _{s}\exp[-U_{s}(\lambda )/k_{B}T]}$

In this notation, ${\displaystyle U_{s}(\lambda )}$ is the potential energy of state ${\displaystyle s}$ in the ensemble with potential energy function ${\displaystyle U(\lambda )}$ as defined above. The free energy of this system is defined as:

${\displaystyle F(N,V,T,\lambda )=-k_{B}T\ln Q(N,V,T,\lambda )}$,

If we take the derivative of F with respect to λ, we will get that it equals the ensemble average of the derivative of potential energy with respect to λ.

${\displaystyle \Delta F(A\rightarrow B)=\int _{0}^{1}{\frac {\partial F(\lambda )}{\partial \lambda }}d\lambda =-\int _{0}^{1}{\frac {k_{B}T}{Q}}{\frac {\partial Q}{\partial \lambda }}d\lambda =\int _{0}^{1}{\frac {k_{B}T}{Q}}\sum _{s}{\frac {1}{k_{B}T}}\exp[-U_{s}(\lambda )/k_{B}T]{\frac {\partial U_{s}(\lambda )}{\partial \lambda }}d\lambda =\int _{0}^{1}\left\langle {\frac {\partial U(\lambda )}{\partial \lambda }}\right\rangle _{\lambda }d\lambda =\int _{0}^{1}\left\langle U_{B}(\lambda )-U_{A}(\lambda )\right\rangle _{\lambda }d\lambda }$

The change in free energy between states A and B can thus be computed from the integral of the ensemble averaged derivatives of potential energy over the coupling parameter ${\displaystyle \lambda }$.[2] In practice, this is performed by defining a potential energy function ${\displaystyle U(\lambda )}$, sampling the ensemble of equilibrium configurations at a series of ${\displaystyle \lambda }$ values, calculating the ensemble-averaged derivative of ${\displaystyle U(\lambda )}$ with respect to ${\displaystyle \lambda }$ at each ${\displaystyle \lambda }$ value, and finally computing the integral over the ensemble-averaged derivatives.

Umbrella sampling is a related free energy method. It adds a bias to the potential energy. In the limit of an infinite strong bias it is equivalent to thermodynamic integration.[3]