Unverified Commit cc3c4b54 authored by peastman's avatar peastman Committed by GitHub
Browse files

Merge pull request #2790 from peastman/integratorparams

States can save integrator parameters
parents 03861778 16b6e4aa
......@@ -312,7 +312,7 @@ class Simulation(object):
a File-like object to write the state to, or alternatively a
filename
"""
state = self.context.getState(getPositions=True, getVelocities=True, getParameters=True)
state = self.context.getState(getPositions=True, getVelocities=True, getParameters=True, getIntegratorParameters=True)
xml = mm.XmlSerializer.serialize(state)
if isinstance(file, str):
with open(file, 'w') as f:
......
......@@ -11,7 +11,8 @@
def getState(self, getPositions=False, getVelocities=False,
getForces=False, getEnergy=False, getParameters=False,
getParameterDerivatives=False, enforcePeriodicBox=False, groups=-1):
getParameterDerivatives=False, getIntegratorParameters=False,
enforcePeriodicBox=False, groups=-1):
"""Get a State object recording the current state information stored in this context.
Parameters
......@@ -28,6 +29,8 @@
whether to store context parameters in the State
getParameterDerivatives : bool=False
whether to store parameter derivatives in the State
getIntegratorParameters : bool=False
whether to store integrator parameters in the State
enforcePeriodicBox : bool=False
if false, the position of each particle will be whatever position
is stored in the Context, regardless of periodic boundary conditions.
......@@ -64,6 +67,8 @@
types += State.Parameters
if getParameterDerivatives:
types += State.ParameterDerivatives
if getIntegratorParameters:
types += State.IntegratorParameters
state = _openmm.Context_getState(self, types, enforcePeriodicBox, groups_mask)
return state
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment