"platforms/vscode:/vscode.git/clone" did not exist on "ff88ddadca8ed8a67946efda9550253745401fe4"
Commit 0665e20b authored by Peter Eastman's avatar Peter Eastman
Browse files

Fixed bugs in serializing State from Python

parent 282c6f2c
...@@ -338,6 +338,7 @@ Parameters: ...@@ -338,6 +338,7 @@ Parameters:
forces = [] forces = []
kineticEnergy = 0.0 kineticEnergy = 0.0
potentialEnergy = 0.0 potentialEnergy = 0.0
params = {}
types = 0 types = 0
try: try:
positions = pythonState.getPositions().value_in_unit(unit.nanometers) positions = pythonState.getPositions().value_in_unit(unit.nanometers)
......
...@@ -192,6 +192,8 @@ class State(_object): ...@@ -192,6 +192,8 @@ class State(_object):
See the following for details: See the following for details:
https://simtk.org/home/python_units https://simtk.org/home/python_units
""" """
if self._eK0 is None:
raise TypeError('Energy was not requested in getState() call, so it is not available.')
return self._eK0 * unit.kilojoule_per_mole return self._eK0 * unit.kilojoule_per_mole
def getPotentialEnergy(self): def getPotentialEnergy(self):
...@@ -201,11 +203,15 @@ class State(_object): ...@@ -201,11 +203,15 @@ class State(_object):
See the following for details: See the following for details:
https://simtk.org/home/python_units https://simtk.org/home/python_units
""" """
if self._eP0 is None:
raise TypeError('Energy was not requested in getState() call, so it is not available.')
return self._eP0 * unit.kilojoule_per_mole return self._eP0 * unit.kilojoule_per_mole
def getParameters(self): def getParameters(self):
"""Get a map containing the values of all parameters. """Get a map containing the values of all parameters.
""" """
if self._paramMap is None:
raise TypeError('Parameters were not requested in getState() call, so are not available.')
return self._paramMap return self._paramMap
......
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