Simulating Phase Change | Guest video by Vilas Winstein

3Blue1BrownAbout 7 min readAug 29, 2025Watch original
THE SUMMARYAI-generated

Key Concepts:

  • Phase Transitions: Changes in the state of matter (e.g., solid, liquid, gas) due to changes in parameters like temperature and pressure.
  • Liquid Vapor Model: A discretized fluid model used to simulate phase transitions.
  • Boltzmann Distribution: A probability distribution that describes the probability of a system being in a particular state as a function of the state's energy and the system's temperature.
  • Microstate: A specific configuration of all the particles in a system, including their positions and velocities.
  • Macrostate: The large-scale, observable properties of a system, such as temperature, pressure, and density.
  • Entropy: A measure of the number of possible microstates corresponding to a given macrostate.
  • Free Energy: A thermodynamic potential that combines energy and entropy, minimized at equilibrium.
  • Chemical Potential: A measure of the change in free energy when particles are added to a system.
  • Kawasaki Dynamics: A Monte Carlo algorithm used to simulate the liquid-vapor model by swapping particles between neighboring sites.
  • Metastability: A state where a system remains in a non-equilibrium state for an extended period due to a lack of sufficient perturbation.
  • Critical Point: The point on a phase diagram where the phase transition line ends, and the properties of the two phases become indistinguishable.
  • Ising Model: A mathematical model of ferromagnetism, which is mathematically equivalent to the liquid-vapor model.
  • XY Model: A model similar to the Ising model, but where the magnetic elements can point in any direction in a two-dimensional plane.
  • Universality: The principle that the macroscopic behavior of a system is often independent of the microscopic details.

1. Introduction to Phase Transitions and the Liquid Vapor Model

  • The video focuses on phase transitions, specifically using a discretized fluid model called the liquid vapor model.
  • Phase transitions are not chemical reactions; they involve changes in how molecules interact (e.g., ice, water, steam are all H2O).
  • Ice has long-range interactions due to its rigid structure, water has some (ripples), and steam has almost none.
  • Phase diagrams show the phases of matter at different temperatures and pressures; crossing lines indicates a phase transition.
  • Supercritical fluids exist at high temperatures and pressures, allowing a continuous transition between liquid and gas.
  • The liquid vapor model simulates a fluid with blue pixels representing molecules and white pixels representing empty space.
  • The simulation is controlled by two parameters: temperature (T) and chemical potential (μ).
  • Chemical potential is used as a stand-in for pressure because pressure is difficult to implement directly in the simulation.
  • Temperature controls the importance of energy, which in this simulation corresponds to how clumped up the molecules are.
  • At high temperatures, the density of molecules varies smoothly with chemical potential, resembling a supercritical fluid.
  • At low temperatures, a phase transition occurs, with the density abruptly changing from gas-like to liquid-like.

2. The Boltzmann Distribution and Its Implications

  • The Boltzmann distribution is a key formula in statistical physics that gives the probability of a microstate (x) as proportional to exp(-E(x)/T), where E(x) is the energy of the microstate and T is the temperature.
  • The video addresses why randomness is used, clarifying it's not quantum randomness but a proxy for uncertainty about the true microstate.
  • It's impossible to track every particle in a system (e.g., 10^23 molecules in a teaspoon of water), so statistical approximations are necessary.
  • The Boltzmann distribution explains how phase transitions arise by balancing energy minimization and entropy maximization.
  • States with higher energy have lower probability, but the number of microstates at a given energy level (Ω(E)) also matters.
  • The probability of observing a microstate with energy E is proportional to exp(-E/T) * |Ω(E)|.
  • Entropy (S) is defined as the logarithm of the number of microstates at a given energy level: S = ln(|Ω(E)|).
  • The most likely energy level is the one that minimizes the free energy (F = E - TS).
  • At low temperatures, minimizing energy is dominant, leading to ordered phases. At high temperatures, maximizing entropy is dominant, leading to disordered phases.
  • The simulation models intermolecular forces with a "sweet spot": molecules prefer to be close but not too close.
  • Each pair of adjacent molecules has an energy of -1 (represented by a green diamond).
  • At high temperatures, molecules behave like a gas (high energy, high entropy). At low temperatures, they form a droplet (low energy, low entropy).
  • Energy and entropy are in competition, and temperature mediates this competition.

3. Derivation of the Boltzmann Distribution

  • The derivation starts with an isolated system where all microstates have the same energy and are equally likely.
  • When two isolated systems are brought into contact, their temperatures equalize.
  • Temperature is defined as the quantity that equalizes when systems exchange energy.
  • The number of combined microstates with energies E1 and E2 is |Ω(E1, E2)| = |Ω(E1)| * |Ω(E2)|.
  • The combined entropy is S12 = S1 + S2.
  • Energy flows from system 2 to system 1 if dS12 > 0, which leads to the condition dS1/dE1 > dS2/dE2.
  • Equilibrium is reached when dS1/dE1 = dS2/dE2.
  • Therefore, 1/T = dS/dE, meaning temperature is the inverse of the rate of change of entropy with respect to energy.
  • To derive the Boltzmann distribution for a system at fixed temperature, it's placed in contact with a heat bath.
  • The probability of a microstate X in the small system is proportional to the number of microstates in the heat bath compatible with X.
  • This leads to P(X) ∝ exp(-E(X)/T), which is the Boltzmann distribution.

4. Simulation Implementation and Kawasaki Dynamics

  • Sampling directly from the Boltzmann distribution is computationally expensive due to the exponential number of microstates.
  • The simulation uses Kawasaki dynamics, a Markov chain Monte Carlo algorithm, to generate samples.
  • At each time step, two pixels are chosen, and if one has a molecule and the other is empty, they are potentially swapped.
  • The probability of swapping is determined by the ratio of the Boltzmann probabilities of the two microstates: P(X')/P(X) = exp(-(E(X') - E(X))/T).
  • The probability of swapping is then P(swap) = exp(-ΔE/T) / (1 + exp(-ΔE/T)), where ΔE is the energy difference.
  • The energy difference only depends on the neighboring pixels, making the calculation efficient.
  • The algorithm can be thought of as a random walk through the space of possible microstates.

5. Introducing Chemical Potential and Exploring the Phase Diagram

  • To create a two-dimensional phase diagram, chemical potential (μ) is introduced as a second parameter.
  • Chemical potential is defined as the quantity that equalizes when systems exchange particles.
  • μ = -T * (dS/dN), where N is the number of molecules.
  • The probability of a microstate is now proportional to exp(-(E(X) - μN(X))/T), where N(X) is the number of molecules in microstate X.
  • A positive chemical potential favors microstates with more molecules.
  • The simulation is modified to allow adding or removing molecules at each pixel.
  • The phase diagram is explored as a function of T and μ, showing gas, liquid, and supercritical fluid phases.
  • At high temperatures, the density changes smoothly with chemical potential (supercritical fluid).
  • At low temperatures, a phase transition line separates the gas and liquid phases.

6. Advanced Phenomena and Connections to Other Models

  • Droplets or bubbles form during the phase transition because the density cannot change smoothly.
  • The shape of the droplets depends on the temperature and the lattice structure.
  • Metastability occurs when the system remains in the "wrong" phase due to a lack of sufficient perturbation.
  • At the critical point, the system exhibits fractal-like structures and self-similarity.
  • The Ising model is mathematically equivalent to the liquid-vapor model, with "up" spins representing molecules and "down" spins representing empty spaces.
  • The XY model is similar to the Ising model but allows the magnetic elements to point in any direction, leading to the formation of vortices.
  • The video concludes by noting that while simplified models can capture essential features of phase transitions, more complex models are needed for quantitative accuracy.

7. Conclusion

  • The video provides a comprehensive overview of phase transitions, the liquid vapor model, and the Boltzmann distribution.
  • It explains how phase transitions arise from the competition between energy minimization and entropy maximization, mediated by temperature.
  • The video also demonstrates how to implement a simulation of the liquid vapor model using Kawasaki dynamics.
  • Finally, it connects the liquid vapor model to other important models in statistical physics, such as the Ising model and the XY model.
  • The principle of universality suggests that the macroscopic behavior of a system is often independent of the microscopic details.
  • The second video will further simplify the liquid vapor model to the point where it can be completely understood using basic mathematics.

AI summaries can miss context or contain errors. Check important details against the original video.

Go a little deeper.

Have a question about this video? Load its transcript to open the video chat.