OpenMM
|
A State object records a snapshot of the current state of a simulation at a point in time. More...
Inherits _object.
Public Member Functions | |
def | __init__ |
def | __getstate__ |
def | __setstate__ |
def | getTime |
Get the time for which this State was created. | |
def | getPeriodicBoxVectors |
Get the three periodic box vectors if this state is from a simulation using PBC . | |
def | getPeriodicBoxVolume |
Get the volume of the periodic box. | |
def | getPositions |
Get the position of each particle with units. | |
def | getVelocities |
Get the velocity of each particle with units. | |
def | getForces |
Get the force acting on each particle with units. | |
def | getKineticEnergy |
Get the total kinetic energy of the system with units. | |
def | getPotentialEnergy |
Get the total potential energy of the system with units. | |
def | getParameters |
Get a map containing the values of all parameters. | |
A State object records a snapshot of the current state of a simulation at a point in time.
You create it by calling getState() on a Context.
When a State is created, you specify what information should be stored in it. This saves time and memory by only copying in the information that you actually want. This is especially important for forces and energies, since they may need to be calculated. If you query a State object for a piece of information which is not available (because it was not requested when the State was created), it will return None.
In general return values are Python Units (https://simtk.org/home/python_units). Among other things Python Units provides a container class, Quantity, which holds a value and a representation of the value's unit. Values can be integers, floats, lists, numarrays, etc. Quantity objects can be used in arithmetic operation just like number, except they also keep track of units. To extract the value from a quantity, us the value_in_unit() method. For example, to extract the value from a length quantity, in units of nanometers, do the following: myLengthQuantity.value_in_unit(unit.nanometer)
def __init__ | ( | self, | |
simTime = None , |
|||
energy = None , |
|||
coordList = None , |
|||
velList = None , |
|||
forceList = None , |
|||
periodicBoxVectorsList = None , |
|||
paramMap = None |
|||
) |
def __getstate__ | ( | self | ) |
def __setstate__ | ( | self, | |
serializationString | |||
) |
def getForces | ( | self, | |
asNumpy = False |
|||
) |
Get the force acting on each particle with units.
Raises an exception if forces where not requested in the context.getState() call. Returns a list of tuples, unless asNumpy is True, in which case a Numpy array of arrays will be returned. To remove the units, you can divide the return value by unit.kilojoule_per_mole/unit.angstrom or unit.calorie_per_mole/unit.nanometer, etc. See the following for details: https://simtk.org/home/python_units
def getKineticEnergy | ( | self | ) |
Get the total kinetic energy of the system with units.
To remove the units, you can divide the return value by unit.kilojoule_per_mole or unit.calorie_per_mole, etc. See the following for details: https://simtk.org/home/python_units
def getParameters | ( | self | ) |
Get a map containing the values of all parameters.
def getPeriodicBoxVectors | ( | self, | |
asNumpy = False |
|||
) |
Get the three periodic box vectors if this state is from a simulation using PBC .
def getPeriodicBoxVolume | ( | self | ) |
Get the volume of the periodic box.
def getPositions | ( | self, | |
asNumpy = False |
|||
) |
Get the position of each particle with units.
Raises an exception if postions where not requested in the context.getState() call. Returns a list of tuples, unless asNumpy is True, in which case a Numpy array of arrays will be returned. To remove the units, divide return value by unit.angstrom or unit.nanometer. See the following for details: https://simtk.org/home/python_units
def getPotentialEnergy | ( | self | ) |
Get the total potential energy of the system with units.
To remove the units, you can divide the return value by unit.kilojoule_per_mole or unit.kilocalorie_per_mole, etc. See the following for details: https://simtk.org/home/python_units
def getTime | ( | self | ) |
Get the time for which this State was created.
def getVelocities | ( | self, | |
asNumpy = False |
|||
) |
Get the velocity of each particle with units.
Raises an exception if velocities where not requested in the context.getState() call. Returns a list of tuples, unless asNumpy is True, in which case a Numpy array of arrays will be returned. To remove the units, you can divide the return value by unit.angstrom/unit.picosecond or unit.meter/unit.second, etc. See the following for details: https://simtk.org/home/python_units