Real 3D molecular gas: condensation, the critical point, and the van
der Waals isotherm
Physics & equations
Van der Waals equation: (P +
a n²/V²)(V − nb) = nRT
where a accounts for intermolecular attractive forces and
b for finite molecular volume. For an ideal gas, a = b = 0.
Critical point (inflection of isotherm): Tc
= 8a/(27Rb), Pc = a/(27b²), Vc = 3b
Below Tc the van der Waals isotherm develops a
non-physical loop. In a real fluid this loop is replaced by a flat
tie-line (the Maxwell equal-area construction) at the saturation
pressure — and the system separates into coexisting liquid and gas.
In the 3D simulation this is exactly the droplet you see condense.
The reduced equation of state with
Pr=P/Pc, Vr=V/Vc,
Tr=T/Tc: (Pr +
3/Vr²)(3Vr−1) = 8Tr — universal for
all vdW gases.
🌡️ Van der Waals Gas
About this simulation
This is a real 3D molecular simulation running in your browser with Three.js and WebGL. A few hundred atoms move inside a cubic box, attracting and repelling each other through a Lennard-Jones-like pair potential — the molecular origin of the van der Waals equation of state. Drag to orbit the camera and watch a real gas condense into a liquid droplet and re-evaporate.
From molecules to the van der Waals equation
The short-range repulsion of the potential is the excluded volume b (atoms cannot overlap), and the longer-range attraction is the constant a. Together they make a real gas differ from an ideal gas: (P + a n²/V²)(V − nb) = nRT.
Critical point & condensation
The critical temperature is T_c = 8a/(27Rb). Above T_c no amount of compression liquefies the gas — it stays supercritical.
Below T_c, lowering T or raising density lets attraction win: atoms cluster into a dense liquid droplet surrounded by vapour (coexistence). Raise T and the droplet evaporates back to gas.
The van der Waals isotherm develops a non-physical loop below T_c; the Maxwell construction flattens it to the saturation pressure — the coexistence plateau plotted in the side panel.
How it works
Forces are the negative gradient of the pair potential, integrated with the velocity-Verlet algorithm.
A velocity-rescaling thermostat sets the temperature; T = 2·KE/(3N) by equipartition.
The virial pressure is P = (N·T + Σ r·F / 3) / V, and the current state is plotted on the van der Waals isotherm.
Controls
Temperature: in units of T_c. Below 1 the gas can condense.
Density: number of atoms in the fixed box.
Attraction a and excluded volume b: tune the well depth and atom size — they reshape T_c and the isotherm live.