Boyle’s law in a molecular box

Move the piston of a genuinely running 2D molecular-dynamics box, measure the pressure, and plot the P–1/V line yourself.

Difficulty ●○○ ≈ 15 min

Aim Verify that P∝1/VP \propto 1/V at constant temperature, and find when intermolecular attraction bends the data away from the line.
Real 2D molecular dynamics · pressure measured from wall hits

Gas molecular-dynamics box

Pressure (measured)…
T0 K
PA / NkT…
Equilibrating…

Recorded measurements

00.0010.0020.0031 / area00.51Pressure (reduced units)
  • Ideal gas PA = NkT
  • Recorded measurements
This is a genuine 2D molecular-dynamics calculation: particles interact through the Lennard-Jones potential (the “ideal” setting keeps only its repulsive core) and are integrated with velocity Verlet; pressure is the time-averaged momentum delivered to the walls, not a formula. Reduced units map onto argon (σ = 0.34 nm, ε/k = 120 K). A 2D gas obeys PA = NkT and its speed distribution has the 2D form (in 3D there is an extra v²). Runs start from a fixed seed, so they are reproducible.

Procedure

  1. Keep “intermolecular attraction” off. Set the volume to its maximum, wait for the readout to settle, then press “Record point”.
  2. Reduce the volume step by step, waiting for equilibrium before each recording; take at least six points.
  3. Check whether the points fall on the ideal line PA=NkTPA = NkT and note the PA/NkTPA/NkT readout.
  4. Clear the data, switch on attraction, and repeat, especially at small volumes.

What to notice

  • The pressure readout fluctuates: the number of wall hits varies from window to window. More particles and longer averaging steady it.
  • Without attraction, PA/NkTPA/NkT is about 1 at low density and rises slightly above 1 at small volumes — the particles take up room.
  • With attraction on, the pressure falls below the ideal value and PA/NkTPA/NkT drops below 1.

In a real lab

  • Real Boyle experiments use a sealed syringe with a pressure sensor, or a J-tube with mercury; move the piston slowly so the gas stays at room temperature.
  • Rapid compression heats the gas (close to adiabatic), giving pressures that are too high.
  • The simulation is two-dimensional, so “volume” is an area; the law is the same in three dimensions.

All experiments