Tutorial T13: Biomolecular Force Fields and 4 fs HMR: Alanine Dipeptide Ramachandran Free Energy Landscape
This tutorial validates the all-atom biomolecular Workflow stack of ParticleDynamics v1.2.0 on solvated L-Alanine Dipeptide (Ace–Ala–Nme, 22 atoms, AMBER ff99SB-ILDN) in explicit TIP3P water (559 water molecules, 1,699 total atoms,
2 fsStandard vs.4 fsHydrogen Mass Repartitioning (HMR) stability, constraints, and GPU speedup: Explicit-solvent MD at compares standard hydrogen masses ( , , auto-detectedHBondConstraints) against HMR ( viaConstraintClusters.apply_hmr, ,ConstraintClusterSpec). Both runs use warp-cooperative:df64RigidWaterConstraint(SETTLE/RATTLE), cotangent-projected constrainedBAOABFastwith uniform collision ratefriction_rate = 1.0 ps⁻¹, andStochasticCellRescalingNPT equilibration. On an RTX 3090,4 fsHMR sustains12,355 steps/speak (11,704 steps/seffective) versus15,231 steps/s(14,086 steps/seffective) at2 fs(1.62×peak /1.66×effective simulated-time speedup under displacement-triggered neighbor lists), withmax|Δr_OH| ≤ 1.7×10⁻⁷ nm,max|Δr_XH| ≤ 1.3×10⁻⁷ nm, zero NaNs across7.5 × 10⁶production steps, and100 psmicrocanonical NVE drift|dE/dt| = 0.017–0.028 kJ·mol⁻¹·ns⁻¹·DOF⁻¹.Solvated Ramachandran
free-energy landscape :10.0 nsof explicit-solvent sampling each (20.0 nstotal,72and46spontaneous transitions) reproduces the solvated AMBERff99SB/TIP3Pconformational hierarchy ( ), trans-amide planarity ( ), and thermodynamic consistency between4 fsHMR and2 fsStandard within statistical error: ( ,0.15σ), ( ,0.54σ), (0.11σ), and NPT density (1.13σ).Unit-system invariance software audit (
GROMACSvs.AMBER/AKMA): The identical solvatedAce–Ala–Nme+ TIP3P snapshot is built in GROMACS/OpenMM units ( ) and AMBER/CHARMM AKMA units ( , ). Single-point agreement across all bonded, 1–4 scaled, Lennard-Jones,C²-ESPelectrostatic, virial, and atomic-force terms reaches≤ 2.61 × 10⁻¹⁵inFloat64(≤ 3.99 × 10⁻⁶inFloat32 :fixed64), and matched500-step (1.0 ps) constrained NVE trajectories agree tomax|ΔU/U| = 1.17 × 10⁻¹⁰,max|ΔT| = 1.80 × 10⁻⁷ K, andmax|Δφ|, max|Δψ| ≤ 3.02 × 10⁻⁸ deg.
Trajectory Visualization
tutorials/render_movies.py --targets T13).
What You Will Learn
Building a complete all-atom biomolecular
ParticleSystemandTopology(bonds,angles,dihedrals,impropers,exclusions,molecules) with typed force-field families:HarmonicBondForce,HarmonicAngleForce,PeriodicDihedralForce(multi-term Fourier series), andHarmonicImproperForce.Configuring AMBER 1–2 / 1–3 exclusions (
exclusions=:topology) and AMBER 1–4 nonbonded scaling (coul_scale = 1/1.2,lj_scale = 0.5) via 4-tuplescaled_pairs = (i, j, coul_scale, lj_scale)onC²-continuousESP+ClusterPairList(force_accumulation=:fixed64) +CompactFFTtuned viatune_electrostatics.Relaxing initial solvation clashes with GPU
FIREenergy minimization (minimize!) prior to attaching holonomic constraints.Partitioning covalent bonds into heavy–heavy harmonic bonds and terminal
X–Hstar clusters viaConstraintClusters.extract_hbond_constraints, repartitioning hydrogen masses viaConstraintClusters.apply_hmr(m_H = 3.024 u, conserving each donor cluster's mass), and combiningHBondConstraints/ConstraintClusterSpec(defaulting to compensatedDF64,constraint_mode = :df64, in v1.2.0) withRigidWaterConstraint(SETTLE,settle_mode = :df64).Running GPU-resident
StochasticCellRescaling(DeviceCRescale, backed by aFloat64shadow box in v1.2.0) NPT density equilibration followed byBAOABFastNVT production with uniform per-atom collision ratefriction_rate(ξ = γ_i / m_i), and switching between self-consistent unit systems (nm / kJ·mol⁻¹ / psvs.Å / kcal·mol⁻¹ / AKMA).
Running the Tutorial
All scripts live in tutorials/T13_alanine_dipeptide_hmr/:
# Quick GPU smoke verification (~273 TIP3P waters, 0.12 ns each, < 10 s warm NVT compute)
TUTORIAL_FAST=1 julia --project tutorials/T13_alanine_dipeptide_hmr/run.jl
TUTORIAL_FAST=1 julia --project tutorials/T13_alanine_dipeptide_hmr/analyze.jl
# Full production validation (559 TIP3P waters, 10.0 ns each for 2 fs & 4 fs HMR, 100 ps NVE, unit audit)
julia --project tutorials/T13_alanine_dipeptide_hmr/run.jl
julia --project tutorials/T13_alanine_dipeptide_hmr/analyze.jl
# Regenerate documentation figures (300 DPI)
python3 tutorials/T13_alanine_dipeptide_hmr/plot.pyPhysics Background
AMBER ff99SB-ILDN Force Field & Solvated Alanine Dipeptide
Blocked L-alanine dipeptide (Ace–Ala–Nme, ff99SB (Hornak et al. 2006) and ff99SB-ILDN are identical for alanine.
The total potential energy combines all four bonded families, Lorentz–Berthelot Lennard-Jones dispersion/repulsion, and C²-ESP long-range electrostatics with AMBER 1–4 nonbonded scaling (
The 22-atom covalent tree contains 21 bonds (9 heavy–heavy harmonic bonds + 12 constrained X–H bonds forming three methyl ff99SB H–N–C–O trans-amide bias), 4 planar amide impropers (C=O N–H
In explicit TIP3P water at ff99SB/TIP3P studies (which vary slightly in basin boundary definitions), the extended 10 ns unbiased runs experience substantial statistical variance from rare
Hydrogen Mass Repartitioning (HMR), Constrained BAOAB & Full-Step Shadow Temperature
Constraining all covalent X–H stretches (SETTLE on rigid water + ConstraintClusters on solute X–H) removes the H–C–H, C–N–H at CH₃: Cα: N:
Because the canonical configurational Boltzmann distribution
Uniform friction_rate and full-step T_full under constrained BAOAB
In ParticleDynamics, Langevin(group; friction_rate=1.0, kT=kT) applies a mass-uniform collision frequency B1 kick and the O Ornstein–Uhlenbeck step are projected onto the holonomic cotangent manifold (RATTLE at ThermoObservable reports the full-step projected kinetic temperature
Unit-System Invariance (nm / kJ·mol⁻¹ / ps vs. Å / kcal·mol⁻¹ / AKMA)
ParticleDynamics integrates Newton's equations
so
Workflow API Walkthrough
1. Typed Bonded Stack, 1–4 Nonbonded Scaling & C²-ESP Electrostatics
tutorials/T13_alanine_dipeptide_hmr/run.jl constructs Ace–Ala–Nme via a NeRF internal-coordinate builder (asserting L-alanine stereochemistry, equilibrium bond lengths, and planar trans amides), solvates it in 559 TIP3P waters, and wires all four typed bonded families alongside 4-tuple scaled_pairs on ESP(continuity=:c2):
using ParticleDynamics
using ParticleDynamics: ConstraintClusters
# AMBER 1–2 / 1–3 exclusions (coul=0, lj=0) + 1–4 scaling (coul=1/1.2, lj=0.5)
scaled_pairs = vcat(
[(i, j, 0.0, 0.0) for (i, j) in pairs_12],
[(i, j, 0.0, 0.0) for (i, j) in pairs_13],
[(i, j, 1.0 / 1.2, 0.5) for (i, j) in pairs_14],
)
lj = LennardJones(
pair_table=PairTable(sigma=sig_u, epsilon=eps_u, cutoff=rc_vec_u, type_names=ALL_TYPE_NAMES),
pairs=:neighborlist,
vdw_modifier=:potential_shift,
neighborlist=ClusterPairList(buffer=0.20, force_accumulation=:fixed64),
)
esp = ESP(
coulomb_prefactor=138.93545764498226,
real_cutoff=0.90,
tolerance=5e-4,
continuity=:c2,
mesh=(15, 15, 15), # selected by tune_electrostatics (CompactFFT=true, rel_err=3.28e-4)
order=4,
net_charge=:error,
boundary=:tin_foil,
exclusions=:topology,
scaled_pairs=scaled_pairs,
)
# Typed bonded families (examples from the full ff99SB-ILDN set)
forces = Force[
lj, esp,
HarmonicBondForce(k=410032.0, r0=0.1335, type=:C_N),
HarmonicAngleForce(k=527.184, theta0=deg2rad(110.10), type=:N_CT_C),
PeriodicDihedralForce(k=[1.75728, 1.12968], n=[3, 2], phase=[0.0, 0.0], type=:phi),
PeriodicDihedralForce(k=[2.30120, 6.61072, 1.88280], n=[3, 2, 1], phase=[pi, pi, pi], type=:psi),
HarmonicImproperForce(k=175.728, chi0=pi, type=:imp_C),
HarmonicImproperForce(k=18.4096, chi0=pi, type=:imp_N),
# ... remaining heavy bond, angle, and dihedral types ...
]2. FIRE Energy Minimization, extract_hbond_constraints & apply_hmr
Initial solvation clashes are relaxed with GPU FIRE minimization (minimize!, reducing 66 iterations to extract_hbond_constraints and apply_hmr split the peptide covalent bonds and repartition mass onto the 12 peptide hydrogens while excluding rigid water atoms. In ParticleDynamics v1.2.0, ConstraintClusters (ConstraintClusterSpec and HBondConstraints) defaults to compensated double-float arithmetic (constraint_mode = :df64) alongside RigidWaterConstraint(settle_mode = :df64) on Float32 biomolecular runs, preserving sub-X–H and water constraint accuracy without extra register spill:
# Phase 0: Unconstrained FIRE clash relaxation before attaching holonomic constraints
res_min = minimize!(
sim_min;
method=FIRE(dt_initial=0.001, dt_max=0.005, fictitious_mass=1.0),
force_tolerance=250.0,
max_displacement=0.01,
max_iterations=400,
)
# Phase 1–3: Split 21 peptide bonds -> 12 X–H constraints + 9 heavy harmonic bonds, apply HMR
h_constraints, heavy_bonds = ConstraintClusters.extract_hbond_constraints(
all_pep_bonds, masses_std; h_mass_cutoff=2.0, exclude_atoms=water_atom_ids
)
masses_hmr = ConstraintClusters.apply_hmr(
masses_std, h_constraints; hydrogen_mass=3.024, h_mass_cutoff=2.0, exclude_atoms=water_atom_ids
)
# Standard 2 fs: HBondConstraints auto-detects the identical 12 X–H pairs & strips them from bonded forces
rw = RigidWaterConstraint(water_triples; oh=0.09572, hh=0.15139006545247014, settle_mode=:df64)
constr_2fs = [rw, HBondConstraints(project_initial=true)]
# 4 fs HMR: pass explicit ConstraintClusterSpec (since repartitioned m_H = 3.024 u > 1.5 u cutoff)
constr_4fs = [rw, ConstraintClusterSpec(h_constraints; project_initial=true)]3. StochasticCellRescaling NPT Equilibration & BAOABFast NVT Production
Each protocol equilibrates density for 50 ps under GPU-resident StochasticCellRescaling (DeviceCRescale, Langevin(all_grp; friction_rate=1.0, kT=kT)), benchmarks GPU throughput via step_many!, and runs 10.0 ns of cotangent-projected BAOABFast (friction_rate = 1.0 ps⁻¹) NVT production partitioned into 8 contiguous blocks (20,000 Ramachandran frames per run, sampled every 0.50 ps via InMemoryWriter + TableWriter). In v1.2.0, StochasticCellRescaling maintains an internal Float64 shadow box alongside the Float32 simulation cell, eliminating cumulative single-precision box-length quantization drift during extended NPT runs.
Results & Literature Validation
Part A: Ramachandran Free-Energy Landscape & 2 fs vs. 4 fs HMR Consistency

Across 20.0 ns of combined explicit-solvent GPU production on an NVIDIA RTX 3090 (559 TIP3P waters + Ace–Ala–Nme, 1,699 atoms, C²-ESP (15, 15, 15) CompactFFT, Float32 :fixed64), all 19/19 physics validation checks pass alongside 15/15 software/API regression checks (CHECK_OK). Both 2 fs Standard (72 4 fs HMR (46 transitions) populate the solvated AMBER ff99SB/TIP3P Ramachandran basins with statistically consistent relative free energies and NPT density:
| Observable | 2 fs Standard (10.0 ns) | 4 fs HMR (10.0 ns) | z) | Literature / Context (ff99SB/TIP3P, 300 K) |
|---|---|---|---|---|
-1.32σ) | Dominant extended basin (Prada-Gracia 2009; Vymětal & Vondrášek 2010) | |||
-1.02σ) | Secondary extended | |||
-1.26σ) | ||||
-0.48σ) | ||||
+1.36σ) | Rare high-barrier basin (single excursion in 4 fs run; see note below) | |||
0.15σ) | Statistically consistent (≤ 3σ, Hopkins et al. 2015) | |||
0.54σ) | Statistically consistent (≤ 3σ) | |||
0.11σ) | Statistically consistent (≤ 3σ) | |||
| 2D FES RMSE ( | – | – | 0.27 kcal/mol, diagnostic) | Across 832 populated |
| Basin minima | ≤ 3 bins) | Solvated | ||
| Trans-amide | Planar trans (zero cis isomerization) | |||
| NPT Density | 1.13σ) | Consistent across 2 fs and 4 fs (r_c = 0.90 nm TIP3P) | ||
| Configurational | +0.31%, diagnostic) | Small | ||
| Full-step | Analytical Leimkuhler–Matthews |
Sampling note on the 10 ns trajectories, crossing the 0.0% in 2fs_std vs. a single prolonged visit giving 15.0 ± 11.0%, 1.36σ from zero, in 4fs_hmr). Because the overall fraction spent in 2 fs and 4 fs HMR within
Part B: NVE Conservation, RTX 3090 Speedup & Unit-System Invariance Audit

1. 4 fs HMR GPU Speedup, Amdahl Neighbor-List Scaling & Constraint Precision (Software/API Checks)
| Protocol | Peak GPU (step_many!) | Effective Prod. (incl. I/O) | max|Δr_OH| (SETTLE) | max|Δr_HH| (SETTLE) | max|Δr_XH| (ConstraintClusters) | 100 ps NVE Drift ( | NaNs |
|---|---|---|---|---|---|---|---|
2 fs Standard (m_H = 1.008 u) | 15,231 steps/s | 14,086 steps/s | max|ΔE|/N = 0.0062) | 0 | |||
4 fs HMR (m_H = 3.024 u) | 12,355 steps/s | 11,704 steps/s | max|ΔE|/N = 0.0062) | 0 | |||
4 fs No-HMR (m_H = 1.008 u, NVE control) | – | – | – | max|ΔE|/N = 0.0061) | 0 | ||
Time-Advance Ratio (4 fs HMR / 2 fs) | 1.62× | 1.66× | Low secular drift | 0 |
The simulated-time wall-clock gain is 1.62× peak / 1.66× effective (12,355 steps/s at 4 fs vs. 15,231 steps/s at 2 fs) rather than the nominal 2.00× timestep ratio because ClusterPairList uses displacement-triggered neighbor-list rebuilds (skin = 0.20 nm). While force, CompactFFT, bonded, and constraint evaluations scale per step and halve per unit simulated time at 4 fs, physical-time pair-list rebuilds remain invariant per unit time, placing the net gain in the 1.5×–2.0× range typical of GPU HMR simulations (Hopkins et al. 2015).
2. Unit-System Invariance Software Audit (GROMACS vs. AMBER/AKMA)
Evaluated as a software regression audit (CHECK_OK, counted separately from physics validation) on the identical equilibrated 1,699-atom solvated Ace–Ala–Nme snapshot with all bonded terms, 1–4 scaled pairs, vdw_modifier=:potential_shift LJ, and C²-ESP (15, 15, 15) electrostatics:
| Interaction / Trajectory Observable | GROMACS ( | AMBER/AKMA ( | Rel. Error (Float64) | Rel. Error (Float32 :fixed64) |
|---|---|---|---|---|
Harmonic bonds (9 heavy bonds) | ||||
Harmonic angles (36 angles) | ||||
Fourier dihedrals (29 ff99SB terms) | ||||
Harmonic impropers (4 amide planes) | ||||
C²-ESP Coulomb (incl. 1–2/1–3 & 1/1.2 1–4) | ||||
Lennard-Jones (incl. 1–2/1–3 & 0.5 1–4) | ||||
| Total potential energy | ||||
| Virial trace | ||||
| All | ||||
500-step NVE traj. (1.0 ps, Float64) | SETTLE + ConstraintClusters | Matched dt = 0.040910 AKMA |
All force-field components and constrained dynamical observables agree to machine precision in Float64 (≤ 2.61×10⁻¹⁵ single-point, ≤ 1.17×10⁻¹⁰ over 500 NVE steps) and to < 4.0×10⁻⁶ in Float32 :fixed64, verifying unit-system independence across the ParticleDynamics GPU biomolecular engine (19/19 Physics PASS, 15/15 Software/API CHECK_OK).
References
C. W. Hopkins, S. Le Grand, R. C. Walker, and A. E. Roitberg, "Long-Time-Step Molecular Dynamics through Hydrogen Mass Repartitioning," J. Chem. Theory Comput. 11(4), 1864–1874 (2015). DOI: 10.1021/ct5010406
V. Hornak, R. Abel, A. Okur, B. Strockbine, A. Roitberg, and C. Simmerling, "Comparison of multiple Amber force fields and development of improved protein backbone parameters," Proteins 65(3), 712–725 (2006). DOI: 10.1002/prot.21123
K. Lindorff-Larsen, S. Piana, K. Palmo, P. Maragakis, J. L. Klepeis, R. O. Dror, and D. E. Shaw, "Improved side-chain torsion potentials for the Amber ff99SB protein force field," Proteins 78(8), 1950–1958 (2010). DOI: 10.1002/prot.22711
D. Prada-Gracia, J. Gómez-Gardeñes, P. Echenique, and F. Falo, "Exploring the Free Energy Landscape: From Dynamics to Networks and Back," PLoS Comput. Biol. 5(6), e1000415 (2009). DOI: 10.1371/journal.pcbi.1000415
J. Vymětal and J. Vondrášek, "Metadynamics As a Tool for Mapping the Conformational and Free-Energy Space of Peptides: The Alanine Dipeptide Case Study," J. Phys. Chem. B 114(16), 5632–5642 (2010). DOI: 10.1021/jp100950w
F. Nüske, H. Wu, J.-H. Prinz, C. Wehmeyer, C. Clementi, and F. Noé, "Markov state models from short non-equilibrium simulations—Analysis and correction of estimation bias," J. Chem. Phys. 146(9), 094104 (2017). DOI: 10.1063/1.4976518
W. L. Jorgensen, J. Chandrasekhar, J. D. Madura, R. W. Impey, and M. L. Klein, "Comparison of simple potential functions for simulating liquid water," J. Chem. Phys. 79(2), 926–935 (1983). DOI: 10.1063/1.445869
E. Bitzek, P. Koskinen, F. Gähler, M. Moseler, and P. Gumbsch, "Structural Relaxation Made Simple," Phys. Rev. Lett. 97(17), 170201 (2006). DOI: 10.1103/PhysRevLett.97.170201
M. Bernetti and G. Bussi, "Pressure control using stochastic cell rescaling," J. Chem. Phys. 153(11), 114107 (2020). DOI: 10.1063/5.0020514
B. Leimkuhler and C. Matthews, "Rational construction of stochastic numerical methods for molecular sampling," Appl. Math. Res. eXpress 2013(1), 34–56 (2013). DOI: 10.1093/amrx/abs010
J. Fass, D. A. Sivak, G. E. Crooks, K. A. Beauchamp, B. Leimkuhler, and J. D. Chodera, "Quantifying Configuration-Sampling Error in Langevin Simulations of Complex Molecular Systems," Entropy 20(5), 318 (2018). DOI: 10.3390/e20050318