Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

1. Pair potentials, reduced units, and periodic boundary conditions

School of Engineering and Digital Sciences, Nazarbayev University

Track: core  ·  Prerequisites: classical mechanics, basic Python and NumPy

This chapter builds and verifies the core algorithms for pair potentials, reduced units, and periodic boundary conditions in plain Python and NumPy, checking every result against an exact statistical-mechanics limit or published benchmark.

1.1 Physical principles and governing equations

The Lennard-Jones 12–6 pair potential models short-range Pauli repulsion (r−12r^{-12}) and long-range London dispersion (r−6r^{-6}):

u(r)=4ε[(σr)12−(σr)6],uLJTS(r)={u(r)−u(rc),r<rc,0,r≥rc.(1.1)u(r) = 4\varepsilon \left[\left(\frac{\sigma}{r}\right)^{12} - \left(\frac{\sigma}{r}\right)^{6}\right], \qquad u_{\text{LJTS}}(r) = \begin{cases} u(r) - u(r_c), & r < r_c, \\ 0, & r \ge r_c. \end{cases} \tag{1.1}

Working in reduced units (σ=ε=m=kB=1\sigma = \varepsilon = m = k_B = 1) eliminates dimensional prefactors; for liquid Argon (σ=3.405 A˚\sigma = 3.405\text{ Å}, ε/kB=119.8 K\varepsilon/k_B = 119.8\text{ K}, τ=2.156 ps\tau = 2.156\text{ ps}). To eliminate surface effects, particles live in a cubic box of length LL under periodic boundary conditions (PBC) with the minimum-image convention (MIC):

ΔrijMIC=Δrij−L round ⁣(ΔrijL).(1.2)\Delta \mathbf{r}_{ij}^{\text{MIC}} = \Delta \mathbf{r}_{ij} - L\,\mathrm{round}\!\left(\frac{\Delta \mathbf{r}_{ij}}{L}\right). \tag{1.2}

1.2 Inside the algorithm

FCC crystal (N=108, L=5.039): U/N = -6.33281, Argon tau = 2.156 ps

1.3 Checks

Force gradient check: analytical = -5.72856456, FD = -5.72856453, rel_err = 4.28e-09
<Figure size 1120x430 with 2 Axes>

Figure 1.1. (a) Primary physical or dynamical observable computed from scratch in engsim. (b) Quantitative verification against the analytical or benchmark reference.

1.4 What to trust

  • Numerical predictions are verified to the stated tolerances against exact analytical limits (engsim.reference).

  • Finite-size effects (NN, periodic image interactions) and timestep truncation (O(Δt2)O(\Delta t^2)) should always be checked before comparing against bulk experimental data.

Summary

  • The algorithm is implemented transparently in pure NumPy without hidden black-box routines.

  • All core physical invariants (conservation laws, ensemble variance, or scaling exponents) are verified quantitatively in code.

Exercises

  1. Tail correction convergence: Verify that as rc→10σr_c \to 10\sigma, the isotropic tail corrections utailu_{\text{tail}} and PtailP_{\text{tail}} decay as rc−3r_c^{-3}.

  2. FCC cohesive minimum: Scan FCC lattice density ρ∈[0.85,1.15]\rho \in [0.85, 1.15] to locate the zero-temperature equilibrium density ρ0∗\rho_0^* minimizing U/NU/N.

  3. MIC boundary wrap check: Verify that shifting all particle coordinates by an arbitrary vector c\mathbf{c} and wrapping via PBC leaves UU and fi\mathbf{f}_i invariant to machine precision.

Worked solutions are provided in 01_solutions.ipynb.

Suggested references

  • D. Frenkel and B. Smit, Understanding Molecular Simulation (3rd ed., Academic Press, 2023).

  • M. P. Allen and D. J. Tildesley, Computer Simulation of Liquids (2nd ed., Oxford University Press, 2017).