This is the true 2-dimensional Lennard-Jones fluid — N = 100 disks confined to a flat periodic box of side L (minimum-image convention), where ρ* = N/L², integrated with velocity-Verlet in reduced (σ = ε = m = 1) units. It is not the 3D box flattened onto a plane: every statistical-mechanics formula below is re-derived for 2 degrees of freedom per particle, which changes the numbers that come out.
U(r) = 4ε[(σ/r)^12 − (σ/r)^6], r < r_c = 2.5σ
F(r) = 24ε[2(σ/r)^12 − (σ/r)^6] / r (along r̂, in-plane)
T* = (1/N) Σ ½mv² (2 dof/particle ⇒ no factor of 2/3)
P* = ρT* + (1/2A) Σ_(i<j) r_ij·F_ij (2D virial uses 1/2, not 1/3)
A Berendsen thermostat (τ = 0.15) gently rescales velocities toward T* each step. The radial distribution function is also re-derived for 2D — the reference shell is a ring of circumference 2πr, not a spherical shell of area 4πr²:
g(r) = ⟨n(r → r+dr)⟩ / (2π r dr · ρ)
It is built as a running histogram of every pairwise separation (minimum image) across recent frames, normalized by the ideal-gas ring count. The coordination number integrates 2πrρg(r) out to the first minimum (~1.5σ). This is the real physical difference worth watching: a 2D solid packs into a triangular lattice where each disk has exactly 6 nearest neighbors — not the 12 of a 3D FCC/HCP crystal — so the solid-state coordination number here saturates near 6, not near 12. 2D melting is also qualitatively different from 3D (the KTHNY two-stage transition through a hexatic phase with only quasi-long-range positional order), which is why the g(r) peaks here decay differently with density than in the 3D version of this simulator even at matched T* and ρ*.
- T* slider — thermostat setpoint; higher T* melts structure toward a gas-like g(r).
- ρ* slider — rescales the box (and disk positions with it) to change 2D packing density.
- Bond toggle — draws a line between any pair inside the first coordination shell.
- Presets — jump to representative gas / liquid / hexagonal-solid-like (T*, ρ*) states.