Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Rare barrier-crossing events in a double-well potential

In this notebook we study the dynamics of a particle evolving in a symmetric double-well potential to introduce the concepts of rare-event dynamics and transition-state theory.

The double-well potential has the form:

V(x)=ax4−bx2+C,V(x) = a x^4 - b x^2 + C ,

where we choose the constant CC so that both minima are exactly at zero energy. The barrier height is then Vbarrier=b2/(4a)V_\mathrm{barrier} = b^2 / (4a).

Here we set the parameters and define the potential and its derivative

Here we define a function that initialises the trajectory and one that generates the trajectory by using the Velocity Verlet integration algorithm, coupled to a simple Andersen thermostat

Now we run the simulation

Now we plot the energy as a function of time

<Figure size 1200x400 with 1 Axes>

And then prepare an animation showing the position of the particle as a function of time using the trajectory we just generated. Here we first define a function so that we can use it later

Show the animation relative to the “regular” simulation

/tmp/ipykernel_3542950/318829961.py:22: MatplotlibDeprecationWarning: Setting data with a non sequence type is deprecated since 3.7 and will be remove two minor releases later
  particle.set_data(x[frame], V_pot(x[frame]) / kT)
Loading...

1Umbrella Sampling Around the Barrier Top

In unbiased simulations, configurations near the top of the barrier are visited very rarely, making it hard to estimate the free-energy profile there.

To improve sampling of these rare configurations, we use Umbrella Sampling (US):

  • We add a harmonic bias centered at the barrier top x0=0x_0 = 0:

    Vbias(x)=12kbias(x−x0)2V_\text{bias}(x) = \frac{1}{2} k_\text{bias} (x - x_0)^2
  • This stabilizes the particle near the barrier region.

  • From the biased simulation, we collect a histogram Pbias(x)P_\text{bias}(x).

  • We then unbias the distribution:

    Punbiased(x)∝Pbias(x) eβVbias(x),β=1/(kBT),P_\text{unbiased}(x) \propto P_\text{bias}(x)\, e^{\beta V_\text{bias}(x)}, \quad \beta = 1/(k_B T),

    and reconstruct the free energy

    F(x)=−kBTln⁡Punbiased(x)+const.F(x) = -k_B T \ln P_\text{unbiased}(x) + \text{const}.

In 1D, the theoretical free energy (up to a constant) is simply

Ftheory(x)=V(x),F_\text{theory}(x) = V(x),

so we can directly compare the US reconstruction to the known potential.

We start by defining some parameters, as well as the biasing functions

And then run the simulation with the functions defined before

Generate the animation

/tmp/ipykernel_3542950/318829961.py:22: MatplotlibDeprecationWarning: Setting data with a non sequence type is deprecated since 3.7 and will be remove two minor releases later
  particle.set_data(x[frame], V_pot(x[frame]) / kT)
Loading...

Build biased histogram and unbias it

<Figure size 700x400 with 1 Axes>

2Metadynamics: Turning Rare Events into Diffusion

Metadynamics is an enhanced-sampling technique designed to overcome free-energy barriers by building a history-dependent bias potential.

At regular intervals, small repulsive Gaussians are deposited in the space of a chosen collective variable (CV).
This discourages the system from revisiting already explored regions and gradually fills free-energy wells.

In this 1D example:

  • The collective variable is simply s(x)=xs(x) = x

  • Gaussians are deposited at the current particle position

  • The total potential becomes:

    Vtot(x,t)=V(x)+Vmeta(x,t)V_\text{tot}(x, t) = V(x) + V_\text{meta}(x, t)

As time progresses, barrier crossings become frequent and the particle explores the full landscape.

For simple systems and long times:

F(x)≈−Vmeta(x)+constF(x) \approx - V_\text{meta}(x) + \text{const}
<Figure size 1000x300 with 1 Axes>
<Figure size 700x400 with 1 Axes>