1. Home
  2. Explore
  3. Physics
  4. Phase Transitions Simulation

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Phase Transitions Simulation

Phase Transitions and the Boltzmann Distribution

This set of notes covers the core concepts behind phase transitions, the Boltzmann distribution, and the liquid‑vapor model—a simple discretized fluid simulation that exhibits phase transitions. The material explains why randomness is used to model large systems, how temperature and chemical potential control equilibrium behavior, and how the simulation algorithm samples from the Boltzmann distribution.

What Is a Phase Transition?

  • A phase transition is a discontinuity in a system’s equilibrium behavior when a control parameter (such as temperature or pressure) is varied.

  • Different phases of matter (solid, liquid, gas) correspond to different ways molecules interact. In ice, molecules form a rigid, long‑range structure; in water, interactions still allow ripples; in steam, there is almost no long‑range interaction.

  • Phase transitions are not chemical reactions—the molecules remain the same (e.g., H₂O in all three phases).

  • The equilibrium phase of a system depends on parameters like temperature and pressure. Crossing a line on a phase diagram triggers a transition, but this transition does not happen instantly in real time; it is the behavior after the system settles.

  • At very high temperatures and pressures, a supercritical fluid exists where liquid and gas vary continuously—no phase transition occurs when moving through this region.

The Liquid‑Vapor Model Simulation

  • The simulation shows blue pixels (molecules) and white pixels (empty space) on a grid, representing a discretized fluid.

  • Two parameters control the simulation: temperature (T) and chemical potential (μ) .

  • Pressure is tricky to use in a fixed‑size simulation, so chemical potential is used instead. It plays a role analogous to pressure: at high chemical potential, more molecules appear (like decreasing volume).

  • At high temperatures, molecule density varies smoothly with chemical potential (supercritical region). At low temperatures, crossing a threshold causes a phase transition where density jumps from low (gas) to high (liquid), skipping intermediate values.

  • During the transition, the picture shows only dense liquid regions and sparse gas regions, separated by well‑defined curves.

Why Randomness? The Need for Statistical Mechanics

  • A microstate contains all information about every particle’s position and velocity. For a large number of particles (e.g., 102310^{23}1023 in a teaspoon of water), tracking every microstate is impossible.

  • Instead of predicting exact positions, we approximate a deterministic microstate by a random microstate. Randomness stands in for our ignorance and is a proven practical tool.

  • The key insight: we only care about the macrostate (large‑scale behavior like density), not individual particle motions.

The Boltzmann Distribution

The Boltzmann distribution gives the probability of any microstate xxx in a system at fixed temperature TTT:

P(x)∝e−E(x)/TP(x) \propto e^{-E(x)/T}P(x)∝e−E(x)/T

where E(x)E(x)E(x) is the energy of the microstate. (Boltzmann’s constant kkk is set to 1 by choosing appropriate units.)

  • States with higher energy have lower probability, and vice versa.

  • To find the most likely energy level, we must also consider the number of microstates at that energy.

Entropy and Free Energy

Let Ω(E)\Omega(E)Ω(E) be the set of microstates with energy EEE. The entropy S(E)S(E)S(E) is:

S(E)=ln⁡∣Ω(E)∣S(E) = \ln |\Omega(E)|S(E)=ln∣Ω(E)∣

The probability of seeing a microstate in Ω(E)\Omega(E)Ω(E) is proportional to e−E/T⋅∣Ω(E)∣=e−E/T+S(E)e^{-E/T} \cdot |\Omega(E)| = e^{-E/T + S(E)}e−E/T⋅∣Ω(E)∣=e−E/T+S(E).

The free energy FFF is defined as:

F=E−TSF = E - T SF=E−TS
  • The most likely energy level minimizes FFF, because maximizing e−E/T+Se^{-E/T + S}e−E/T+S is equivalent to minimizing E−TSE - TSE−TS.

  • At low temperature: minimizing EEE dominates (nature favors low‑energy states).

  • At high temperature: maximizing SSS dominates (nature favors high‑entropy, disordered states).

  • The competition between energy and entropy, mediated by temperature, is the fundamental cause of phase transitions.

Deriving the Boltzmann Distribution

Step 1: Isolated System

  • In a completely isolated system with fixed energy EEE, all microstates are equally likely. Each microstate has probability 1/∣Ω(E)∣1/|\Omega(E)|1/∣Ω(E)∣.

Step 2: Two Systems in Contact

  • When two isolated systems at different energies are brought into thermal contact, energy can flow between them. The combined system is isolated.

  • The total energy Etotal=E1+E2E_{\text{total}} = E_1 + E_2Etotal​=E1​+E2​ is fixed.

  • A small energy packet dEdEdE flows in the direction that increases the combined entropy S12=S1(E1)+S2(E2)S_{12} = S_1(E_1) + S_2(E_2)S12​=S1​(E1​)+S2​(E2​).

  • The derivative of entropy with respect to energy gives:

dS12=dS1dE1dE−dS2dE2dEdS_{12} = \frac{dS_1}{dE_1} dE - \frac{dS_2}{dE_2} dEdS12​=dE1​dS1​​dE−dE2​dS2​​dE
  • Energy flows from system 2 to system 1 if dS1dE1>dS2dE2\frac{dS_1}{dE_1} > \frac{dS_2}{dE_2}dE1​dS1​​>dE2​dS2​​. At equilibrium, these derivatives equalize.

  • Temperature is defined as:

1T=dSdE\frac{1}{T} = \frac{dS}{dE}T1​=dEdS​
  • Thus, energy flows from hotter (small dS/dEdS/dEdS/dE) to colder (large dS/dEdS/dEdS/dE) systems. Adding energy increases the number of microstates more at low temperatures than at high temperatures.

Step 3: System in Contact with a Heat Bath

  • To fix a system at temperature TTT, place it in contact with a huge heat bath at that temperature. The bath’s temperature does not change appreciably.

  • The combined system (bath + small system) is isolated with total energy E0E_0E0​.

  • For a microstate xxx of the small system (energy E(x)E(x)E(x)), the number of compatible microstates of the bath is ∣Ωbath(E0−E(x))∣=eSbath(E0−E(x))|\Omega_{\text{bath}}(E_0 - E(x))| = e^{S_{\text{bath}}(E_0 - E(x))}∣Ωbath​(E0​−E(x))∣=eSbath​(E0​−E(x)).

  • Because the bath is huge, its derivative dSbath/dEdS_{\text{bath}}/dEdSbath​/dE is constant =1/T= 1/T=1/T, so:

Sbath(E0−E)≈Sbath(E0)−ETS_{\text{bath}}(E_0 - E) \approx S_{\text{bath}}(E_0) - \frac{E}{T}Sbath​(E0​−E)≈Sbath​(E0​)−TE​
  • Then:

P(x)∝eSbath(E0−E(x))=eSbath(E0)e−E(x)/T∝e−E(x)/TP(x) \propto e^{S_{\text{bath}}(E_0 - E(x))} = e^{S_{\text{bath}}(E_0)} e^{-E(x)/T} \propto e^{-E(x)/T}P(x)∝eSbath​(E0​−E(x))=eSbath​(E0​)e−E(x)/T∝e−E(x)/T

This completes the derivation.

Application to the Liquid‑Vapor Model

Energy Function

  • Each pixel can hold at most one molecule (no overlapping).

  • Molecules gain energy −1 for each pair of adjacent (neighboring) molecules. This models the attractive “sweet spot” of intermolecular forces.

  • The total energy of a microstate is:

E=−(number of adjacent molecule pairs)E = - (\text{number of adjacent molecule pairs})E=−(number of adjacent molecule pairs)
  • Lower energy (more negative) corresponds to more clumped molecules.

Entropy‑Energy Competition

  • Gas phase (high temperature): many microstates exist with molecules spread out → high entropy, high energy. The system favors high entropy because TTT is large, so the free energy F=E−TSF = E - TSF=E−TS is minimized by large SSS.

  • Liquid phase (low temperature): few microstates exist with a single droplet → low entropy, low energy. The energy term dominates FFF, so the system prefers low energy.

  • No macrostate can simultaneously have low energy and high entropy; temperature determines which wins.

Sampling the Boltzmann Distribution: Kawasaki Dynamics

  • Directly sampling from the distribution (e.g., by enumerating all microstates) is impossible because the number of microstates grows exponentially.

  • Instead, the simulation performs a random walk through the space of microstates, making small local changes.

  • Algorithm (Kawasaki Dynamics):

    1. Choose two random pixels.

    2. If one contains a molecule and the other is empty, consider swapping the molecule to the empty pixel.

    3. Compute the energy difference ΔE=E(x′)−E(x)\Delta E = E(x') - E(x)ΔE=E(x′)−E(x) between the current microstate xxx and the swapped microstate x′x'x′.

    4. The ratio of Boltzmann probabilities is:

      P(x′)P(x)=e−ΔE/T\frac{P(x')}{P(x)} = e^{-\Delta E / T}P(x)P(x′)​=e−ΔE/T
    5. Given only these two choices, the probability of swapping (i.e., moving to x′x'x′) is:

      Pswap=e−ΔE/T1+e−ΔE/TP_{\text{swap}} = \frac{e^{-\Delta E / T}}{1 + e^{-\Delta E / T}}Pswap​=1+e−ΔE/Te−ΔE/T​
    6. Repeat many times.

  • The energy difference depends only on the at‑most 8 neighbors of the two pixels, so it can be computed quickly.

  • This algorithm is a Markov chain Monte Carlo method. It converges to the Boltzmann distribution after enough steps (like shuffling cards).

  • Allowing swaps between any two pixels (teleportation) speeds up convergence compared to only neighboring swaps.

Allowing Molecule Number to Change: Chemical Potential

  • Real phase diagrams have two control parameters (e.g., temperature and pressure). In the simulation, pressure is replaced by chemical potential (μ) , which controls molecule count.

  • Chemical potential is defined as:

μ=−T∂S∂N\mu = - T \frac{\partial S}{\partial N}μ=−T∂N∂S​

where NNN is the number of molecules. It equalizes when two systems can exchange particles through a permeable wall.

  • To fix both TTT and μ\muμ, put the small system in contact with a huge reservoir at fixed TTT and μ\muμ that can exchange energy and particles.

  • The probability of a microstate becomes:

P(x)∝e−(E(x)−μN(x))/TP(x) \propto e^{-(E(x) - \mu N(x))/T}P(x)∝e−(E(x)−μN(x))/T
  • Positive μ\muμ favors more molecules; negative μ\muμ favors fewer.

  • This allows a simpler algorithm: pick one pixel and randomly add or remove a molecule, with acceptance probability based on the energy and chemical potential changes.

Phase Diagram of the Model

  • The phase diagram shows density (fraction of blue pixels) as a function of TTT and μ\muμ.

  • High temperature: density varies smoothly with μ\muμ → supercritical fluid region (no phase transition).

  • High chemical potential (μ > −2): density changes smoothly with TTT → liquid phase.

  • Low chemical potential (μ < −2): density changes smoothly with TTT → gas phase.

  • At low temperatures, crossing a line between liquid and gas causes a discontinuous jump in density—the phase transition line.

  • The shape of the phase diagram qualitatively matches that of real H₂O in the liquid‑gas region.

Universality

  • The model is extremely simplified (square lattice, no kinetic energy, simple interaction), yet it reproduces the essential features of a real phase diagram.

  • This illustrates universality: many microscopic details are unimportant; only a few fundamental rules determine macroscopic behavior. This is a key principle of statistical mechanics.

Interesting Behaviors

Droplets and Bubbles

  • During the phase transition, the system forms droplets (liquid in gas) or bubbles (gas in liquid) because density cannot change smoothly.

  • At very low temperatures, droplets become square due to the lattice. At higher (but still subcritical) temperatures, droplets are rounder.

  • The shape of droplets as a function of temperature can be described mathematically (see Wulff shape).

Metastability

  • When crossing the phase transition line by a small amount, the system often remains in the “wrong” phase (e.g., gas instead of liquid) for a long time.

  • This is metastability. The system needs a sufficiently large droplet to trigger the phase change; otherwise, small droplets shrink.

  • Real‑world example: supercooled water below freezing that doesn’t turn to ice until disturbed.

Critical Point

  • At the critical point (the end of the phase transition line), the system exhibits scale invariance: it looks similar at all magnifications, with fractal‑like structures.

  • At the critical temperature, the density is exactly 1/2 (for this model) if the lattice is symmetric.

  • This behavior sparks ideas like the critical brain hypothesis (brains may operate near criticality for optimal information processing).

Connections to Other Models

Ising Model (Magnet)

  • Replace molecules with “up” spins and empty spaces with “down” spins.

  • Energy favors aligned neighbors; chemical potential becomes an external magnetic field.

  • The liquid‑vapor model is exactly the same as the Ising model under this identification.

  • With Dobrushin boundary conditions (left side up, right side down), interesting domain walls appear, especially at criticality.

XY Model (Continuous Spin)

  • If spins can point in any direction (parameterized by a color wheel), the phase transition disappears in two dimensions.

  • Instead, vortices form—points where all colors meet, with positive and negative orientations.

  • Vortices behave like charged particles: opposite types attract, same types repel. This is the XY model, which exhibits a Kosterlitz‑Thouless transition.

Why Exact Solutions Are Limited

  • In two dimensions, the critical temperature of the Ising/liquid‑vapor model is known exactly:

Tc=12ln⁡(1+2)T_c = \frac{1}{2 \ln(1+\sqrt{2})}Tc​=2ln(1+2​)1​
  • In three dimensions, no exact formula exists—only numerical approximations.

  • A fully realistic model of water (3D, moving molecules, electromagnetic interactions) is mathematically intractable.

  • The lesson: simplify models while retaining essential features to gain conceptual understanding. Rigorous analysis of simplified models can reveal the fundamental mechanisms behind phase transitions.


These notes form the foundation for understanding phase transitions, the Boltzmann distribution, and how simple computational models can capture real‑world behavior. The second part of this series simplifies the model further to allow complete mathematical analysis.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent