Skip to content
Prev Previous commit
Next Next commit
copy openmmtools dicts when deserializing
  • Loading branch information
dwhswenson committed Aug 2, 2021
commit c2b51a51eeb48f1533b0be715c5ca074ea412b8f
5 changes: 4 additions & 1 deletion openpathsampling/engines/openmm/mcengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@ def to_dict(self):

@classmethod
def from_dict(cls, dct):
deserialize = openmmtools.utils.deserialize
# deserialize = openmmtools.utils.deserialize
def deserialize(entry):
entry = copy.copy(entry)
return openmmtools.utils.deserialize(entry)
dct['thermodynamic_state'] = deserialize(dct['thermodynamic_state'])
dct['move'] = deserialize(dct['move'])
return cls(**dct)
Expand Down
2 changes: 0 additions & 2 deletions openpathsampling/tests/test_openmm_mcengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@ def test_serialization_cycle(self, mcengine):
serialized = mcengine.to_dict()
deserialized = mcengine.__class__.from_dict(copy.copy(serialized))
reserialized = deserialized.to_dict()
pytest.skip()
# this assertion currently fails: see choderalab/openmmtools#517
assert serialized == reserialized

def test_mdtraj_topology_error(self, mcengine):
Expand Down