Skip to content

Tutorial T01: Equation of State & Transport of the Lennard-Jones Fluid ​

This tutorial evaluates the ParticleDynamics v1.2.0 high-level Workflow API and fused :ell microcanonical (VelocityVerlet() NVE) GPU engine against two standard benchmarks of liquid-state statistical mechanics:

  1. Thermodynamics (Equation of State): Comparison of tail-corrected GPU NVE simulations (vdw_modifier=:none,  ) against the 33-parameter empirical Modified Benedict–Webb–Rubin (MBWR) correlation of Johnson, Zollweg & Gubbins (1993) across five dense liquid states (with reference to the modern equation of state of Thol et al. 2016), contrasted against the distinct truncated-and-shifted Lennard-Jones fluid (vdw_modifier=:potential_shift,  , Thol et al. 2015).

  2. Transport (Self-Diffusion): Independent evaluation of the self-diffusion coefficient in microcanonical NVE production via both the Einstein mean-squared displacement slope (MSDObservable) and the Green–Kubo velocity autocorrelation integral (VACFObservable), compared against Meier, Laesecke & Kabelac (2004) after applying the Yeh & Hummer (2004) periodic hydrodynamic finite-size correction at  .

Trajectory Visualization ​

Studio Fresnel snapshot of the dense 3D Lennard-Jones liquid and its first coordination shell

_Path-traced Fresnel studio snapshot (tutorials/render_snapshots.py --targets T01) of the dense 3D Lennard-Jones liquid (\rho^_ = 0.80, T^* = 0.90) highlighting a central tagged atom and its first coordination shell inside the periodic simulation cell.*

What You Will Learn ​

Running the Tutorial ​

All scripts live in tutorials/T01_lj_eos_transport/:

bash
# Quick GPU smoke check (N = 256)
TUTORIAL_FAST=1 julia --project tutorials/T01_lj_eos_transport/run.jl
TUTORIAL_FAST=1 julia --project tutorials/T01_lj_eos_transport/analyze.jl

# Full production validation (N = 2048, rc = 3.5, :ell CellList)
julia --project tutorials/T01_lj_eos_transport/run.jl
julia --project tutorials/T01_lj_eos_transport/analyze.jl

# Regenerate documentation figures (300 DPI)
python3 tutorials/T01_lj_eos_transport/plot.py

Physics Background ​

Reduced Units, Long-Range Dispersion Tails, and the LJTS Fluid ​

We work in standard reduced Lennard-Jones units ( ,  ,  ,  ), where time is measured in  , number density is  , temperature is  , pressure is  , and self-diffusion is  . The full pair potential is

In a finite periodic box, interactions are truncated at a cutoff radius . Two distinct thermodynamic models are examined here:

  • Full Lennard-Jones fluid approximated via unshifted cutoff + analytical tail corrections (vdw_modifier=:none,  ): Assuming an isotropic fluid with radial distribution function   for  , the omitted long-range dispersion contributions to the configurational energy per particle and pressure are

We compare the tail-corrected simulation averages against the 33-parameter MBWR equation of state of Johnson, Zollweg & Gubbins (1993). Because the JZG MBWR formula is an empirical correlation fitted to historical simulation data, it carries a pressure fit uncertainty of roughly ( in ) at dense liquid states; modern high-accuracy multiparameter equations of state such as Thol et al. (2016) quantify these small residuals in detail. Additional small systematic offsets arise from the isotropic   tail approximation beyond   and finite-size NVE ensemble effects at  .

  • Truncated-and-shifted Lennard-Jones fluid (vdw_modifier=:potential_shift,  ): Shifting the pair potential by removes the energy jump at   while leaving pair forces unchanged for  . Without long-range dispersion tails, this defines a distinct thermodynamic model, the Lennard-Jones truncated-and-shifted (LJTS) fluid (Thol et al. 2015), which has a lower critical temperature, higher pressures, and less negative configurational energies than the full Lennard-Jones fluid at the same . Accordingly, analyze.jl reports LJTS thermodynamics as a separate diagnostic rather than validating it against the full-LJ MBWR correlation.

Einstein vs Green–Kubo Self-Diffusion and Finite-Size Correction ​

In microcanonical NVE dynamics with zero center-of-mass momentum ( ), the translational self-diffusion coefficient can be evaluated by two complementary estimators:

  1. Einstein relation (MSDObservable): From the long-time linear slope of the unwrapped mean-squared displacement,
  1. Green–Kubo relation (VACFObservable): From the time integral of the velocity autocorrelation function    (with equipartition normalization  ),

In dense liquids, momentum conservation produces a positive hydrodynamic long-time tail in ; truncating the Green–Kubo integral at a short upper limit therefore tends to underestimate slightly relative to the long-time Einstein MSD slope.

Because periodic boundary conditions couple a diffusing particle to its periodic images through hydrodynamic momentum conservation, a finite cubic box of side length   underestimates the infinite-system self-diffusion coefficient according to the Yeh & Hummer (2004) relation:

where is the shear viscosity of the fluid (taken here from Meier, Laesecke & Kabelac 2004, Part I). At   ( ), this correction contributes    ( of ). Note that in this tutorial the Yeh–Hummer correction is applied at a single box size using literature viscosities to compare against ; an independent test of hydrodynamic scaling across multiple system sizes is carried out in Tutorial T05.


Workflow API Walkthrough ​

1. System Construction, CSVR Equilibration, and NVE Handoff ​

tutorials/T01_lj_eos_transport/run.jl initializes an    cubic FCC crystal ( ) at target density with zero-drift Maxwell–Boltzmann velocities, melts and equilibrates it in NVT with CSVR using GPU-batched step_many!, and replaces sim.integrator with microcanonical ConstantVolume(all_grp) (VelocityVerlet()) NVE on the same GPU state:

julia
using ParticleDynamics

all_grp = Group(:all, AllSelection())
lj = LennardJones(
    epsilon=1.0,
    sigma=1.0,
    cutoff=3.5,
    vdw_modifier=:none,           # compare with :potential_shift at cutoff=2.5
    pairs=:neighborlist,
    neighborlist=CellList(buffer=0.4, capacity=384, rebuild_interval=10),
)

thermo   = ThermodynamicObservable(all_grp; name=:thermo)
virial   = VirialObservable(all_grp; name=:virial)
press    = PressureObservable(name=:press)
msd_obs  = MSDObservable(all_grp; name=:msd)
vacf_obs = VACFObservable(all_grp; name=:vacf)

# Stage 1: Canonical CSVR equilibration with GPU super-batched step_many!
sim = Simulation(
    system;
    groups=Groups(all_grp),
    integrator=Integrator(
        dt=0.004,
        scheme=VelocityVerlet(),
        forces=[lj],
        methods=[ConstantVolume(all_grp; thermostat=CSVR(kT=T_target, tau=0.2))],
    ),
    observables=[thermo, virial, press, msd_obs, vacf_obs],
    precision=Float64,
    seed=seed,
)
prepare!(sim)
step_many!(state(sim), sim.lowlevel_integrator, 0.004, 6_000; compute_energy=false)

# Stage 2: Switch to microcanonical :ell fused VelocityVerlet() NVE
sim.integrator = Integrator(
    dt=0.004,
    scheme=VelocityVerlet(),
    forces=[lj],
    methods=[ConstantVolume(all_grp)],
)
prepare!(sim)

Before starting NVE production, run.jl removes center-of-mass momentum and runs two brief NVE settle passes (InMemoryWriter) with a one-shot kinetic-energy adjustment   , placing within of .

2. EOS Production with TableWriter, VirialObservable, and PressureObservable ​

During EOS production (20,000 NVE steps =  , sampled every 25 steps so run! executes 24-step CUDA-graph step_many! batches between samples), TableWriter logs temperature, energies, scalar virial , and mechanical pressure   :

julia
table = TableWriter(
    csv_path;
    every=25,
    observables=[
        thermo => [:temperature, :kinetic_energy, :potential_energy, :total_energy],
        virial => [:virial],
        press  => [:pressure, :volume, :density],
    ],
    mode=:replace,
)
sim.writers = Writer[table]
prepare!(sim)
run!(sim, Stage(:eos_production, steps=20_000; reset_step=0, reset_observables=true))

In analyze.jl, checking that press.pressure matches   from thermo.kinetic_energy and virial.virial (to  , limited by table formatting) is reported via verify_check as a software API consistency check (separate from physical validation) because both observables read the same GPU kinetic-energy and virial accumulators.

Since v1.2.0, CSVR removes center-of-mass momentum every nstcomm = 100 steps by default during canonical equilibration, and MSDObservable uses Float64 unwrapped coordinate tracking regardless of simulation precision.

3. Multi-Window Transport with MSDObservable, VACFObservable, and InMemoryWriter ​

Because MSDObservable and VACFObservable compute displacements and velocity inner products relative to the current observable reference configuration on the GPU, combining InMemoryWriter with schedule = Between(0, win_steps; every=sample_every) and Stage(...; reset_step=0, reset_observables=true) collects multi-origin ensembles without host velocity dumps:

  • MSD: 16 independent windows 3,000 steps (  each, sampled every 25 steps =  ); Einstein slope fitted over the linear diffusive window   .

  • VACF: The recorded production table below used 160 windows 500 steps (  each, sampled every 4 steps =  ), grouped into 8 contiguous blocks of 20 windows with plateau   . To reduce truncation of the hydrodynamic long-time tail on fresh runs, run.jl now defaults to vacf_win_steps = 1_000 ( , plateau   ).


Results & Literature Comparison ​

Part A: Equation of State vs Johnson, Zollweg & Gubbins (1993) ​

Lennard-Jones Equation of State vs Johnson et al. (1993) MBWR

Across all five tail-corrected GPU NVE runs ( , vdw_modifier=:none,  , Float64,  ), configurational energy agrees with the Johnson, Zollweg & Gubbins (1993) MBWR correlation within to (absolute differences to  ), and pressure lies within  .

Looking closely at the pressure residuals reveals a systematic negative offset across all five full-LJ states (   to , corresponding to to relative to the simulation 8-block SEM alone):

  • At   ,    sits   (, ) below the JZG MBWR value .

  • At    and   , the offsets are   (, ) and   (, ).

  • At    and   , the differences are statistically small:   (, ) and   ( relative because   is near zero pressure, ).

These pressure offsets are comparable to the known empirical fit uncertainty of the 1993 JZG MBWR correlation at dense liquid states ( in pressure; see Thol et al. 2016), together with the isotropic   tail-correction approximation at   and finite-size NVE ensemble differences at  .

Table 1a: Full Lennard-Jones Fluid (:none,   + analytical tail) vs JZG (1993) MBWR {#Table-1a:-Full-Lennard-Jones-Fluid-:none,-r_c-3.5\sigma-analytical-tail-vs-JZG-1993-MBWR} ​

State () (GPU)  () (GPU)  (, )NVE
    ()   (, ) 
    ()   (, ) 
    ()   (, ) 
    ()   (, ) 
    ()   (, ) 

_(MBWR reference values are evaluated at each run's measured NVE temperature \langle T^_ \rangle$;$z$-scores use only the simulation 8-block SEM and do not include the$\sim 0.5\text{–}1\%$empirical fit uncertainty of JZG 1993. Software API parity check:$\max |P_{\text{obs}} - (2K+W)/(3V)| \le 1.95 \times 10^{-7} across all runs.)*

Table 1b: Truncated-and-Shifted LJTS Fluid (:potential_shift,  ; Diagnostic) {#Table-1b:-Truncated-and-Shifted-LJTS-Fluid-:potential_shift,-r_c-2.5\sigma;-Diagnostic} ​

The three :potential_shift runs represent the distinct LJTS fluid (Thol et al. 2015) rather than the full Lennard-Jones fluid, so they are reported as non-gated diagnostics alongside their thermodynamic offset relative to the full-LJ fluid:

State () (GPU)Offset vs Full-LJ (GPU)Offset vs Full-LJ NVE
    
    
    

Note on NVE energy conservation and cutoff confounding: Although the recorded :potential_shift runs at   show smaller relative RMS energy fluctuations ( ) than the :none runs at   ( ), comparing those two sets directly confounds the continuous potential shift with the change in cutoff radius (both the pair-crossing flux and the energy jump vary strongly with , and itself differs between LJTS and full LJ). To isolate the pure effect of vdw_modifier=:potential_shift cleanly, run.jl now includes a matched-cutoff unshifted control (unshifted_rc25_T090_r0800, :none at  ) paired directly against shift_T090_r0800 on fresh runs.


Part B: Self-Diffusion Transport vs Meier, Laesecke & Kabelac (2004) ​

Lennard-Jones Self-Diffusion: VACF, Green-Kubo vs Einstein Parity, and MSD

At both dense liquid states, the normalized VACF exhibits the expected dense-fluid cage backscattering minimum (  near   , deeper at   than at  ), while the Einstein MSD enters a linear diffusive regime (  over   ). Comparing the two estimators honestly across both state points:

  • At   , the recorded   Green–Kubo integral and the Einstein MSD slope agree within statistical noise:      ( , ).

  • At the denser state   , however, lies below by   ( , ). This systematic   deficit is physically expected when truncating the Green–Kubo integral at   , which cuts off the positive hydrodynamic long-time tail (more pronounced at higher density). Extending the VACF correlation window to   (now the default in run.jl for fresh runs) reduces this truncation bias.

State () ( ) ( , )  (, ) (applied) (MSD / GK)Meier et al. (2004) Ref.
    (, ) ( ) ,  
    (, ) ( ) ,  

Applying the Yeh–Hummer (2004) hydrodynamic shift at   with Meier et al. (2004, Part I) viscosities brings both estimates into the Meier et al. (2004, Part II) thermodynamic-limit reference ranges ( and ). Because this tutorial evaluates only a single system size   using tabulated , it demonstrates the application of the correction rather than an independent verification of hydrodynamic scaling (see Tutorial T05 for the multi-box-size scaling validation).


References ​

  1. J. K. Johnson, J. A. Zollweg, and K. E. Gubbins, "The Lennard-Jones equation of state revisited," Molecular Physics 78(3), 591–618 (1993). DOI: 10.1080/00268979300100411

  2. M. Thol, G. Rutkai, A. Köster, R. Lustig, R. Span, and J. Vrabec, "Equation of state for the Lennard-Jones fluid," J. Phys. Chem. Ref. Data 45(2), 023101 (2016). DOI: 10.1063/1.4945000

  3. M. Thol, G. Rutkai, R. Span, J. Vrabec, and R. Lustig, "Equation of state for the Lennard-Jones truncated and shifted model fluid," Int. J. Thermophys. 36, 25–43 (2015). DOI: 10.1007/s10765-014-1764-4

  4. K. Meier, A. Laesecke, and S. Kabelac, "Transport coefficients of the Lennard-Jones model fluid. I. Viscosity," J. Chem. Phys. 121(8), 3671–3687 (2004). DOI: 10.1063/1.1770695

  5. K. Meier, A. Laesecke, and S. Kabelac, "Transport coefficients of the Lennard-Jones model fluid. II. Self-diffusion," J. Chem. Phys. 121(19), 9526–9535 (2004). DOI: 10.1063/1.1786579

  6. I.-C. Yeh and G. Hummer, "System-size dependence of diffusion coefficients and viscosities from molecular dynamics simulations with periodic boundary conditions," J. Phys. Chem. B 108(40), 15873–15879 (2004). DOI: 10.1021/jp0477147

  7. G. Bussi, D. Donadio, and M. Parrinello, "Canonical sampling through velocity rescaling," J. Chem. Phys. 126(1), 014101 (2007). DOI: 10.1063/1.2408420

ParticleDynamics v1.2.0 · GPU-native molecular dynamics in pure Julia · MIT License