Commit 1006797b authored by John Chodera (MSKCC)'s avatar John Chodera (MSKCC)
Browse files

Force objects can now be pickled/unpickled

parent cad8d293
...@@ -450,6 +450,14 @@ Parameters: ...@@ -450,6 +450,14 @@ Parameters:
%extend OpenMM::Force { %extend OpenMM::Force {
%pythoncode %{ %pythoncode %{
def __getstate__(self):
serializationString = XmlSerializer.serialize(self)
return serializationString
def __setstate__(self, serializationString):
system = XmlSerializer.deserialize(serializationString)
self.this = system.this
def __copy__(self): def __copy__(self):
copy = self.__class__.__new__(self.__class__) copy = self.__class__.__new__(self.__class__)
copy.__init__(self) copy.__init__(self)
......
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