Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
8f1f8af4
Commit
8f1f8af4
authored
Apr 15, 2016
by
peastman
Browse files
Serialization works for periodic boundary conditions on bonded forces
parent
0fa56f2e
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
100 additions
and
40 deletions
+100
-40
serialization/src/CMAPTorsionForceProxy.cpp
serialization/src/CMAPTorsionForceProxy.cpp
+7
-3
serialization/src/CustomAngleForceProxy.cpp
serialization/src/CustomAngleForceProxy.cpp
+7
-3
serialization/src/CustomBondForceProxy.cpp
serialization/src/CustomBondForceProxy.cpp
+7
-3
serialization/src/CustomCentroidBondForceProxy.cpp
serialization/src/CustomCentroidBondForceProxy.cpp
+7
-3
serialization/src/CustomCompoundBondForceProxy.cpp
serialization/src/CustomCompoundBondForceProxy.cpp
+7
-3
serialization/src/CustomTorsionForceProxy.cpp
serialization/src/CustomTorsionForceProxy.cpp
+7
-3
serialization/src/HarmonicAngleForceProxy.cpp
serialization/src/HarmonicAngleForceProxy.cpp
+7
-3
serialization/src/HarmonicBondForceProxy.cpp
serialization/src/HarmonicBondForceProxy.cpp
+7
-3
serialization/src/PeriodicTorsionForceProxy.cpp
serialization/src/PeriodicTorsionForceProxy.cpp
+7
-3
serialization/src/RBTorsionForceProxy.cpp
serialization/src/RBTorsionForceProxy.cpp
+7
-3
serialization/tests/TestSerializeCMAPTorsion.cpp
serialization/tests/TestSerializeCMAPTorsion.cpp
+3
-1
serialization/tests/TestSerializeCustomAngleForce.cpp
serialization/tests/TestSerializeCustomAngleForce.cpp
+3
-1
serialization/tests/TestSerializeCustomBondForce.cpp
serialization/tests/TestSerializeCustomBondForce.cpp
+3
-1
serialization/tests/TestSerializeCustomCentroidBondForce.cpp
serialization/tests/TestSerializeCustomCentroidBondForce.cpp
+3
-1
serialization/tests/TestSerializeCustomCompoundBondForce.cpp
serialization/tests/TestSerializeCustomCompoundBondForce.cpp
+3
-1
serialization/tests/TestSerializeCustomTorsionForce.cpp
serialization/tests/TestSerializeCustomTorsionForce.cpp
+3
-1
serialization/tests/TestSerializeHarmonicAngleForce.cpp
serialization/tests/TestSerializeHarmonicAngleForce.cpp
+3
-1
serialization/tests/TestSerializeHarmonicBondForce.cpp
serialization/tests/TestSerializeHarmonicBondForce.cpp
+3
-1
serialization/tests/TestSerializePeriodicTorsionForce.cpp
serialization/tests/TestSerializePeriodicTorsionForce.cpp
+3
-1
serialization/tests/TestSerializeRBTorsionForce.cpp
serialization/tests/TestSerializeRBTorsionForce.cpp
+3
-1
No files found.
serialization/src/CMAPTorsionForceProxy.cpp
View file @
8f1f8af4
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -42,9 +42,10 @@ CMAPTorsionForceProxy::CMAPTorsionForceProxy() : SerializationProxy("CMAPTorsion
}
void
CMAPTorsionForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
node
.
setIntProperty
(
"version"
,
2
);
const
CMAPTorsionForce
&
force
=
*
reinterpret_cast
<
const
CMAPTorsionForce
*>
(
object
);
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
node
.
setBoolProperty
(
"usesPeriodic"
,
force
.
usesPeriodicBoundaryConditions
());
SerializationNode
&
maps
=
node
.
createChildNode
(
"Maps"
);
for
(
int
i
=
0
;
i
<
force
.
getNumMaps
();
i
++
)
{
int
size
;
...
...
@@ -63,11 +64,14 @@ void CMAPTorsionForceProxy::serialize(const void* object, SerializationNode& nod
}
void
*
CMAPTorsionForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
int
version
=
node
.
getIntProperty
(
"version"
);
if
(
version
<
1
||
version
>
2
)
throw
OpenMMException
(
"Unsupported version number"
);
CMAPTorsionForce
*
force
=
new
CMAPTorsionForce
();
try
{
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
if
(
version
>
1
)
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
const
SerializationNode
&
maps
=
node
.
getChildNode
(
"Maps"
);
for
(
int
i
=
0
;
i
<
(
int
)
maps
.
getChildren
().
size
();
i
++
)
{
const
SerializationNode
&
map
=
maps
.
getChildren
()[
i
];
...
...
serialization/src/CustomAngleForceProxy.cpp
View file @
8f1f8af4
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -42,9 +42,10 @@ CustomAngleForceProxy::CustomAngleForceProxy() : SerializationProxy("CustomAngle
}
void
CustomAngleForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
node
.
setIntProperty
(
"version"
,
2
);
const
CustomAngleForce
&
force
=
*
reinterpret_cast
<
const
CustomAngleForce
*>
(
object
);
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
node
.
setBoolProperty
(
"usesPeriodic"
,
force
.
usesPeriodicBoundaryConditions
());
node
.
setStringProperty
(
"energy"
,
force
.
getEnergyFunction
());
SerializationNode
&
perAngleParams
=
node
.
createChildNode
(
"PerAngleParameters"
);
for
(
int
i
=
0
;
i
<
force
.
getNumPerAngleParameters
();
i
++
)
{
...
...
@@ -70,12 +71,15 @@ void CustomAngleForceProxy::serialize(const void* object, SerializationNode& nod
}
void
*
CustomAngleForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
int
version
=
node
.
getIntProperty
(
"version"
);
if
(
version
<
1
||
version
>
2
)
throw
OpenMMException
(
"Unsupported version number"
);
CustomAngleForce
*
force
=
NULL
;
try
{
CustomAngleForce
*
force
=
new
CustomAngleForce
(
node
.
getStringProperty
(
"energy"
));
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
if
(
version
>
1
)
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
const
SerializationNode
&
perAngleParams
=
node
.
getChildNode
(
"PerAngleParameters"
);
for
(
int
i
=
0
;
i
<
(
int
)
perAngleParams
.
getChildren
().
size
();
i
++
)
{
const
SerializationNode
&
parameter
=
perAngleParams
.
getChildren
()[
i
];
...
...
serialization/src/CustomBondForceProxy.cpp
View file @
8f1f8af4
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -42,9 +42,10 @@ CustomBondForceProxy::CustomBondForceProxy() : SerializationProxy("CustomBondFor
}
void
CustomBondForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
node
.
setIntProperty
(
"version"
,
2
);
const
CustomBondForce
&
force
=
*
reinterpret_cast
<
const
CustomBondForce
*>
(
object
);
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
node
.
setBoolProperty
(
"usesPeriodic"
,
force
.
usesPeriodicBoundaryConditions
());
node
.
setStringProperty
(
"energy"
,
force
.
getEnergyFunction
());
SerializationNode
&
perBondParams
=
node
.
createChildNode
(
"PerBondParameters"
);
for
(
int
i
=
0
;
i
<
force
.
getNumPerBondParameters
();
i
++
)
{
...
...
@@ -70,12 +71,15 @@ void CustomBondForceProxy::serialize(const void* object, SerializationNode& node
}
void
*
CustomBondForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
int
version
=
node
.
getIntProperty
(
"version"
);
if
(
version
<
1
||
version
>
2
)
throw
OpenMMException
(
"Unsupported version number"
);
CustomBondForce
*
force
=
NULL
;
try
{
CustomBondForce
*
force
=
new
CustomBondForce
(
node
.
getStringProperty
(
"energy"
));
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
if
(
version
>
1
)
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
const
SerializationNode
&
perBondParams
=
node
.
getChildNode
(
"PerBondParameters"
);
for
(
int
i
=
0
;
i
<
(
int
)
perBondParams
.
getChildren
().
size
();
i
++
)
{
const
SerializationNode
&
parameter
=
perBondParams
.
getChildren
()[
i
];
...
...
serialization/src/CustomCentroidBondForceProxy.cpp
View file @
8f1f8af4
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
5
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -42,9 +42,10 @@ CustomCentroidBondForceProxy::CustomCentroidBondForceProxy() : SerializationProx
}
void
CustomCentroidBondForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
node
.
setIntProperty
(
"version"
,
2
);
const
CustomCentroidBondForce
&
force
=
*
reinterpret_cast
<
const
CustomCentroidBondForce
*>
(
object
);
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
node
.
setBoolProperty
(
"usesPeriodic"
,
force
.
usesPeriodicBoundaryConditions
());
node
.
setIntProperty
(
"groups"
,
force
.
getNumGroupsPerBond
());
node
.
setStringProperty
(
"energy"
,
force
.
getEnergyFunction
());
SerializationNode
&
perBondParams
=
node
.
createChildNode
(
"PerBondParameters"
);
...
...
@@ -93,12 +94,15 @@ void CustomCentroidBondForceProxy::serialize(const void* object, SerializationNo
}
void
*
CustomCentroidBondForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
int
version
=
node
.
getIntProperty
(
"version"
);
if
(
version
<
1
||
version
>
2
)
throw
OpenMMException
(
"Unsupported version number"
);
CustomCentroidBondForce
*
force
=
NULL
;
try
{
CustomCentroidBondForce
*
force
=
new
CustomCentroidBondForce
(
node
.
getIntProperty
(
"groups"
),
node
.
getStringProperty
(
"energy"
));
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
if
(
version
>
1
)
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
const
SerializationNode
&
perBondParams
=
node
.
getChildNode
(
"PerBondParameters"
);
for
(
int
i
=
0
;
i
<
(
int
)
perBondParams
.
getChildren
().
size
();
i
++
)
{
const
SerializationNode
&
parameter
=
perBondParams
.
getChildren
()[
i
];
...
...
serialization/src/CustomCompoundBondForceProxy.cpp
View file @
8f1f8af4
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -42,9 +42,10 @@ CustomCompoundBondForceProxy::CustomCompoundBondForceProxy() : SerializationProx
}
void
CustomCompoundBondForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
node
.
setIntProperty
(
"version"
,
2
);
const
CustomCompoundBondForce
&
force
=
*
reinterpret_cast
<
const
CustomCompoundBondForce
*>
(
object
);
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
node
.
setBoolProperty
(
"usesPeriodic"
,
force
.
usesPeriodicBoundaryConditions
());
node
.
setIntProperty
(
"particles"
,
force
.
getNumParticlesPerBond
());
node
.
setStringProperty
(
"energy"
,
force
.
getEnergyFunction
());
SerializationNode
&
perBondParams
=
node
.
createChildNode
(
"PerBondParameters"
);
...
...
@@ -80,12 +81,15 @@ void CustomCompoundBondForceProxy::serialize(const void* object, SerializationNo
}
void
*
CustomCompoundBondForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
int
version
=
node
.
getIntProperty
(
"version"
);
if
(
version
<
1
||
version
>
2
)
throw
OpenMMException
(
"Unsupported version number"
);
CustomCompoundBondForce
*
force
=
NULL
;
try
{
CustomCompoundBondForce
*
force
=
new
CustomCompoundBondForce
(
node
.
getIntProperty
(
"particles"
),
node
.
getStringProperty
(
"energy"
));
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
if
(
version
>
1
)
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
const
SerializationNode
&
perBondParams
=
node
.
getChildNode
(
"PerBondParameters"
);
for
(
int
i
=
0
;
i
<
(
int
)
perBondParams
.
getChildren
().
size
();
i
++
)
{
const
SerializationNode
&
parameter
=
perBondParams
.
getChildren
()[
i
];
...
...
serialization/src/CustomTorsionForceProxy.cpp
View file @
8f1f8af4
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -42,9 +42,10 @@ CustomTorsionForceProxy::CustomTorsionForceProxy() : SerializationProxy("CustomT
}
void
CustomTorsionForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
node
.
setIntProperty
(
"version"
,
2
);
const
CustomTorsionForce
&
force
=
*
reinterpret_cast
<
const
CustomTorsionForce
*>
(
object
);
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
node
.
setBoolProperty
(
"usesPeriodic"
,
force
.
usesPeriodicBoundaryConditions
());
node
.
setStringProperty
(
"energy"
,
force
.
getEnergyFunction
());
SerializationNode
&
perTorsionParams
=
node
.
createChildNode
(
"PerTorsionParameters"
);
for
(
int
i
=
0
;
i
<
force
.
getNumPerTorsionParameters
();
i
++
)
{
...
...
@@ -70,12 +71,15 @@ void CustomTorsionForceProxy::serialize(const void* object, SerializationNode& n
}
void
*
CustomTorsionForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
int
version
=
node
.
getIntProperty
(
"version"
);
if
(
version
<
1
||
version
>
2
)
throw
OpenMMException
(
"Unsupported version number"
);
CustomTorsionForce
*
force
=
NULL
;
try
{
CustomTorsionForce
*
force
=
new
CustomTorsionForce
(
node
.
getStringProperty
(
"energy"
));
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
if
(
version
>
1
)
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
const
SerializationNode
&
perTorsionParams
=
node
.
getChildNode
(
"PerTorsionParameters"
);
for
(
int
i
=
0
;
i
<
(
int
)
perTorsionParams
.
getChildren
().
size
();
i
++
)
{
const
SerializationNode
&
parameter
=
perTorsionParams
.
getChildren
()[
i
];
...
...
serialization/src/HarmonicAngleForceProxy.cpp
View file @
8f1f8af4
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -42,9 +42,10 @@ HarmonicAngleForceProxy::HarmonicAngleForceProxy() : SerializationProxy("Harmoni
}
void
HarmonicAngleForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
node
.
setIntProperty
(
"version"
,
2
);
const
HarmonicAngleForce
&
force
=
*
reinterpret_cast
<
const
HarmonicAngleForce
*>
(
object
);
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
node
.
setBoolProperty
(
"usesPeriodic"
,
force
.
usesPeriodicBoundaryConditions
());
SerializationNode
&
bonds
=
node
.
createChildNode
(
"Angles"
);
for
(
int
i
=
0
;
i
<
force
.
getNumAngles
();
i
++
)
{
int
particle1
,
particle2
,
particle3
;
...
...
@@ -55,11 +56,14 @@ void HarmonicAngleForceProxy::serialize(const void* object, SerializationNode& n
}
void
*
HarmonicAngleForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
int
version
=
node
.
getIntProperty
(
"version"
);
if
(
version
<
1
||
version
>
2
)
throw
OpenMMException
(
"Unsupported version number"
);
HarmonicAngleForce
*
force
=
new
HarmonicAngleForce
();
try
{
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
if
(
version
>
1
)
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
const
SerializationNode
&
angles
=
node
.
getChildNode
(
"Angles"
);
for
(
int
i
=
0
;
i
<
(
int
)
angles
.
getChildren
().
size
();
i
++
)
{
const
SerializationNode
&
angle
=
angles
.
getChildren
()[
i
];
...
...
serialization/src/HarmonicBondForceProxy.cpp
View file @
8f1f8af4
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -42,9 +42,10 @@ HarmonicBondForceProxy::HarmonicBondForceProxy() : SerializationProxy("HarmonicB
}
void
HarmonicBondForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
node
.
setIntProperty
(
"version"
,
2
);
const
HarmonicBondForce
&
force
=
*
reinterpret_cast
<
const
HarmonicBondForce
*>
(
object
);
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
node
.
setBoolProperty
(
"usesPeriodic"
,
force
.
usesPeriodicBoundaryConditions
());
SerializationNode
&
bonds
=
node
.
createChildNode
(
"Bonds"
);
for
(
int
i
=
0
;
i
<
force
.
getNumBonds
();
i
++
)
{
int
particle1
,
particle2
;
...
...
@@ -55,11 +56,14 @@ void HarmonicBondForceProxy::serialize(const void* object, SerializationNode& no
}
void
*
HarmonicBondForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
int
version
=
node
.
getIntProperty
(
"version"
);
if
(
version
<
1
||
version
>
2
)
throw
OpenMMException
(
"Unsupported version number"
);
HarmonicBondForce
*
force
=
new
HarmonicBondForce
();
try
{
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
if
(
version
>
1
)
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
const
SerializationNode
&
bonds
=
node
.
getChildNode
(
"Bonds"
);
for
(
int
i
=
0
;
i
<
(
int
)
bonds
.
getChildren
().
size
();
i
++
)
{
const
SerializationNode
&
bond
=
bonds
.
getChildren
()[
i
];
...
...
serialization/src/PeriodicTorsionForceProxy.cpp
View file @
8f1f8af4
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -42,9 +42,10 @@ PeriodicTorsionForceProxy::PeriodicTorsionForceProxy() : SerializationProxy("Per
}
void
PeriodicTorsionForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
node
.
setIntProperty
(
"version"
,
2
);
const
PeriodicTorsionForce
&
force
=
*
reinterpret_cast
<
const
PeriodicTorsionForce
*>
(
object
);
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
node
.
setBoolProperty
(
"usesPeriodic"
,
force
.
usesPeriodicBoundaryConditions
());
SerializationNode
&
torsions
=
node
.
createChildNode
(
"Torsions"
);
for
(
int
i
=
0
;
i
<
force
.
getNumTorsions
();
i
++
)
{
int
particle1
,
particle2
,
particle3
,
particle4
,
periodicity
;
...
...
@@ -55,11 +56,14 @@ void PeriodicTorsionForceProxy::serialize(const void* object, SerializationNode&
}
void
*
PeriodicTorsionForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
int
version
=
node
.
getIntProperty
(
"version"
);
if
(
version
<
1
||
version
>
2
)
throw
OpenMMException
(
"Unsupported version number"
);
PeriodicTorsionForce
*
force
=
new
PeriodicTorsionForce
();
try
{
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
if
(
version
>
1
)
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
const
SerializationNode
&
torsions
=
node
.
getChildNode
(
"Torsions"
);
for
(
int
i
=
0
;
i
<
(
int
)
torsions
.
getChildren
().
size
();
i
++
)
{
const
SerializationNode
&
torsion
=
torsions
.
getChildren
()[
i
];
...
...
serialization/src/RBTorsionForceProxy.cpp
View file @
8f1f8af4
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -42,9 +42,10 @@ RBTorsionForceProxy::RBTorsionForceProxy() : SerializationProxy("RBTorsionForce"
}
void
RBTorsionForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
node
.
setIntProperty
(
"version"
,
2
);
const
RBTorsionForce
&
force
=
*
reinterpret_cast
<
const
RBTorsionForce
*>
(
object
);
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
node
.
setBoolProperty
(
"usesPeriodic"
,
force
.
usesPeriodicBoundaryConditions
());
SerializationNode
&
torsions
=
node
.
createChildNode
(
"Torsions"
);
for
(
int
i
=
0
;
i
<
force
.
getNumTorsions
();
i
++
)
{
int
particle1
,
particle2
,
particle3
,
particle4
;
...
...
@@ -55,11 +56,14 @@ void RBTorsionForceProxy::serialize(const void* object, SerializationNode& node)
}
void
*
RBTorsionForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
int
version
=
node
.
getIntProperty
(
"version"
);
if
(
version
<
1
||
version
>
2
)
throw
OpenMMException
(
"Unsupported version number"
);
RBTorsionForce
*
force
=
new
RBTorsionForce
();
try
{
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
if
(
version
>
1
)
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
const
SerializationNode
&
torsions
=
node
.
getChildNode
(
"Torsions"
);
for
(
int
i
=
0
;
i
<
(
int
)
torsions
.
getChildren
().
size
();
i
++
)
{
const
SerializationNode
&
torsion
=
torsions
.
getChildren
()[
i
];
...
...
serialization/tests/TestSerializeCMAPTorsion.cpp
View file @
8f1f8af4
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -55,6 +55,7 @@ void testSerialization() {
force
.
addTorsion
(
0
,
0
,
2
,
3
,
4
,
5
,
6
,
7
,
8
);
force
.
addTorsion
(
1
,
2
,
3
,
4
,
7
,
1
,
2
,
3
,
4
);
force
.
addTorsion
(
1
,
5
,
1
,
2
,
3
,
2
,
3
,
4
,
8
);
force
.
setUsesPeriodicBoundaryConditions
(
true
);
// Serialize and then deserialize it.
...
...
@@ -66,6 +67,7 @@ void testSerialization() {
CMAPTorsionForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
usesPeriodicBoundaryConditions
(),
force2
.
usesPeriodicBoundaryConditions
());
ASSERT_EQUAL
(
force
.
getNumMaps
(),
force2
.
getNumMaps
());
for
(
int
i
=
0
;
i
<
force
.
getNumMaps
();
i
++
)
{
int
size1
,
size2
;
...
...
serialization/tests/TestSerializeCustomAngleForce.cpp
View file @
8f1f8af4
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -53,6 +53,7 @@ void testSerialization() {
force
.
addAngle
(
4
,
0
,
1
,
params
);
params
[
0
]
=
2.1
;
force
.
addAngle
(
3
,
7
,
6
,
params
);
force
.
setUsesPeriodicBoundaryConditions
(
true
);
// Serialize and then deserialize it.
...
...
@@ -73,6 +74,7 @@ void testSerialization() {
ASSERT_EQUAL
(
force
.
getGlobalParameterName
(
i
),
force2
.
getGlobalParameterName
(
i
));
ASSERT_EQUAL
(
force
.
getGlobalParameterDefaultValue
(
i
),
force2
.
getGlobalParameterDefaultValue
(
i
));
}
ASSERT_EQUAL
(
force
.
usesPeriodicBoundaryConditions
(),
force2
.
usesPeriodicBoundaryConditions
());
ASSERT_EQUAL
(
force
.
getNumAngles
(),
force2
.
getNumAngles
());
for
(
int
i
=
0
;
i
<
force
.
getNumAngles
();
i
++
)
{
int
a1
,
a2
,
b1
,
b2
,
c1
,
c2
;
...
...
serialization/tests/TestSerializeCustomBondForce.cpp
View file @
8f1f8af4
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -53,6 +53,7 @@ void testSerialization() {
force
.
addBond
(
4
,
0
,
params
);
params
[
0
]
=
2.1
;
force
.
addBond
(
3
,
7
,
params
);
force
.
setUsesPeriodicBoundaryConditions
(
true
);
// Serialize and then deserialize it.
...
...
@@ -73,6 +74,7 @@ void testSerialization() {
ASSERT_EQUAL
(
force
.
getGlobalParameterName
(
i
),
force2
.
getGlobalParameterName
(
i
));
ASSERT_EQUAL
(
force
.
getGlobalParameterDefaultValue
(
i
),
force2
.
getGlobalParameterDefaultValue
(
i
));
}
ASSERT_EQUAL
(
force
.
usesPeriodicBoundaryConditions
(),
force2
.
usesPeriodicBoundaryConditions
());
ASSERT_EQUAL
(
force
.
getNumBonds
(),
force2
.
getNumBonds
());
for
(
int
i
=
0
;
i
<
force
.
getNumBonds
();
i
++
)
{
int
a1
,
a2
,
b1
,
b2
;
...
...
serialization/tests/TestSerializeCustomCentroidBondForce.cpp
View file @
8f1f8af4
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
5
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -77,6 +77,7 @@ void testSerialization() {
for
(
int
i
=
0
;
i
<
10
;
i
++
)
values
[
i
]
=
sin
((
double
)
i
);
force
.
addTabulatedFunction
(
"f"
,
new
Continuous1DFunction
(
values
,
0.5
,
1.5
));
force
.
setUsesPeriodicBoundaryConditions
(
true
);
// Serialize and then deserialize it.
...
...
@@ -98,6 +99,7 @@ void testSerialization() {
ASSERT_EQUAL
(
force
.
getGlobalParameterName
(
i
),
force2
.
getGlobalParameterName
(
i
));
ASSERT_EQUAL
(
force
.
getGlobalParameterDefaultValue
(
i
),
force2
.
getGlobalParameterDefaultValue
(
i
));
}
ASSERT_EQUAL
(
force
.
usesPeriodicBoundaryConditions
(),
force2
.
usesPeriodicBoundaryConditions
());
ASSERT_EQUAL
(
force
.
getNumGroups
(),
force2
.
getNumGroups
());
for
(
int
i
=
0
;
i
<
force
.
getNumGroups
();
i
++
)
{
vector
<
int
>
particles1
,
particles2
;
...
...
serialization/tests/TestSerializeCustomCompoundBondForce.cpp
View file @
8f1f8af4
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -67,6 +67,7 @@ void testSerialization() {
for
(
int
i
=
0
;
i
<
10
;
i
++
)
values
[
i
]
=
sin
((
double
)
i
);
force
.
addTabulatedFunction
(
"f"
,
new
Continuous1DFunction
(
values
,
0.5
,
1.5
));
force
.
setUsesPeriodicBoundaryConditions
(
true
);
// Serialize and then deserialize it.
...
...
@@ -88,6 +89,7 @@ void testSerialization() {
ASSERT_EQUAL
(
force
.
getGlobalParameterName
(
i
),
force2
.
getGlobalParameterName
(
i
));
ASSERT_EQUAL
(
force
.
getGlobalParameterDefaultValue
(
i
),
force2
.
getGlobalParameterDefaultValue
(
i
));
}
ASSERT_EQUAL
(
force
.
usesPeriodicBoundaryConditions
(),
force2
.
usesPeriodicBoundaryConditions
());
ASSERT_EQUAL
(
force
.
getNumBonds
(),
force2
.
getNumBonds
());
for
(
int
i
=
0
;
i
<
force
.
getNumBonds
();
i
++
)
{
vector
<
int
>
particles1
,
particles2
;
...
...
serialization/tests/TestSerializeCustomTorsionForce.cpp
View file @
8f1f8af4
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -53,6 +53,7 @@ void testSerialization() {
force
.
addTorsion
(
4
,
0
,
1
,
5
,
params
);
params
[
0
]
=
2.1
;
force
.
addTorsion
(
3
,
7
,
6
,
8
,
params
);
force
.
setUsesPeriodicBoundaryConditions
(
true
);
// Serialize and then deserialize it.
...
...
@@ -73,6 +74,7 @@ void testSerialization() {
ASSERT_EQUAL
(
force
.
getGlobalParameterName
(
i
),
force2
.
getGlobalParameterName
(
i
));
ASSERT_EQUAL
(
force
.
getGlobalParameterDefaultValue
(
i
),
force2
.
getGlobalParameterDefaultValue
(
i
));
}
ASSERT_EQUAL
(
force
.
usesPeriodicBoundaryConditions
(),
force2
.
usesPeriodicBoundaryConditions
());
ASSERT_EQUAL
(
force
.
getNumTorsions
(),
force2
.
getNumTorsions
());
for
(
int
i
=
0
;
i
<
force
.
getNumTorsions
();
i
++
)
{
int
a1
,
a2
,
b1
,
b2
,
c1
,
c2
,
d1
,
d2
;
...
...
serialization/tests/TestSerializeHarmonicAngleForce.cpp
View file @
8f1f8af4
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -47,6 +47,7 @@ void testSerialization() {
force
.
addAngle
(
0
,
2
,
3
,
2.0
,
2.1
);
force
.
addAngle
(
2
,
3
,
4
,
3.0
,
2.2
);
force
.
addAngle
(
5
,
1
,
2
,
4.0
,
2.3
);
force
.
setUsesPeriodicBoundaryConditions
(
true
);
// Serialize and then deserialize it.
...
...
@@ -58,6 +59,7 @@ void testSerialization() {
HarmonicAngleForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
usesPeriodicBoundaryConditions
(),
force2
.
usesPeriodicBoundaryConditions
());
ASSERT_EQUAL
(
force
.
getNumAngles
(),
force2
.
getNumAngles
());
for
(
int
i
=
0
;
i
<
force
.
getNumAngles
();
i
++
)
{
int
a1
,
a2
,
a3
,
b1
,
b2
,
b3
;
...
...
serialization/tests/TestSerializeHarmonicBondForce.cpp
View file @
8f1f8af4
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -47,6 +47,7 @@ void testSerialization() {
force
.
addBond
(
0
,
2
,
2.0
,
2.1
);
force
.
addBond
(
2
,
3
,
3.0
,
2.2
);
force
.
addBond
(
5
,
1
,
4.0
,
2.3
);
force
.
setUsesPeriodicBoundaryConditions
(
true
);
// Serialize and then deserialize it.
...
...
@@ -58,6 +59,7 @@ void testSerialization() {
HarmonicBondForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
usesPeriodicBoundaryConditions
(),
force2
.
usesPeriodicBoundaryConditions
());
ASSERT_EQUAL
(
force
.
getNumBonds
(),
force2
.
getNumBonds
());
for
(
int
i
=
0
;
i
<
force
.
getNumBonds
();
i
++
)
{
int
a1
,
a2
,
b1
,
b2
;
...
...
serialization/tests/TestSerializePeriodicTorsionForce.cpp
View file @
8f1f8af4
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -47,6 +47,7 @@ void testSerialization() {
force
.
addTorsion
(
0
,
2
,
3
,
4
,
2
,
2.0
,
2.1
);
force
.
addTorsion
(
2
,
3
,
4
,
7
,
1
,
3.0
,
2.2
);
force
.
addTorsion
(
5
,
1
,
2
,
3
,
3
,
4.0
,
2.3
);
force
.
setUsesPeriodicBoundaryConditions
(
true
);
// Serialize and then deserialize it.
...
...
@@ -58,6 +59,7 @@ void testSerialization() {
PeriodicTorsionForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
usesPeriodicBoundaryConditions
(),
force2
.
usesPeriodicBoundaryConditions
());
ASSERT_EQUAL
(
force
.
getNumTorsions
(),
force2
.
getNumTorsions
());
for
(
int
i
=
0
;
i
<
force
.
getNumTorsions
();
i
++
)
{
int
a1
,
a2
,
a3
,
a4
,
b1
,
b2
,
b3
,
b4
,
perioda
,
periodb
;
...
...
serialization/tests/TestSerializeRBTorsionForce.cpp
View file @
8f1f8af4
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -46,6 +46,7 @@ void testSerialization() {
force
.
addTorsion
(
0
,
1
,
2
,
3
,
0.1
,
0.2
,
0.3
,
0.4
,
0.5
,
0.6
);
force
.
addTorsion
(
0
,
2
,
3
,
4
,
0.2
,
0.3
,
0.4
,
0.5
,
0.6
,
0.7
);
force
.
addTorsion
(
2
,
3
,
4
,
7
,
-
1
,
-
2
,
-
3
,
1.1
,
2.2
,
3.3
);
force
.
setUsesPeriodicBoundaryConditions
(
true
);
// Serialize and then deserialize it.
...
...
@@ -57,6 +58,7 @@ void testSerialization() {
RBTorsionForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
usesPeriodicBoundaryConditions
(),
force2
.
usesPeriodicBoundaryConditions
());
ASSERT_EQUAL
(
force
.
getNumTorsions
(),
force2
.
getNumTorsions
());
for
(
int
i
=
0
;
i
<
force
.
getNumTorsions
();
i
++
)
{
int
a1
,
a2
,
a3
,
a4
,
b1
,
b2
,
b3
,
b4
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment