Skip to content

Dynamics ​

Choose a ParticleDynamics.Method for the physical ensemble and a scheme for the numerical integration. Integrator combines them with your forces, optional Constraints (including FreezeGroup), optional Barostat, and timestep.

DynamicsMethodScheme
Microcanonical MD (NVE)ConstantVolume(all)VelocityVerlet()
Thermostatted MD (NVT)ConstantVolume(all; thermostat=CSVR(...)) or NoseHooverChain(...)VelocityVerlet()
Langevin dynamicsLangevin(all; gamma=1.0, kT=1.0) (or friction_rate= / tau=)BAOAB(), BAOABFast(), VelocityVerlet(), BAOA(), or GSM()
Overdamped Brownian dynamicsBrownian(all; gamma=1.0, kT=1.0)EulerMaruyama() or EulerHeun()
Active Ornstein–UhlenbeckActiveOrnsteinUhlenbeck(all; gamma=..., tau=..., noise_scale=...)EulerMaruyama() or EulerHeun() (or paired with Langevin)

Here all = Group(:all, AllSelection()), and kT is an energy in your chosen units.

Molecular and Langevin dynamics ​

For pure microcanonical NVE, provide initial velocities on your ParticleSystem and leave ConstantVolume without a thermostat:

julia
integrator = Integrator(
    dt=0.002,
    scheme=VelocityVerlet(),
    forces=[LennardJones(epsilon=1.0, sigma=1.0, cutoff=2.5)],
    methods=[ConstantVolume(all)],
)

For Langevin dynamics, choose a splitting scheme:

  • BAOAB(; track_thermo=true): Leimkuhler–Matthews Langevin Middle splitting with superior configurational sampling accuracy at large timesteps.

  • BAOABFast(): shorthand for BAOAB(track_thermo=false), skipping per-step dU/dq bath-exchange tracking for maximum GPU throughput when BathExchangeObservable is not needed.

  • VelocityVerlet: Grønbech-Jensen/Farago Langevin integrator when paired with Langevin.

  • BAOA and GSM: alternative Langevin splittings.

For constrained biomolecular systems (rigid TIP3P/SPC water via RigidWaterConstraint + solute X–Hₙ ConstraintClusters via HBondConstraints or ConstraintClusterSpec), BAOAB, BAOABFast, CSVR, and NVE run inside the fused GPU rigid-water integrator with closed-form Miyamoto–Kollman :df64 SETTLE/RATTLE and exact Leimkuhler–Matthews constrained-BAOAB velocity projections (B2 + RATTLE → B1 + RATTLE → O + RATTLE → A1 + A2 + SHAKE), overlapping rigid-water and solute constraint branches inside flat CUDA graphs and supporting 4 fs timesteps with hydrogen mass repartitioning (HMR) and uniform friction_rate / tau coupling. Across plain un-sampled intervals, run! (and low-level step_many!) automatically launches K-step batched CUDA graphs with parity relative to single-step execution. For charged/LJPME runs, opt-in symplectic reciprocal-space BAOAB-RESPA is also available via respa_engine_config and check_respa_stability (see Electrostatics). See Holonomic constraints and HMR.

For NVT thermostats, see Temperature control. For NPT, see Constant-pressure NPT.

Brownian dynamics ​

Use an overdamped method when inertia is not part of your model:

julia
integrator = Integrator(
    dt=0.00025,
    scheme=EulerMaruyama(),
    forces=[WCA(epsilon=10.0, sigma=1.0)],
    methods=[Brownian(all; gamma=10.0, kT=1.0)],
)

Use EulerMaruyama for standard explicit Brownian steps or EulerHeun for midpoint Stratonovich-consistent stepping. Friction gamma must be strictly positive on stochastic paths that divide by it.

Active forcing ​

ActiveOrnsteinUhlenbeck adds a correlated stochastic force with finite persistence time tau. Thermal white noise is specified separately through Brownian or Langevin, so both methods can act on the same group:

julia
methods = [
    Brownian(all; gamma=10.0, kT=1.0),
    ActiveOrnsteinUhlenbeck(all; gamma=10.0, tau=1.0, noise_scale=1.0),
]

noise_scale is the stationary standard deviation of the OU impulse (not a bath temperature). For a multi-exponential correlation spectrum, pass spectrum=OUSpectrum(taus, scales) (see OUSpectrum). The active-particle examples include free-particle MSD verification scripts.

Freezing and position restraints ​

Use FreezeGroup inside Integrator(...; constraints=[...]) (or freeze=...) to hold a particle subset fixed or tether it harmonically to its anchor coordinates:

julia
wall = Group(:wall, TypeSelection(:W))
integrator = Integrator(
    dt=0.002,
    scheme=BAOABFast(),
    forces=[LennardJones(epsilon=1.0, sigma=1.0, cutoff=2.5)],
    methods=[Langevin(all; gamma=1.0, kT=1.0)],
    constraints=[
        FreezeGroup(wall; mode=:hold),                          # hard clamp + zero velocity
        # or FreezeGroup(wall; mode=:spring, k=500.0, steps=1_000, include_energy=true)
    ],
)
  • mode=:hold: clamps positions to anchors, zeroes velocities, and deducts held particles from kinetic degrees of freedom in temperature and thermostat calculations.

  • mode=:spring: adds a harmonic tether ½ k |r − r₀|² (k > 0), optionally active for steps steps and optionally included in Epot (include_energy=true).

Choose and change a timestep ​

Timesteps must be finite and positive. Start conservatively, then compare runs at smaller timesteps using energy conservation, structural observables, or transport coefficients appropriate to your system.

A Stage can override the configured timestep, for example during warmup:

julia
run!(sim, Stage(:warmup, steps=1_000; dt=0.0001))
run!(sim, Stage(:production, steps=10_000))

If you replace sim.integrator, call prepare!(sim) before continuing. Changing stochastic settings rebuilds stochastic workspaces; a continued run does not replay an uninterrupted noise realization. On the low-level stepping API, stochastic specs enforce strict timestep equality with their constructor dt (see SimulationCore & Low-Level API).

Full constructor arguments are documented in the Workflow API reference.

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