SplitIntegrator¶
- class openxps.SplitIntegrator(physical_integrator, extension_integrator=None, assume_symmetric=False)[source]¶
An integrator that advances the physical and extension systems using an operator splitting scheme.
This integrator assumes that the physical and extension integrators are symmetric in terms of operator splitting, i.e., they can be represented as a palindromic sequence of operations. If either integrator does not follow this scheme, the overall integration scheme will be incorrect.
The step sizes of the physical and extension integrators must be related by an even integer ratio, with either the physical or extension integrator having the larger step size.
This class integrates the physical and extension systems in a \(B^n A B^n\) pattern, where \(n\) is the number of substeps, \(A\) is the integrator with the larger step size \(\Delta t\) (considered as the overall step size), and \(B\) is the integrator with the smaller step size \(\Delta t/(2n)\).
- 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 with half the step size of the physical integrator.
assume_symmetric (bool) – If True, skip the validation that checks whether the integrators are known to be symmetric in terms of operator splitting. Use this at your own risk if you know your integrators are compatible but are not in the known list. Default is False.
- Raises:
ValueError – If the physical and extension integrators are not symmetric in terms of operator splitting, or do not have a step size ratio equal to an even integer number.
Example
>>> import openxps as xps >>> import openmm as mm >>> from openmm import unit
Using symmetric Verlet integrator with half step size
>>> integrator = xps.integrators.SymmetricVerletIntegrator(4 * unit.femtosecond) >>> xps_integrator = xps.SplitIntegrator(integrator) >>> print(xps_integrator.getStepSize()) 0.004 ps >>> xps_integrator.getNumSubsteps() 1
Using symmetric Langevin integrator with 4:1 step size ratio
>>> physical = xps.integrators.SymmetricLangevinIntegrator( ... 300 * unit.kelvin, 1 / unit.picosecond, 4 * unit.femtosecond ... ) >>> extension = xps.integrators.SymmetricLangevinIntegrator( ... 300 * unit.kelvin, 1 / unit.picosecond, 1 * unit.femtosecond ... ) >>> xps_integrator = xps.SplitIntegrator(physical, extension) >>> print(xps_integrator.getStepSize()) 0.004 ps >>> xps_integrator.getNumSubsteps() 2
Using symmetric Langevin integrator with 1:4 step size ratio
>>> physical = xps.integrators.SymmetricLangevinIntegrator( ... 300 * unit.kelvin, 1 / unit.picosecond, 2 * unit.femtosecond ... ) >>> extension = xps.integrators.SymmetricLangevinIntegrator( ... 300 * unit.kelvin, 1 / unit.picosecond, 8 * unit.femtosecond ... ) >>> xps_integrator = xps.SplitIntegrator(physical, extension) >>> print(xps_integrator.getStepSize()) 0.008 ps >>> xps_integrator.getNumSubsteps() 2
Methods
- configure(physical_context, extension_context, coupling)[source]¶
Configure the integrator.
Store pointers to the given contexts, dynamical variables, and coupling potential in the integrator. This allows the integrator to update the contexts during the simulation.
- Parameters:
physical_context (Context) – The OpenMM context containing the physical system.
extension_context (Context) – The OpenMM context containing the extension system.
coupling (Coupling) – The potential that couples the physical and dynamical variables.