Skip to content

Tutorial T06: Liquid–Vapor Surface Tension with DispersionESP (LJPME) ​

Scripts: tutorials/T06_ljpme_surface_tension/run.jl · analyze.jl · plot.py

In a homogeneous bulk liquid, truncating the attractive Lennard-Jones dispersion tail at a finite cutoff can be repaired a posteriori with an isotropic analytic tail correction assuming   for  . At a liquid–vapor interface, however, the local density drops by two to three orders of magnitude across a few molecular diameters, breaking translational invariance along the surface normal (). Standard isotropic bulk tail corrections are invalid across such interfaces: without an inhomogeneous long-range treatment, truncating dispersion lowers the effective critical temperature , thins the liquid core, inflates the vapor pressure, broadens the interface, and systematically underestimates the liquid–vapor surface tension by 10–60%, even at extended cutoffs (   for simple liquids or   for water). While slab-specific inhomogeneous tail corrections exist for planar 1D density profiles (Blokhuis et al. 1995; Janeček 2006), Lennard-Jones Particle Mesh Ewald (DispersionESP / LJPME) evaluates the full 3D periodic lattice sum directly without assuming planar slab symmetry, applying equally to droplets, curved bilayers, pores, and arbitrary heterogeneous geometries.

This tutorial reproduces interfacial dispersion benchmarks from Trokhymchuk & Alejandre (1999), Vega & de Miguel (2007), Isele-Holder, Mitchell & Ismail (2012), and Wennberg et al. (2013) across both a reduced-unit Lennard-Jones slab and an atomistic SPC/E rigid water slab, exercising the ParticleDynamics v1.2.0 long-range dispersion and slab-interface stack:

  1. Standalone DispersionESP (LJPME) on uncharged Lennard-Jones fluids: -continuous prolate lattice summation of the full periodic sum (including the   mode in energy and diagonal virial), restoring cutoff-independent surface tension and coexistence densities across    and  .

  2. Automatic co-gridded fused dual-mesh ESP(continuity=:c2) + DispersionESP: Sharing one prolate mesh, B2ProlateWindow, and CompactFFT pipeline between electrostatics and dispersion on SPC/E rigid water (4,149–4,473 steps/s for 1,000 waters on an RTX A5000, with single-tile P = 4..6 dual-mesh kernels and heavy-atom compaction in v1.2.0), delivering cutoff-independent    and   down to  .

  3. Empirical force-accuracy tuning via tune_dispersion: Measuring the relative RMS force error against a tight reference on the GPU and selecting the coarsest mesh satisfying  .

  4. Lennard-Jones cutoff modifiers (vdw_modifier = :none, :force_switch, :potential_switch), non-cubic 1:1:3 slab geometry, PressureObservable (:surface_tension), ClusterPairList(force_accumulation=:fixed64), RigidWaterConstraint (SETTLE, :df64), BAOABFast, CSVR, and GPU-batched step_many!.

Trajectory Visualization ​

Live Fresnel Studio Dashboard (T06): Dual-mesh LJPME (C²-ESP + DispersionESP) SPC/E liquid–vapor slab (1,000 H₂O, 3.2 × 3.2 × 9.6 nm³) showing Gibbs capillary waves alongside cumulative surface tension γ̄(t) vs. Vega & de Miguel (2007) and the −12.1% truncated-LJ bias (tutorials/render_movies.py --targets T06).

Studio Fresnel snapshot of the SPC/E liquid-vapor slab with dual-mesh LJPME


1. Physical Model & Statistical-Mechanical Identities ​

Mechanical Surface Tension in a 1:1:3 Orthorhombic Slab ​

For a liquid slab centered in an orthorhombic periodic simulation cell with two planar liquid–vapor interfaces normal to the -axis (  ), the Kirkwood–Buff mechanical surface tension is given by the integrated pressure anisotropy divided by the two interfaces:

where is the full configurational virial tensor combining short-range pair virials, reciprocal-space electrostatic and dispersion virials, the   dispersion virial ( ), and (for rigid water) the holonomic SETTLE constraint virial.

In ParticleDynamics, PressureObservable computes :surface_tension directly from total_configurational_virial(st) and the instantaneous kinetic tensor. In GROMACS units (,  , , ), surface tension converts to   via:

Why vdw_modifier Alone Cannot Fix Truncation (and LJPME vs. Slab Tail Corrections) ​

Splitting into a -smooth short-range kernel inside and a smooth periodic reciprocal mesh (DispersionESP) retains the full   attractive tail in 3D without assuming planar symmetry. By contrast, analytical or on-the-fly slab tail corrections (Blokhuis et al. 1995; Janeček 2006) integrate the omitted dispersion tail over a 1D planar density profile and therefore rely on a fixed planar interface normal, whereas modifying the cutoff without any long-range summation alters the interfacial physics in distinct ways:

  • :none (sharp truncation at   ): Forces vanish discontinuously at , so the mechanical virial equals that of the truncated-and-shifted potential (omitting the impulsive   contribution) and drops from to , slashing   to (Trokhymchuk & Alejandre 1999).

  • :force_switch (    ): Smoothly tapers the attractive force to zero over , removing even more attraction and suppressing further ().

  • :potential_switch (    ): Multiplies by a switching polynomial . Because   and  , the extra term   injects a compensating attractive force bump inside that mimics the unshifted cutoff impulse ( ), yet still misses the entire   dispersion tail ( below full LJ).

Lateral Finite-Size & Capillary-Wave Considerations ​

Finite lateral cross-sections introduce two well-studied interfacial effects (Orea, López-Lemus & Alejandre 2005; Vega & de Miguel 2007; Biscay et al. 2009):

  1. Oscillatory finite-area effects in : For narrow slabs (  ), periodic correlations along the interface induce oscillatory deviations in . Our SPC/E water slab uses       (and    for LJ), placing it just above the onset of the plateau; residual finite-area shifts of   relative to larger cross-sections (  ) remain within our statistical precision (and consistent with Vega & de Miguel 2007:   vs.   ,     , ).

  2. Capillary-wave broadening of the interfacial width : Thermal capillary waves broaden the measured apparent width logarithmically with lateral box size,   , so reported widths (2.12–2.14 σ for LJ, 0.30 nm for SPC/E) are specific to the simulated lateral area  .

Slab Centering & Interfacial Coexistence Fit ​

To eliminate Brownian center-of-mass drift along before binning local densities , every snapshot is wrapped relative to its periodic circular center of mass:

and fitted to the symmetric hyperbolic-tangent coexistence profile to extract the bulk liquid density , vapor density , Gibbs dividing surface , and apparent interfacial thickness :


2. ParticleDynamics API Walkthrough ​

Empirical Tuning & Standalone DispersionESP (Part A: LJ Slab) ​

tune_dispersion evaluates a candidate DispersionESP descriptor directly on the GPU against a tight reference at the same real_cutoff and returns the coarsest mesh meeting target:

julia
tuned = tune_dispersion(st, DispersionESP(real_cutoff=2.5); target=1e-4)
# LJ_slab (12x12x36, rc=2.5): tol=1e-4, mesh=(28, 28, 84), rel_force_err=6.06e-5
# LJ_slab (12x12x36, rc=3.5): tol=1e-2, mesh=(14, 14, 40), rel_force_err=2.10e-5

Attaching tuned.force alongside LennardJones on ClusterPairList(force_accumulation=:fixed64) activates periodic lattice dispersion with associative 64-bit fixed-point slot accumulation in Float32:

julia
forces = Force[
    LennardJones(
        epsilon=1.0, sigma=1.0, cutoff=2.5,
        pairs=:neighborlist,
        neighborlist=ClusterPairList(buffer=0.30, force_accumulation=:fixed64),
        vdw_modifier=:none,
    ),
    tuned.force,   # standalone DispersionESP on uncharged LJ
]
sim = Simulation(
    sys;
    groups=Groups(allp),
    observables=[ThermodynamicObservable(allp; name=:thermo), PressureObservable(name=:press)],
    precision=:f32,
    integrator=Integrator(
        dt=0.005,
        scheme=BAOABFast(),
        forces=forces,
        methods=[Langevin(allp; gamma=0.5, kT=0.85)],
    ),
)

For truncated comparisons at rc = 2.5 σ, switching vdw_modifier between :none, :force_switch, and :potential_switch requires changing only a single keyword argument on LennardJones.

Automatic Fused Dual-Mesh (q, √c₆) C²-ESP + DispersionESP (Part B: SPC/E Water) ​

When ESP(continuity=:c2) and DispersionESP are combined in the same force list without pinning conflicting meshes or windows, Workflow.compile_forces automatically co-grids them onto a shared prolate mesh and activates the fused dual-mesh spread/FFT/gather pipeline in ClusterBackend:

julia
pt = PairTable(
    sigma=[0.316557, 0.0],
    epsilon=[0.650194, 0.0],   # harmonized GROMACS spce.itp value (matching T04/T05/T07/T14)
    cutoff=[rc, rc],
    type_names=[:O, :H],
)
forces = Force[
    LennardJones(
        pair_table=pt,
        pairs=:neighborlist,
        neighborlist=ClusterPairList(buffer=0.12, force_accumulation=:fixed64),
        vdw_modifier=:none,
    ),
    ESP(coulomb_prefactor=138.93545764498226, real_cutoff=rc, tolerance=1e-4, continuity=:c2),
    DispersionESP(real_cutoff=rc, tolerance=1e-4),
]
sim = Simulation(
    sys;
    groups=Groups(allp),
    observables=[thermo, press],
    precision=:f32,
    integrator=Integrator(
        dt=0.002,
        scheme=VelocityVerlet(),
        forces=forces,
        methods=[ConstantVolume(allp; thermostat=CSVR(kT=kB * 300.0, tau=0.2))],
        constraints=[RigidWaterConstraint(waters; oh=0.1, hh=0.1632993161855452, settle_mode=:df64)],
    ),
)

(Parameter harmonization note: the recorded production runs in Section 4 were executed with SPCE_EPS_KJ = 0.650629 kJ/mol, which is +0.067% above the 0.650194 kJ/mol value used in Tutorials T04, T05, T07, and T14; run.jl has been harmonized to 0.650194 kJ/mol. This +0.067% difference shifts bulk liquid density by < 1e-4 g/cm³, well below the ±1.1 kg/m³ statistical error.)

Between observable samples (sample_every = 50 steps), GPU-batched step_many!(st, spec, dt, 49; compute_energy=false) runs inside captured CUDA graphs with zero host synchronization, followed by a single step!(st, spec, dt; compute_energy=true) step and sample_observable(sim, press; fields=[:pressure, :pressure_tensor, :surface_tension, :box]).

Half-step CSVR shadow temperature in rigid water (Δt = 2 fs)

CSVR in ParticleDynamics thermostats the leapfrog half-step kinetic energy   (matching GROMACS's v-rescale leapfrog convention) so that the configurational temperature targets rather than overheating high-frequency water librations ( ). As established in Tutorial T02, the reported full-step Velocity-Verlet kinetic temperature therefore sits at    ( ), while the LJPME slab liquid core density reaches   .


3. Results & Visual Verification ​

Part A: Lennard-Jones Liquid–Vapor Slab (T* = 0.85) ​

Lennard-Jones slab surface tension, cumulative convergence, and coexistence density profiles with standalone DispersionESP

  • Truncation bias vs. cutoff-independent DispersionESP (Panel a): At   , sharp truncation (:none) yields    ( below full-range LJPME, consistent with Trokhymchuk & Alejandre 1999's mechanical-virial shifted-LJ result ); :force_switch drops further to  ; and :potential_switch recovers the cutoff impulse to   (still below full LJ). Even extending the cutoff to    leaves a systematic error (  ). By contrast, standalone DispersionESP produces cutoff-independent surface tensions at    ( ) and    ( , difference    , ), consistent with full-range LJ literature ( , Potoff & Panagiotopoulos 2000; Vega & de Miguel 2007; Isele-Holder et al. 2012).

  • Statistical convergence across   (Panel b): All six cumulative running means plateau over production steps, with LJPME (  and  ) converging inside the full-LJ reference band while all four truncated/switched schemes converge to distinct, lower plateaus.

  • Coexistence densities & vapor-phase structure (Panel c): DispersionESP gives cutoff-independent coexistence densities (   at   vs.   at  ,    , ;  ; interfacial width   ), consistent with full-LJ coexistence ( ,  ). Truncated    expands the liquid to   (:none) / (:force_switch), inflates vapor density   ( , inset), and broadens the interface to  .

Part B: SPC/E Rigid Water Liquid–Vapor Slab (T = 300 K, Δt = 2 fs) ​

SPC/E rigid water slab surface tension, cumulative convergence, and mass density profile with fused dual-mesh C2-ESP and DispersionESP

  • Cutoff-independent water surface tension down to   (Panels a & b): Truncating oxygen–oxygen LJ dispersion at   underestimates SPC/E surface tension at    (   , , below LJPME at  ). Increasing the cutoff to   raises to   (still    , , below LJPME). Activating the fused dual-mesh ESP(continuity=:c2) + DispersionESP pipeline removes the cutoff dependence:   yields   and   yields   (   , ), consistent with Vega & de Miguel (2007) ( ,    , ), Isele-Holder et al. (2012) (), and Wennberg et al. (2013) ().

  • Bulk liquid water core density (Panel c & inset): Truncated   underestimates the slab liquid core density at  , and   remains low at  . Dual-mesh DispersionESP yields cutoff-independent core densities of   ( ) and   ( ;    , ), with Gibbs interfaces at    ( ). For reference, experimental liquid water at has  , while full-dispersion SPC/E bulk density spans across literature setups (e.g., Vega & Abascal 2011: at ; Berendsen et al. 1987: at ; NIST SRSW: at , consistent with Tutorials T04 and T07).

  • Software/numerical invariants: Across all of dual-mesh production (4.8 ns total across all 4 water runs) at 4,149–7,344 steps/s on an RTX A5000, RigidWaterConstraint(settle_mode=:df64) holds    and    (software check ), PressureObservable matches    to  , and 0 NaNs occur.


4. Quantitative Production Summary ​

Measured on an NVIDIA RTX A5000 (Float32, ClusterPairList(force_accumulation=:fixed64)), with 8-block standard errors of the mean.

Part A: Lennard-Jones Slab (T* = 0.85, N = 1,400, 12 × 12 × 36 σ³, Δt = 0.005 τ, 800 τ prod.) ​

ConfigurationMeshThroughput
Truncated (:force_switch)2.50—    3.0217,710 steps/s
Truncated (:none)2.50—    2.7910,396 steps/s
Truncated (:potential_switch)2.50—    2.3617,615 steps/s
Truncated (:none)4.00—    2.1916,440 steps/s
DispersionESP (LJPME)2.50      2.1415,090 steps/s
DispersionESP (LJPME)3.50      2.1215,163 steps/s
_Literature (full LJ, T^_=0.85)*——

Part B: SPC/E Rigid Water Slab (T = 300 K, 1,000 H₂O, 3.2 × 3.2 × 9.6 nm³, Δt = 2 fs, 1.2 ns prod.) ​

Configuration (nm)Dual-MeshMesh (mN/m) (kg/m³) (nm)Throughput
Truncated LJ + C²-ESP0.90false     7,344 steps/s
Truncated LJ + C²-ESP1.20false     6,852 steps/s
Dual-mesh C²-ESP + DispersionESP0.70true     4,473 steps/s
Dual-mesh C²-ESP + DispersionESP0.90true     4,149 steps/s
SPC/E Literature (300 K)——  / (Exp. )——

Software/API Checks vs. Physical Validation ​

Software and API checks are separated from physical validation metrics:

CategoryMetricMeasured (ParticleDynamics)Target / Literature Reference
Software checktune_dispersion force error (LJ 2.5 / 3.5 σ)  /   
Software checktune_dispersion force error (SPC/E 0.70 / 0.90 nm)  /   
Software checkSPC/E dual-mesh (q, √c₆) activation (0.70 & 0.90 nm)dual = true (both)true
Software checkSPC/E SETTLE geometry (, ) ,  
Software checkPressureObservable identity error & NaN count (all 10 runs) , 0 NaNs, 0 NaNs
Physics checkLJ DispersionESP cutoff parity    ()Consistent ()
Physics checkLJ DispersionESP density parity    ()Consistent ()
Physics checkSPC/E DispersionESP cutoff parity    ()Consistent ()
Physics checkSPC/E LJPME () vs. Vega & de Miguel (2007)    () 
Physics checkSPC/E DispersionESP density parity    ()Consistent ()
DiagnosticLJ truncation bias (2.5 σ :none / :pswitch / 4.0 σ) / / Systematic bias vs. full LJ
DiagnosticSPC/E rc = 0.90 nm truncation bias vs. dual-mesh LJPME  (, )Systematic bias vs. full-range dispersion

5. Running the Tutorial ​

bash
# Quick GPU smoke verification (N=384 LJ + 256 H2O SPC/E)
TUTORIAL_FAST=1 julia --project tutorials/T06_ljpme_surface_tension/run.jl
TUTORIAL_FAST=1 julia --project tutorials/T06_ljpme_surface_tension/analyze.jl

# Full production validation (N=1400 LJ over 800 tau + 1000 H2O SPC/E over 1.2 ns)
julia --project tutorials/T06_ljpme_surface_tension/run.jl
julia --project tutorials/T06_ljpme_surface_tension/analyze.jl

# Regenerate 300-DPI documentation figures
python3 tutorials/T06_ljpme_surface_tension/plot.py

References ​

  1. E. M. Blokhuis, D. Bedeaux, C. D. Holcomb & J. A. Zollweg, "Tail corrections to the surface tension of a Lennard-Jones liquid–vapour interface," Mol. Phys. 85, 665–669 (1995).

  2. A. Trokhymchuk & J. Alejandre, "Computer simulations of liquid/vapor interface in Lennard-Jones fluids: Some questions and answers," J. Chem. Phys. 111, 8510–8523 (1999).

  3. J. J. Potoff & A. Z. Panagiotopoulos, "Surface tension of the three-dimensional Lennard-Jones fluid from histogram-reweighting Monte Carlo simulations," J. Chem. Phys. 112, 6411–6415 (2000).

  4. P. Orea, J. López-Lemus & J. Alejandre, "Oscillatory surface tension due to finite-size effects," J. Chem. Phys. 123, 114702 (2005).

  5. J. Janeček, "Long range corrections in inhomogeneous simulations," J. Phys. Chem. B 110, 6264–6269 (2006).

  6. C. Vega & E. de Miguel, "Surface tension of the most popular models of water by using the test-area simulation method," J. Chem. Phys. 126, 154707 (2007).

  7. F. Biscay, A. Ghoufi, F. Goujon, V. Lachet & P. Malfreyt, "Calculation of the surface tension from Monte Carlo simulations: Does the model impact on the finite-size effects?" J. Chem. Phys. 130, 184710 (2009).

  8. C. Vega & J. L. F. Abascal, "Simulating water with rigid non-polarizable models: a general assessment and guidelines for the future," Phys. Chem. Chem. Phys. 13, 19663–19688 (2011).

  9. R. E. Isele-Holder, W. Mitchell & A. E. Ismail, "Development and application of a particle-particle particle-mesh Ewald method for dispersion interactions," J. Chem. Phys. 137, 174107 (2012).

  10. C. L. Wennberg, T. Murtola, B. Hess & E. Lindahl, "Lennard-Jones lattice summation in bilayer simulations has critical effects on surface tension and lipid properties," J. Chem. Theory Comput. 9, 3527–3537 (2013).

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