Get AI summaries of any video or article — Sign up free
Simulating and understanding phase change | Guest video by Vilas Winstein thumbnail

Simulating and understanding phase change | Guest video by Vilas Winstein

3Blue1Brown·
6 min read

Based on 3Blue1Brown's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.

TL;DR

Phase transitions in the lattice liquid–vapor model come from balancing energy minimization (adjacent molecules lower energy) against entropy maximization (many disordered configurations).

Briefing

A discretized “liquid–vapor” model reproduces water-like phase behavior—complete with a liquid–gas phase transition, a supercritical region, metastability, and fractal structure at the critical point—using only a simple energy rule plus statistical mechanics. The key insight is that macroscopic phases emerge from a competition between energy minimization (favoring clumped molecules) and entropy maximization (favoring many disordered configurations). That balance shifts with temperature, and the model’s phase diagram in the (temperature, chemical potential) plane mirrors the qualitative shape of real water.

The simulation represents a box as a grid of pixels: blue pixels hold molecules, white pixels are empty space. Two parameters steer the system. Temperature controls how strongly energy matters relative to randomness. Pressure is hard to implement directly in a fixed-size grid, so the model uses chemical potential instead, which plays a role analogous to pressure by controlling the tendency for the number density to increase or decrease. At high temperature, density changes smoothly with chemical potential—matching the idea of a supercritical fluid where liquid and gas become continuously connected. At low temperature, the system abruptly switches between low-density (gas-like) and high-density (liquid-like) behavior, producing a phase transition line; during the transition, the grid separates into regions that are mostly liquid-like or gas-like rather than smoothly blending.

Under the hood, the model samples microstates using the Boltzmann distribution: each configuration’s probability is proportional to exp(−E/T), where E is the microstate energy. The video motivates this formula by starting from isolated systems where all microstates at fixed energy are equally likely, then coupling two systems and asking what quantity equalizes at equilibrium. The equalized derivative of entropy with respect to energy is 1/T, which leads directly to exp(−E/T) when a small system is placed in a large heat bath at temperature T.

To make the phase transition happen in a tractable way, the energy function is deliberately simple: molecules prefer to be adjacent, with each neighboring pair lowering energy (implemented as −1 per adjacent pair, and 0 otherwise). At low temperature, the energy advantage of forming a dense droplet beats the entropy loss from restricting configurations. At high temperature, entropy dominates, so dispersed “gas” configurations win.

Efficient sampling requires more than writing down the distribution. Instead of enumerating exponentially many microstates, the simulation uses Markov chain Monte Carlo via Kawasaki Dynamics: repeatedly propose local moves that conserve molecule count (swap a molecule between two pixels) and accept them with probabilities determined by the Boltzmann weight ratio exp(−ΔE/T). Allowing molecule number to fluctuate leads to a grand-canonical version controlled by chemical potential, enabling larger, GPU-friendly simulations by proposing add/remove moves per pixel.

Beyond the phase diagram, the model shows physically familiar phenomena. Droplets and bubbles expand only after crossing the transition line far enough to overcome kinetic “kick” requirements; otherwise the system can linger in the metastable gas phase until a sufficiently large droplet forms. At the critical point, density patterns become self-similar fractals with scale invariance. The same underlying lattice physics maps onto the Ising model (liquid/gas ↔ spin up/down) and, with continuous spin directions, onto the XY model with vortices. Finally, the video emphasizes universality: many microscopic details can change without destroying the qualitative macroscopic behavior, which is why simplified models can still capture the essence of real phase transitions.

Cornell Notes

The liquid–vapor lattice model generates a realistic phase diagram by sampling microstates with the Boltzmann distribution, where configuration probability scales like exp(−E/T). Temperature controls the tradeoff between energy (favoring adjacent molecules and dense droplets) and entropy (favoring many disordered configurations). Chemical potential replaces pressure by controlling the preferred molecule density when the system can exchange particles with a reservoir. At high temperature the density varies smoothly (supercritical behavior), while at low temperature the model switches abruptly between gas-like and liquid-like macrostates along a phase transition line. Near the critical point, the system forms fractal, self-similar structures, and the same physics connects to the Ising and XY models via spin interpretations.

Why does the model use chemical potential instead of pressure, and how does it affect density?

Pressure is difficult to implement directly in a fixed-size pixel grid. The simulation instead uses chemical potential, which equalizes when particles can pass through a permeable wall between a small system and a large reservoir. In the grand-canonical setup, microstate probabilities become proportional to exp(−(E−C·n)/T), so a positive chemical potential favors microstates with larger molecule count n, while negative values favor fewer molecules. This produces smooth density changes in the supercritical region and sharp liquid–gas switching when temperature is low enough.

How does the Boltzmann distribution arise from equilibrium between two systems?

Start with two isolated subsystems that can exchange a small energy packet DE. In the combined isolated system, all compatible microstates are equally likely, so the direction of energy flow depends on which side has more combined microstates. Using entropy S = log|Ω|, equilibrium occurs when the entropy increase from moving energy either way is balanced. The condition becomes equality of derivatives ∂S/∂E between the two subsystems. That derivative is identified as 1/T, so when a small system exchanges energy with a large heat bath at temperature T, the probability of a microstate X is proportional to exp(−E(X)/T).

What specific energy rule makes droplets form at low temperature?

Each pixel can hold at most one molecule. The energy is defined as minus the number of adjacent molecule pairs: every neighboring pair contributes −1, and non-adjacent pairs contribute 0. Lower energy therefore corresponds to more adjacency, which favors clustering into a dense droplet. At low T, the energy benefit outweighs the entropy loss from restricting configurations, so droplet-like liquid macrostates dominate. At high T, entropy dominates and dispersed gas-like configurations win.

How does Kawasaki Dynamics sample the Boltzmann distribution without enumerating all microstates?

The algorithm repeatedly proposes a local move: choose two pixels and, if exactly one contains a molecule, propose swapping it. The energy change ΔE depends only on the local neighborhood (up to eight surrounding pixels), so it’s cheap to compute. The acceptance probability is set so that the ratio of probabilities for the two microstates matches exp(−ΔE/T). Because the proportionality constant in exp(−E/T) cancels when taking ratios, the move rule enforces the correct stationary distribution. Over many steps, the evolving chain produces samples close to the Boltzmann distribution.

Why can the system stay in the “wrong” phase near the transition line?

Metastability occurs because phase conversion requires a droplet to grow past a stability threshold. If the system is only barely on the liquid-favored side, naturally formed droplets may be too small to become self-sustaining; they shrink back into the gas. If a sufficiently large droplet is inserted artificially, it can grow and convert the whole system. This mirrors real situations like supercooled water, where freezing needs an external impulse to start a chain reaction.

What makes the critical point special in this model, and what other models does it connect to?

At the critical point, the density pattern becomes fractal and self-similar: zooming out preserves the structure, unlike away from criticality where the system becomes more homogeneous. The same lattice physics maps to the Ising model by treating molecules as spin up and empty space as spin down, with chemical potential acting like a magnetic field. With continuous spin directions (the XY model), the model supports vortices—topological defects where the “color” (spin angle) winds around special points.

Review Questions

  1. How does the competition between energy and entropy determine whether the model behaves like a gas or a liquid at a given temperature?
  2. Derive the logic that identifies temperature as the equalized quantity ∂S/∂E, and explain how that leads to exp(−E/T) probabilities.
  3. What conditions produce metastability in the simulation, and how does inserting a large droplet change the outcome?

Key Points

  1. 1

    Phase transitions in the lattice liquid–vapor model come from balancing energy minimization (adjacent molecules lower energy) against entropy maximization (many disordered configurations).

  2. 2

    Temperature governs the strength of the Boltzmann weighting exp(−E/T), shifting the system between gas-like and liquid-like macrostates.

  3. 3

    Chemical potential replaces pressure in fixed-size simulations by controlling particle density through grand-canonical exchange with a heat bath.

  4. 4

    The Boltzmann distribution is derived by coupling two isolated systems and requiring equilibrium when ∂S/∂E equalizes, identifying that derivative as 1/T.

  5. 5

    Efficient sampling uses Markov chain Monte Carlo: Kawasaki Dynamics proposes local swaps and accepts them with probabilities set by exp(−ΔE/T).

  6. 6

    The model exhibits metastability because droplets must exceed a critical size to grow; otherwise the system reverts to the original phase.

  7. 7

    At the critical point, the system becomes scale-invariant with fractal, self-similar structures and connects to Ising and XY models via spin interpretations.

Highlights

The model’s phase diagram in (T, chemical potential) reproduces a supercritical region plus a liquid–gas transition line, even though the microscopic rules are extremely simple.
Temperature is defined operationally through entropy: equilibrium between energy-exchanging systems equalizes ∂S/∂E, giving 1/T and leading to exp(−E/T) probabilities.
Metastability appears naturally: near the transition, small droplets form but shrink unless an external “kick” (like inserting a large droplet) enables runaway growth.
At the critical point, density patterns become fractal and self-similar under zoom, reflecting scale invariance.
The same lattice model can be reinterpreted as the Ising model (liquid/gas ↔ spin up/down) and extended to the XY model with vortices.

Topics

  • Phase Transitions
  • Boltzmann Distribution
  • Chemical Potential
  • Markov Chain Monte Carlo
  • Critical Phenomena

Mentioned

  • Vilas Winstein
  • MCMC