LockstepIntegrator

class openxps.LockstepIntegrator(physical_integrator, extension_integrator=None, assume_force_first=False)[source]

An integrator that advances the physical and extension systems in lockstep.

This class integrates both the physical and extension systems simultaneously, then synchronizes the contexts after each step. It assumes that both integrators apply all forces at the beginning of each time step (a force-first scheme). If either integrator does not follow this scheme, the overall integration will be incorrect.

The step sizes of the physical and extension integrators must be equal.

Parameters:
  • physical_integrator (Integrator) – The integrator for the physical system.

  • extension_integrator (Integrator | None) – The integrator for the extension system. If None, a copy of the physical integrator is used.

  • assume_force_first (bool) – If True, skip the validation that checks whether the integrators are known to follow a force-first scheme. Use this at your own risk if you know your integrators are compatible. Default is False.

Raises:

ValueError – If the physical and extension integrators do not follow a force-first scheme or do not have the same step size.

Example

>>> import openxps as xps
>>> import openmm as mm
>>> from openmm import unit

Using OpenMM’s LangevinMiddleIntegrator integrator (force-first)

>>> integrator = mm.LangevinMiddleIntegrator(
...     300 * unit.kelvin, 1 / unit.picosecond, 1 * unit.femtosecond
... )
>>> xps_integrator = xps.LockstepIntegrator(integrator)
>>> print(xps_integrator.getStepSize())
0.001 ps

Using CSVR integrator with force-first scheme for the extension system

>>> csvr = xps.integrators.CSVRIntegrator(
...     300 * unit.kelvin, 10 / unit.picosecond, 1 * unit.femtosecond,
...     forceFirst=True
... )
>>> xps_integrator_ff = xps.LockstepIntegrator(integrator, csvr)

Methods

step(steps)[source]

Advance the extended phase-space simulation by a specified number of steps.

Parameters:

steps (int) – The number of time steps to advance the simulation.