Free-Energy Perturbation: A Pedagogical Introduction

by Corin Wagen Β· Mar 4, 2026

This interactive tutorial illustrates the core concepts behind free-energy perturbation (FEP) using simple 1D toy systems where we can compare numerical estimates to exact analytical results. While there's a lot that's not included in this tutorial, we hope that this helps give scientists who aren't already stat-mech experts a sense for what's going on "under the hood" in FEP.

What Problem Are We Solving?

We want to compute the free-energy difference Ξ”A\Delta A between two thermodynamic states (0 and 1) with potential energy functions U0(x)U_0(x) and U1(x)U_1(x). In real life, these two states might be two ligands bound to a protein or two ionization states of a molecule.

The free energy AA is related to the partition function ZZ:

A=βˆ’kBTln⁑ZA = -k_B T \ln Z

where Z=∫eβˆ’Ξ²U(x)dxZ = \int e^{-\beta U(x)} dx and Ξ²=1/kBT\beta = 1/k_B T. (TT is the temperature and kBk_B is Boltzmann's constant.)

The challenge is that we can't easily compute ZZ directly in complex systems. Instead, we can sample configurations from a Boltzmann distribution. FEP provides a way for us to convert these samples into an estimate of Ξ”A\Delta A.

Let's make this concrete. We'll use harmonic oscillators for this tutorial because they have analytical solutions; the potential energy is determined by the spring constant kk and the equilibrium position x0x_0:

U(x)=12k(xβˆ’x0)2U(x) = \frac{1}{2} k (x - x_0)^2

The partition function is Z=2Ο€/Ξ²kZ = \sqrt{2\pi / \beta k}, giving:

A=12kBTln⁑(Ξ²k2Ο€)A = \frac{1}{2} k_B T \ln\left(\frac{\beta k}{2\pi}\right)

For two oscillators with force constants k0k_0 and k1k_1 (same center):

Ξ”Aexact=12kBTln⁑(k1k0)\Delta A_{exact} = \frac{1}{2} k_B T \ln\left(\frac{k_1}{k_0}\right)

Use the sliders below to explore how the potentials and Boltzmann distributions change with different force constants:

Loading chart...

The Zwanzig Equation

The Zwanzig equation (1954) gives us an exact expression for Ξ”A\Delta A that doesn't depend on the partition function:

Ξ”A=A1βˆ’A0=βˆ’kBTln⁑⟨eβˆ’Ξ²(U1βˆ’U0)⟩0\Delta A = A_1 - A_0 = -k_B T \ln \left\langle e^{-\beta (U_1 - U_0)} \right\rangle_0

Here, βŸ¨β‹…βŸ©0\langle \cdot \rangle_0 denotes an ensemble average over configurations sampled from state 0.

In practice, we:

  1. Sample configurations {xi}\{x_i\} from the Boltzmann distribution of state 0
  2. Compute Ξ”Ui=U1(xi)βˆ’U0(xi)\Delta U_i = U_1(x_i) - U_0(x_i) for each configuration
  3. Estimate: Ξ”Aβ‰ˆβˆ’kBTln⁑(1Nβˆ‘ieβˆ’Ξ²Ξ”Ui)\Delta A \approx -k_B T \ln \left( \frac{1}{N} \sum_i e^{-\beta \Delta U_i} \right)

The accuracy of the output result depends on the accuracy of the ensemble average. Try different sample sizes and resample to see how the estimate varies:

Loading chart...

The Overlap Problem

This simple approach works well when the two states have good phase-space overlap. When the states are very different, though, sampling becomes much harder. Try increasing k1k_1 below and see how the accuracy of the Ξ”A\Delta A estimate changes for different sample numbers:

Loading chart...

When the states are too different, most samples from state 0 have very high energies in state 1, leading to Boltzmann factors near zero. The average is then dominated by a few rare samples, causing high variance and unreliable estimates.

Fortunately, there's a solution. Instead of jumping directly from state 0 to state 1, we introduce intermediate states parameterized by λ∈[0,1]\lambda \in [0, 1]:

UΞ»(x)=(1βˆ’Ξ»)U0(x)+Ξ»U1(x)U_\lambda(x) = (1-\lambda) U_0(x) + \lambda U_1(x)

For our harmonic oscillators:

UΞ»(x)=12kΞ»x2wherekΞ»=(1βˆ’Ξ»)k0+Ξ»k1U_\lambda(x) = \frac{1}{2} k_\lambda x^2 \quad \text{where} \quad k_\lambda = (1-\lambda) k_0 + \lambda k_1

Now we can compute Ξ”A\Delta A as a sum of small steps:

Ξ”A=βˆ‘i=0nβˆ’1Ξ”AΞ»iβ†’Ξ»i+1\Delta A = \sum_{i=0}^{n-1} \Delta A_{\lambda_i \to \lambda_{i+1}}

Using intermediate states allows us to compute accurate free-energy estimates even between very different states. Try adding intermediate states below and see how the estimate of Ξ”A\Delta A changes. (You can click "Resample" to rerun the simulation.)

Loading chart...

Adding just a few lambda windows dramatically increases the accuracy of the simulation, but there are diminishing marginal returns: once there's sufficient overlap between adjacent states, more windows just adds complexity without increasing accuracy.

Shifted Oscillators

Now let's consider oscillators with different centers.

For harmonic oscillators with the same force constant but different centers, Ξ”A=0\Delta A = 0 regardless of the shift (the partition function only depends on kk, not x0x_0). But the Zwanzig equation will have trouble due to poor overlap and typically predict non-zero values. Try this yourself by increasing Ξ”x\Delta x on the slider below; as before, adding lambda windows prevents poor overlap and allows us to get the correct prediction.

Loading chart...

Real-World FEP

These toy systems illustrate some of the key concepts of FEP: small perturbations are easy to model, while larger perturbations often have insufficient phase-space overlap and require large numbers of intermediates to give reliable results. This is why relative binding affinities are so much easier to compute than absolute binding affinities, and also why small chemical perturbations are easier to handle than large chemical perturbations.

In practical FEP simulations used to compute protein–ligand binding affinity, the potential-energy function is much more complicated and it's not possible to directly sample from the Boltzmann distribution. Instead, we have to run molecular dynamics, which introduces an additional set of sampling challenges. State-of-the-art FEP engines like TMD incorporate a large number of "tricks" aimed at increasing sampling as much as possible: grand canonical Monte Carlo water sampling, local resampling, replica exchange with solute temperating, and so on.

If you're interested in trying FEP on real problems, Rowan offers self-service and managed FEP calculations designed to accelerate early-stage drug discovery.

Banner background image

What to Read Next

Free-Energy Perturbation

Free-Energy Perturbation

what FEP is and why it's useful; limitations of current methods; Rowan FEP, TMD, and public benchmarks; how to run FEP in Rowan; the dream of FEP "too cheap to meter"; how to try Rowan FEP
Mar 4, 2026 Β· Corin Wagen, Eli Mann, Ari Wagen, and Spencer Schenider
Free-Energy Perturbation: A Pedagogical Introduction

Free-Energy Perturbation: A Pedagogical Introduction

Learn the core concepts behind free energy perturbation (FEP) using interactive 1D toy systems with exact analytical results.
Mar 4, 2026 Β· Corin Wagen
Solvent-Dependent Conformer Search

Solvent-Dependent Conformer Search

a good conformer is hard to find; clustering and the ReSCoSS workflow; Rowan's implementation, with some expert help; a demonstration on maraviroc
Feb 26, 2026 Β· Corin Wagen and Ari Wagen
How to Predict Protein–Ligand Binding Affinity

How to Predict Protein–Ligand Binding Affinity

A comparison of seven different approaches to predicting binding affinity.
Feb 13, 2026 Β· Corin Wagen
SAPT, Protein Preparation, and Starling-Based Microscopic pKa

SAPT, Protein Preparation, and Starling-Based Microscopic pKa

interaction energy decomposition w/ SAPT0 & a warning; making protein preparation more granular; catching forcefield errors earlier; microscopic pKa via Starling; internship applications now open
Feb 12, 2026 Β· Corin Wagen, Jonathon Vandezande, Ari Wagen, and Eli Mann
Credits FAQ

Credits FAQ

How credits work, why Rowan tracks usage with credits, and how these numbers translate into real-world workflows.
Feb 9, 2026 Β· Corin Wagen and Ari Wagen
Analogue Docking, Protein MD, Multiple Co-Folding Samples, Speed Estimates, and 2FA

Analogue Docking, Protein MD, Multiple Co-Folding Samples, Speed Estimates, and 2FA

docking analogues to a template; running MD on proteins w/o ligands; generating multiple structures with Boltz & Chai; runtime estimates & dispatch information; two-factor authentication; speedups
Jan 28, 2026 Β· Corin Wagen, Ari Wagen, and Spencer Schneider
Predicting Permeability for Small Molecules

Predicting Permeability for Small Molecules

why permeability matters; different experimental and computational approaches; Rowan's supported methods; an example script
Jan 9, 2026 Β· Corin Wagen, Eli Mann, and Ari Wagen
2025 in Review

2025 in Review

looking back on the last year for Rowan
Jan 1, 2026 Β· Corin Wagen
Making Rowan Even Easier To Use

Making Rowan Even Easier To Use

easier sign-on; layered security with IP whitelists; clearer costs; solvent-aware conformer searching; interviews with onepot and bioArena
Dec 16, 2025 Β· Ari Wagen, Spencer Schneider, and Corin Wagen