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.

16. Capstone: validating your Python engine against LAMMPS and Yeh–Hummer 1/L scaling

School of Engineering and Digital Sciences, Nazarbayev University

Track: core  ·  Prerequisites: All Chapters 1–15

This chapter builds and verifies the core algorithms for capstone: validating your python engine against lammps and yeh–hummer 1/l scaling in plain Python and NumPy, checking every result against an exact statistical-mechanics limit or published benchmark.

16.1 Physical principles and governing equations

Transitioning from an educational Python engine to production LAMMPS (pair_style lj/cut 2.5 + pair_modify shift yes) requires matching every numerical convention: reduced units (units lj), cutoff shifting, thermostat relaxation time τT\tau_T, and finite-size scaling. For self-diffusion in a periodic cubic box of length LL, Yeh & Hummer (2004) proved that periodic hydrodynamic images depress D(L)D(L) linearly in 1/L1/L:

D∞=D(L)+ξ kBT6πηL,ξ=2.837297.(16.1)D_\infty = D(L) + \frac{\xi\, k_B T}{6\pi \eta L}, \qquad \xi = 2.837297. \tag{16.1}

16.2 Inside the algorithm

# LAMMPS LJTS benchmark input script matching engsim conventions | pair_coeff      1 1 1.0 1.0 2.5

16.3 Checks

Yeh-Hummer 1/L extrapolation: D_inf_fit = 0.085000 (exact 0.085000), slope = -0.070011
<Figure size 1120x430 with 2 Axes>

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

16.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. LAMMPS deck verification: Verify that generate_lammps_ljts_deck() includes pair_modify shift yes and temp/csvr matching Chapter 5.

  2. Box size for <5%<5\% diffusion error: Solve the Yeh–Hummer equation for the minimum particle count Nmin⁡N_{\min} required so (D∞−D(L))/D∞<0.05(D_\infty - D(L))/D_\infty < 0.05.

  3. Argon physical diffusion: Convert D∞∗=0.085D_\infty^* = 0.085 into SI units [m2/s][\text{m}^2/\text{s}] using es.ARGON.diffusion_m2_s.

Worked solutions are provided in 16_solutions.ipynb.

Suggested references

  • I.-C. Yeh and G. Hummer, J. Phys. Chem. B 108, 15873–15879 (2004).

  • E. F. Casassa, J. Polym. Sci. B 5, 773–778 (1967).

  • A. P. Thompson et al., Comput. Phys. Commun. 271, 108171 (2022) [LAMMPS].


End of Part IV. Return to Introduction.