Consider two systems, A and B, with potential energies U_A and 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: :U(\lambda) = U_A + \lambda(U_B - U_A) Here, \lambda is defined as a coupling parameter with a value between 0 and 1, and thus the potential energy as a function of \lambda varies from the energy of system A for \lambda = 0 and system B for \lambda = 1. In the
canonical ensemble, the partition function of the system can be written as: :Q(N, V, T, \lambda) = \sum_{s} \exp [-U_s(\lambda)/k_{B}T] In this notation, U_s(\lambda) is the potential energy of state s in the ensemble with potential energy function U(\lambda) as defined above. The free energy of this system is defined as: :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 λ. :\begin{align} \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 \end{align} 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 \lambda. In practice, this is performed by defining a potential energy function U(\lambda), sampling the ensemble of equilibrium configurations at a series of \lambda values, calculating the ensemble-averaged derivative of U(\lambda) with respect to \lambda at each \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 infinitely strong bias it is equivalent to thermodynamic integration. ==See also==