Skip to content
SHD Sim
Menu

Validation/Molecular dynamics

A box of argon

Statistical mechanics gives the answer exactly, but only on average — so the scatter has to be predicted as well as the mean, and this page states both.

VerificationTemperature within 0.05σ of 300 K; momentum conserved to every digit written

Why this case

Molecular dynamics is the one solver family in the product with nothing in it to compare against an experiment. There is no wall, no body, no inlet and no force — the ideal model for the family is a cube of fluid at a stated density and temperature, wrapped onto itself in all three directions.

That is not a weakness. A box like that obeys four statements that are exact rather than measured, and none of them has a fitted constant in it.

  • Equipartition. At equilibrium the mean kinetic energy of a monatomic molecule is (3/2) kBT in three dimensions, so the temperature computed from the velocities the solver carries must be the temperature the case was set to.
  • Maxwell–Boltzmann. The equilibrium speed distribution is known in closed form, and one ratio of its moments is dimensionless — no temperature and no mass in it at all.
  • Momentum. Gravity is zero and every one of the six patches is cyclic. Nothing outside the box pushes on it, so the total momentum cannot change — not approximately: it is a sum the integrator adds and subtracts the same numbers from.
  • Energy. The solver integrates Newton’s equations with no thermostat, which is an NVE ensemble. Kinetic plus potential energy is a constant of the motion, and how nearly a leapfrog run keeps it is the whole quality of the time step.

The dimensionless moment ratio

    <v> / sqrt(<v^2>)  =  sqrt(8 / (3 pi))  =  0.9213177

A box whose velocities are not Maxwellian misses that ratio whatever its temperature is, and a box at the wrong temperature still hits it — so the two checks are independent.

PhysicsMolecular dynamics, periodic in all three directions, no external force
Box4.924983316 nm on a side — a volume of 1.1945774 × 10⁻²⁵ m³
FluidArgon at 1220 kg/m³; molecule mass 6.63352033 × 10⁻²⁶ kg
Molecules2197, checked against ρV/m rather than trusted — expected 2197.0000005
Time step10⁻¹⁴ s
RunEquilibrated for 5000 steps to 5 × 10⁻¹¹ s, then 2000 NVE steps over 1.999 × 10⁻¹¹ s
ReferenceEquipartition and the Maxwell–Boltzmann distribution
AgreementTemperature 300.279 K against a requested 300, which is 0.05 of one standard deviation

A statistical result needs its scatter

Every number below is one sample of 2197 molecules, and 2197 is not a large number. An agreement quoted without its scatter would mean nothing: 306 K against a requested 300 is not a 2 % error, it is 1.2 standard deviations, which is what a correct sample of that size looks like.

The scatter a 2197-molecule sample must have, predicted before any measurement
QuantityExact valuePredicted standard deviationAs a fraction
Temperature300 K5.225894 K1.74 %
⟨v⟩ / √⟨v²⟩0.92131770.002101500.23 %
Both are derived rather than guessed: the temperature scatter from the variance of a chi-squared with 3N degrees of freedom, the ratio scatter by the delta method — and the ratio scatter is confirmed here by Monte Carlo against the distribution itself, which gives 0.00202139.

Both scatters were then confirmed against the product rather than only against the algebra. The initialiser was run 30 times on the staged box, a second apart because it seeds itself from a clock with one-second resolution and back-to-back calls otherwise repeat the same draw.

A 30-sample control of the predicted scatter, from the product's own initialiser
QuantityMean of 30 samplesStandard deviation of 30 samplesExact valuePredicted standard deviation
Temperature300.410 K5.309 K300 K5.226 K
⟨v⟩ / √⟨v²⟩0.9213340.0019370.92131770.002102
Thirty samples pin a standard deviation to about 13 % of itself, so both agree. That is the control for everything below: the reference, the predicted scatter and the product's own initialiser all say the same thing before any solver has taken a step.

Result

Equipartition and Maxwell–Boltzmann, against the exact values and their scatter
QuantityMeasuredExactDifference in standard deviations
Temperature, mean over the NVE run300.279355 K300 K+0.05σ
Temperature, first half of the run300.167322 K300 K+0.03σ
Temperature, second half of the run300.391387 K300 K+0.08σ
Temperature, at the last step298.011416 K300 K−0.38σ
⟨v⟩ / √⟨v²⟩ after the run0.922670670.9213177+0.64σ
Measured values and exact values are the fixture's own; the last column is the difference between them divided by the predicted standard deviation in the table above.
Temperature at four stages and the speed-distribution moment ratio, both against their exact values with one- and two-sigma bands
Left: the kinetic temperature as initialised on the lattice, after equilibration, and over the two halves and the whole of the NVE run, against the requested 300 K. Right: the moment ratio ⟨v⟩/√⟨v²⟩ of the speed distribution, as initialised and after the run, against the Maxwell–Boltzmann value √(8/3π). The shaded bands are the one- and two-standard-deviation scatter a 2197-molecule sample must have, from the table above. Every plotted value is from the fixture.

The two conservation laws are checked separately, because they are exact rather than statistical and there is no scatter to allow for.

Momentum and energy over 2000 NVE steps
QuantityValueWhat it should be
Total momentum at the start7.7489180 × 10⁻²⁵Whatever the draw gave
Drift in total momentum0.0Exactly zero
Drift in total energy7.788279 × 10⁻⁶Zero, in an NVE ensemble
End-to-end change in total energy2.600263 × 10⁻⁵Zero
RMS fluctuation in total energy5.377835 × 10⁻⁵Zero
Full spread in total energy3.2000483 × 10⁻⁴Zero
The energy figures are fractions of the kinetic energy, whose mean over the run is 6.2187059 × 10⁻²¹ J per molecule. Momentum is conserved to every digit the run prints — it is a sum the integrator adds and subtracts the same numbers from.

Why the run is in two halves

The initialiser lays the molecules on a lattice at the spacing the density asks for, which for this case puts every molecule within a hair of the bottom of its potential well. That is not an equilibrium configuration, and the solver reference says so in as many words: the stored potential energy comes out over the first few picoseconds and the temperature goes with it.

So the healthy run equilibrates first — with the solver that rescales velocities towards the target temperature at each write — and only then runs the plain NVE solver, whose momentum and energy are the ones worth checking, because a thermostat conserves neither.

Temperature at each stage
StageTemperature (K)From 300 K
On the lattice, as initialised308.663947+1.66σ
Start of equilibration307.859215+1.50σ
End of equilibration, 5000 steps305.945835+1.14σ
Mean over the NVE run300.279355+0.05σ
Standard deviations are the fixture's measured temperatures against the predicted 5.225894 K.

The failing fixture is the product's own default

Choosing this solver in the product runs the initialiser and then the solver. That is the whole pipeline; there is no equilibration in it. Run that way, the box settles at 229.3 K when the case asked for 300 — the lattice is laid down at 300 K, the kinetic temperature is through 250 K within fifty steps, and it settles over the next two thousand at a value 13.5 standard deviations from where the case was set.

And it reports that without complaint. Every step succeeds, the momentum is conserved to every figure printed and the energy to 2.5 × 10⁻⁵ of the kinetic energy. Only the temperature says anything is wrong. That is documented rather than broken — the solver reference already tells the reader to equilibrate first — and it makes a good failing fixture precisely because it is real, reachable and quiet.

What this page does not establish

  • The speed distribution is compared through one moment ratio, not point by point. ⟨v⟩/√⟨v²⟩ is dimensionless and independent of the temperature check, which is what makes it worth reporting — but a distribution can in principle miss its shape while hitting that ratio. No histogram comparison is recorded here.
  • Everything is at one time step and one box. There is no time-step refinement study on this page. A separate fixture raises the step threefold, and it is not reported here.
  • There is no body in the domain. The molecular methods in the product run in a box and only in a box; a wall built of tethered molecules is not something this build does. Nothing on this page says anything about molecular flow past a surface.
  • Nothing here is a validation against a measurement. Statistical mechanics gives these answers exactly, which is the whole reason this case exists; it is not a comparison against an experiment on argon.

Repeat this yourself

Every case here is set up from the worked examples in the product, with no hand-editing of solver files — so you can run it, and get the same numbers. The free tier runs real cases up to 250,000 cells of fluids, or 100,000 nodes of solid, with no account needed to download and no time limit.

All validation cases · Written by the team building SHD Sim.