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.

13. Self-diffusion: mean-squared displacement (Einstein) vs velocity autocorrelation (Green–Kubo)

School of Engineering and Digital Sciences, Nazarbayev University

Track: core  ·  Prerequisites: Chapters 2, 4, 6

This chapter builds and verifies the core algorithms for self-diffusion: mean-squared displacement (einstein) vs velocity autocorrelation (green–kubo) in plain Python and NumPy, checking every result against an exact statistical-mechanics limit or published benchmark.

13.1 Physical principles and governing equations

Macroscopic self-diffusion DD can be computed identically from two distinct microscopic routes:

  1. Einstein Mean-Squared Displacement (MSD) using unwrapped coordinates: DMSD=lim⁡t→∞16t⟨∣r(t)−r(0)∣2⟩D_{\text{MSD}} = \lim_{t\to\infty} \frac{1}{6t}\langle |\mathbf{r}(t) - \mathbf{r}(0)|^2 \rangle.

  2. Green–Kubo Velocity Autocorrelation Function (VACF):

DGK=13∫0∞⟨v(0)⋅v(t)⟩ dt.(13.1)D_{\text{GK}} = \frac{1}{3}\int_0^\infty \langle \mathbf{v}(0) \cdot \mathbf{v}(t) \rangle\,dt. \tag{13.1}

For a free Langevin particle (m=1m=1), both routes have the exact analytical solution Cv(t)=3Te−γtC_v(t) = 3 T e^{-\gamma t} and D=T/γD = T / \gamma.

13.2 Inside the algorithm

13.3 Checks

Exact D = 0.750 | Green-Kubo D_GK = 0.796 | Einstein D_MSD = 0.734
<Figure size 1120x430 with 2 Axes>

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

13.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. Ballistic t2t^2 scaling: Verify that for t≪1/γt \ll 1/\gamma, MSD(t)≈3Tt2\text{MSD}(t) \approx 3 T t^2.

  2. FFT speed & accuracy: Verify autocorrelation_fft at lag 0 equals exact ⟨∣v∣2⟩\langle |\mathbf{v}|^2 \rangle to <10−12<10^{-12}.

  3. Why wrapped coordinates fail MSD: Explain why computing MSD without unwrapping periodic jumps plateaus artificially at L2/4L^2 / 4.

Worked solutions are provided in 13_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].