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 DispersionESP / LJPME) evaluates the full 3D periodic
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:
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 .Automatic co-gridded fused dual-mesh
ESP(continuity=:c2)+DispersionESP: Sharing oneprolate mesh, B2ProlateWindow, andCompactFFTpipeline between electrostatics and dispersion on SPC/E rigid water (4,149–4,473 steps/sfor1,000waters on an RTX A5000, with single-tileP = 4..6dual-mesh kernels and heavy-atom compaction inv1.2.0), delivering cutoff-independent and down to .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 .Lennard-Jones cutoff modifiers (
vdw_modifier = :none,:force_switch,:potential_switch), non-cubic1:1:3slab geometry,PressureObservable(:surface_tension),ClusterPairList(force_accumulation=:fixed64),RigidWaterConstraint(SETTLE,:df64),BAOABFast,CSVR, and GPU-batchedstep_many!.
Trajectory Visualization
tutorials/render_movies.py --targets T06).
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
where SETTLE constraint virial.
In ParticleDynamics, PressureObservable computes :surface_tension directly from total_configurational_virial(st) and the instantaneous kinetic tensor. In GROMACS units (
Why vdw_modifier Alone Cannot Fix Truncation (and LJPME vs. Slab Tail Corrections)
Splitting DispersionESP) retains the full
: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 dropsfrom 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( ): Multipliesby a switching polynomial . Because and , the extra term injects a compensating attractive force bump insidethat 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
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. , ,). 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 nmfor SPC/E) are specific to the simulated lateral area .
Slab Centering & Interfacial Coexistence Fit
To eliminate Brownian center-of-mass drift along
and fitted to the symmetric hyperbolic-tangent coexistence profile to extract the bulk liquid density
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:
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-5Attaching tuned.force alongside LennardJones on ClusterPairList(force_accumulation=:fixed64) activates periodic Float32:
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 ClusterBackend:
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 v-rescale leapfrog convention) so that the configurational temperature targets
3. Results & Visual Verification
Part A: Lennard-Jones Liquid–Vapor Slab (T* = 0.85)

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_switchdrops further to ; and:potential_switchrecovers the cutoff impulse to (stillbelow full LJ). Even extending the cutoff to leaves asystematic error ( ). By contrast, standaloneDispersionESPproduces 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 meansplateau 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):
DispersionESPgives 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)

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 raisesto (still ,, below LJPME). Activating the fused dual-mesh ESP(continuity=:c2)+DispersionESPpipeline 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-meshDispersionESPyields cutoff-independent core densities of ( ) and ( ; ,), with Gibbs interfaces at ( ). For reference, experimental liquid water athas , while full-dispersion SPC/E bulk density spansacross 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 nstotal across all 4 water runs) at4,149–7,344 steps/son an RTX A5000,RigidWaterConstraint(settle_mode=:df64)holds and (software check), PressureObservablematches to , and0NaNs 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.)
| Configuration | Mesh | Throughput | ||||||
|---|---|---|---|---|---|---|---|---|
Truncated (:force_switch) | 2.50 | — | 3.02 | 17,710 steps/s | ||||
Truncated (:none) | 2.50 | — | 2.79 | 10,396 steps/s | ||||
Truncated (:potential_switch) | 2.50 | — | 2.36 | 17,615 steps/s | ||||
Truncated (:none) | 4.00 | — | 2.19 | 16,440 steps/s | ||||
DispersionESP (LJPME) | 2.50 | 2.14 | 15,090 steps/s | |||||
DispersionESP (LJPME) | 3.50 | 2.12 | 15,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 | Dual-Mesh | Mesh | Throughput | ||||
|---|---|---|---|---|---|---|---|
Truncated LJ + C²-ESP | 0.90 | false | 7,344 steps/s | ||||
Truncated LJ + C²-ESP | 1.20 | false | 6,852 steps/s | ||||
Dual-mesh C²-ESP + DispersionESP | 0.70 | true | 4,473 steps/s | ||||
Dual-mesh C²-ESP + DispersionESP | 0.90 | true | 4,149 steps/s | ||||
| SPC/E Literature (300 K) | — | — | — | — |
Software/API Checks vs. Physical Validation
Software and API checks are separated from physical validation metrics:
| Category | Metric | Measured (ParticleDynamics) | Target / Literature Reference |
|---|---|---|---|
| Software check | tune_dispersion force error (LJ 2.5 / 3.5 σ) | ||
| Software check | tune_dispersion force error (SPC/E 0.70 / 0.90 nm) | ||
| Software check | SPC/E dual-mesh (q, √c₆) activation (0.70 & 0.90 nm) | dual = true (both) | true |
| Software check | SPC/E SETTLE geometry ( | ||
| Software check | PressureObservable identity error & NaN count (all 10 runs) | 0 NaNs | 0 NaNs |
| Physics check | LJ DispersionESP cutoff parity | Consistent ( | |
| Physics check | LJ DispersionESP density parity | Consistent ( | |
| Physics check | SPC/E DispersionESP cutoff parity | Consistent ( | |
| Physics check | SPC/E LJPME ( | ||
| Physics check | SPC/E DispersionESP density parity | Consistent ( | |
| Diagnostic | LJ truncation bias (2.5 σ :none / :pswitch / 4.0 σ) | Systematic bias vs. full LJ | |
| Diagnostic | SPC/E rc = 0.90 nm truncation bias vs. dual-mesh LJPME | Systematic bias vs. full-range dispersion |
5. Running the Tutorial
# 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.pyReferences
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).
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).
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).
P. Orea, J. López-Lemus & J. Alejandre, "Oscillatory surface tension due to finite-size effects," J. Chem. Phys. 123, 114702 (2005).
J. Janeček, "Long range corrections in inhomogeneous simulations," J. Phys. Chem. B 110, 6264–6269 (2006).
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).
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).
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).
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).
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).