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
4c6cf680
Unverified
Commit
4c6cf680
authored
Mar 10, 2021
by
Peter Eastman
Committed by
GitHub
Mar 10, 2021
Browse files
Added name property to Forces (#3049)
parent
7c2e5991
Changes
67
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
40 additions
and
0 deletions
+40
-0
serialization/src/RMSDForceProxy.cpp
serialization/src/RMSDForceProxy.cpp
+2
-0
serialization/tests/TestSerializeAndersenThermostat.cpp
serialization/tests/TestSerializeAndersenThermostat.cpp
+2
-0
serialization/tests/TestSerializeCMAPTorsion.cpp
serialization/tests/TestSerializeCMAPTorsion.cpp
+2
-0
serialization/tests/TestSerializeCMMotionRemover.cpp
serialization/tests/TestSerializeCMMotionRemover.cpp
+2
-0
serialization/tests/TestSerializeCustomAngleForce.cpp
serialization/tests/TestSerializeCustomAngleForce.cpp
+2
-0
serialization/tests/TestSerializeCustomBondForce.cpp
serialization/tests/TestSerializeCustomBondForce.cpp
+2
-0
serialization/tests/TestSerializeCustomCVForce.cpp
serialization/tests/TestSerializeCustomCVForce.cpp
+2
-0
serialization/tests/TestSerializeCustomCentroidBondForce.cpp
serialization/tests/TestSerializeCustomCentroidBondForce.cpp
+2
-0
serialization/tests/TestSerializeCustomCompoundBondForce.cpp
serialization/tests/TestSerializeCustomCompoundBondForce.cpp
+2
-0
serialization/tests/TestSerializeCustomExternalForce.cpp
serialization/tests/TestSerializeCustomExternalForce.cpp
+2
-0
serialization/tests/TestSerializeCustomGBForce.cpp
serialization/tests/TestSerializeCustomGBForce.cpp
+2
-0
serialization/tests/TestSerializeCustomHbondForce.cpp
serialization/tests/TestSerializeCustomHbondForce.cpp
+2
-0
serialization/tests/TestSerializeCustomManyParticleForce.cpp
serialization/tests/TestSerializeCustomManyParticleForce.cpp
+2
-0
serialization/tests/TestSerializeCustomNonbondedForce.cpp
serialization/tests/TestSerializeCustomNonbondedForce.cpp
+2
-0
serialization/tests/TestSerializeCustomTorsionForce.cpp
serialization/tests/TestSerializeCustomTorsionForce.cpp
+2
-0
serialization/tests/TestSerializeGBSAOBCForce.cpp
serialization/tests/TestSerializeGBSAOBCForce.cpp
+2
-0
serialization/tests/TestSerializeGayBerneForce.cpp
serialization/tests/TestSerializeGayBerneForce.cpp
+2
-0
serialization/tests/TestSerializeHarmonicAngleForce.cpp
serialization/tests/TestSerializeHarmonicAngleForce.cpp
+2
-0
serialization/tests/TestSerializeHarmonicBondForce.cpp
serialization/tests/TestSerializeHarmonicBondForce.cpp
+2
-0
serialization/tests/TestSerializeMonteCarloAnisotropicBarostat.cpp
...tion/tests/TestSerializeMonteCarloAnisotropicBarostat.cpp
+2
-0
No files found.
serialization/src/RMSDForceProxy.cpp
View file @
4c6cf680
...
@@ -45,6 +45,7 @@ void RMSDForceProxy::serialize(const void* object, SerializationNode& node) cons
...
@@ -45,6 +45,7 @@ void RMSDForceProxy::serialize(const void* object, SerializationNode& node) cons
node
.
setIntProperty
(
"version"
,
0
);
node
.
setIntProperty
(
"version"
,
0
);
const
RMSDForce
&
force
=
*
reinterpret_cast
<
const
RMSDForce
*>
(
object
);
const
RMSDForce
&
force
=
*
reinterpret_cast
<
const
RMSDForce
*>
(
object
);
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
node
.
setStringProperty
(
"name"
,
force
.
getName
());
SerializationNode
&
positionsNode
=
node
.
createChildNode
(
"ReferencePositions"
);
SerializationNode
&
positionsNode
=
node
.
createChildNode
(
"ReferencePositions"
);
for
(
const
Vec3
&
pos
:
force
.
getReferencePositions
())
for
(
const
Vec3
&
pos
:
force
.
getReferencePositions
())
positionsNode
.
createChildNode
(
"Position"
).
setDoubleProperty
(
"x"
,
pos
[
0
]).
setDoubleProperty
(
"y"
,
pos
[
1
]).
setDoubleProperty
(
"z"
,
pos
[
2
]);
positionsNode
.
createChildNode
(
"Position"
).
setDoubleProperty
(
"x"
,
pos
[
0
]).
setDoubleProperty
(
"y"
,
pos
[
1
]).
setDoubleProperty
(
"z"
,
pos
[
2
]);
...
@@ -67,6 +68,7 @@ void* RMSDForceProxy::deserialize(const SerializationNode& node) const {
...
@@ -67,6 +68,7 @@ void* RMSDForceProxy::deserialize(const SerializationNode& node) const {
particles
.
push_back
(
particle
.
getIntProperty
(
"index"
));
particles
.
push_back
(
particle
.
getIntProperty
(
"index"
));
force
=
new
RMSDForce
(
positions
,
particles
);
force
=
new
RMSDForce
(
positions
,
particles
);
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
force
->
setName
(
node
.
getStringProperty
(
"name"
,
force
->
getName
()));
return
force
;
return
force
;
}
}
catch
(...)
{
catch
(...)
{
...
...
serialization/tests/TestSerializeAndersenThermostat.cpp
View file @
4c6cf680
...
@@ -43,6 +43,7 @@ void testSerialization() {
...
@@ -43,6 +43,7 @@ void testSerialization() {
AndersenThermostat
force
(
250.0
,
0.2
);
AndersenThermostat
force
(
250.0
,
0.2
);
force
.
setForceGroup
(
3
);
force
.
setForceGroup
(
3
);
force
.
setName
(
"custom name"
);
force
.
setRandomNumberSeed
(
3
);
force
.
setRandomNumberSeed
(
3
);
// Serialize and then deserialize it.
// Serialize and then deserialize it.
...
@@ -55,6 +56,7 @@ void testSerialization() {
...
@@ -55,6 +56,7 @@ void testSerialization() {
AndersenThermostat
&
force2
=
*
copy
;
AndersenThermostat
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getName
(),
force2
.
getName
());
ASSERT_EQUAL
(
force
.
getDefaultTemperature
(),
force2
.
getDefaultTemperature
());
ASSERT_EQUAL
(
force
.
getDefaultTemperature
(),
force2
.
getDefaultTemperature
());
ASSERT_EQUAL
(
force
.
getDefaultCollisionFrequency
(),
force2
.
getDefaultCollisionFrequency
());
ASSERT_EQUAL
(
force
.
getDefaultCollisionFrequency
(),
force2
.
getDefaultCollisionFrequency
());
ASSERT_EQUAL
(
force
.
getRandomNumberSeed
(),
force2
.
getRandomNumberSeed
());
ASSERT_EQUAL
(
force
.
getRandomNumberSeed
(),
force2
.
getRandomNumberSeed
());
...
...
serialization/tests/TestSerializeCMAPTorsion.cpp
View file @
4c6cf680
...
@@ -43,6 +43,7 @@ void testSerialization() {
...
@@ -43,6 +43,7 @@ void testSerialization() {
CMAPTorsionForce
force
;
CMAPTorsionForce
force
;
force
.
setForceGroup
(
3
);
force
.
setForceGroup
(
3
);
force
.
setName
(
"custom name"
);
vector
<
double
>
map1
(
9
);
vector
<
double
>
map1
(
9
);
for
(
int
i
=
0
;
i
<
9
;
i
++
)
for
(
int
i
=
0
;
i
<
9
;
i
++
)
map1
[
i
]
=
0.1
*
i
;
map1
[
i
]
=
0.1
*
i
;
...
@@ -67,6 +68,7 @@ void testSerialization() {
...
@@ -67,6 +68,7 @@ void testSerialization() {
CMAPTorsionForce
&
force2
=
*
copy
;
CMAPTorsionForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getName
(),
force2
.
getName
());
ASSERT_EQUAL
(
force
.
usesPeriodicBoundaryConditions
(),
force2
.
usesPeriodicBoundaryConditions
());
ASSERT_EQUAL
(
force
.
usesPeriodicBoundaryConditions
(),
force2
.
usesPeriodicBoundaryConditions
());
ASSERT_EQUAL
(
force
.
getNumMaps
(),
force2
.
getNumMaps
());
ASSERT_EQUAL
(
force
.
getNumMaps
(),
force2
.
getNumMaps
());
for
(
int
i
=
0
;
i
<
force
.
getNumMaps
();
i
++
)
{
for
(
int
i
=
0
;
i
<
force
.
getNumMaps
();
i
++
)
{
...
...
serialization/tests/TestSerializeCMMotionRemover.cpp
View file @
4c6cf680
...
@@ -43,6 +43,7 @@ void testSerialization() {
...
@@ -43,6 +43,7 @@ void testSerialization() {
CMMotionRemover
force
(
5
);
CMMotionRemover
force
(
5
);
force
.
setForceGroup
(
3
);
force
.
setForceGroup
(
3
);
force
.
setName
(
"custom name"
);
// Serialize and then deserialize it.
// Serialize and then deserialize it.
...
@@ -54,6 +55,7 @@ void testSerialization() {
...
@@ -54,6 +55,7 @@ void testSerialization() {
CMMotionRemover
&
force2
=
*
copy
;
CMMotionRemover
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getName
(),
force2
.
getName
());
ASSERT_EQUAL
(
force
.
getFrequency
(),
force2
.
getFrequency
());
ASSERT_EQUAL
(
force
.
getFrequency
(),
force2
.
getFrequency
());
}
}
...
...
serialization/tests/TestSerializeCustomAngleForce.cpp
View file @
4c6cf680
...
@@ -43,6 +43,7 @@ void testSerialization() {
...
@@ -43,6 +43,7 @@ void testSerialization() {
CustomAngleForce
force
(
"5*sin(x)^2+y*z"
);
CustomAngleForce
force
(
"5*sin(x)^2+y*z"
);
force
.
setForceGroup
(
3
);
force
.
setForceGroup
(
3
);
force
.
setName
(
"custom name"
);
force
.
addGlobalParameter
(
"x"
,
1.3
);
force
.
addGlobalParameter
(
"x"
,
1.3
);
force
.
addGlobalParameter
(
"y"
,
2.221
);
force
.
addGlobalParameter
(
"y"
,
2.221
);
force
.
addPerAngleParameter
(
"z"
);
force
.
addPerAngleParameter
(
"z"
);
...
@@ -66,6 +67,7 @@ void testSerialization() {
...
@@ -66,6 +67,7 @@ void testSerialization() {
CustomAngleForce
&
force2
=
*
copy
;
CustomAngleForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getName
(),
force2
.
getName
());
ASSERT_EQUAL
(
force
.
getEnergyFunction
(),
force2
.
getEnergyFunction
());
ASSERT_EQUAL
(
force
.
getEnergyFunction
(),
force2
.
getEnergyFunction
());
ASSERT_EQUAL
(
force
.
getNumPerAngleParameters
(),
force2
.
getNumPerAngleParameters
());
ASSERT_EQUAL
(
force
.
getNumPerAngleParameters
(),
force2
.
getNumPerAngleParameters
());
for
(
int
i
=
0
;
i
<
force
.
getNumPerAngleParameters
();
i
++
)
for
(
int
i
=
0
;
i
<
force
.
getNumPerAngleParameters
();
i
++
)
...
...
serialization/tests/TestSerializeCustomBondForce.cpp
View file @
4c6cf680
...
@@ -43,6 +43,7 @@ void testSerialization() {
...
@@ -43,6 +43,7 @@ void testSerialization() {
CustomBondForce
force
(
"5*sin(x)^2+y*z"
);
CustomBondForce
force
(
"5*sin(x)^2+y*z"
);
force
.
setForceGroup
(
3
);
force
.
setForceGroup
(
3
);
force
.
setName
(
"custom name"
);
force
.
addGlobalParameter
(
"x"
,
1.3
);
force
.
addGlobalParameter
(
"x"
,
1.3
);
force
.
addGlobalParameter
(
"y"
,
2.221
);
force
.
addGlobalParameter
(
"y"
,
2.221
);
force
.
addPerBondParameter
(
"z"
);
force
.
addPerBondParameter
(
"z"
);
...
@@ -66,6 +67,7 @@ void testSerialization() {
...
@@ -66,6 +67,7 @@ void testSerialization() {
CustomBondForce
&
force2
=
*
copy
;
CustomBondForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getName
(),
force2
.
getName
());
ASSERT_EQUAL
(
force
.
getEnergyFunction
(),
force2
.
getEnergyFunction
());
ASSERT_EQUAL
(
force
.
getEnergyFunction
(),
force2
.
getEnergyFunction
());
ASSERT_EQUAL
(
force
.
getNumPerBondParameters
(),
force2
.
getNumPerBondParameters
());
ASSERT_EQUAL
(
force
.
getNumPerBondParameters
(),
force2
.
getNumPerBondParameters
());
for
(
int
i
=
0
;
i
<
force
.
getNumPerBondParameters
();
i
++
)
for
(
int
i
=
0
;
i
<
force
.
getNumPerBondParameters
();
i
++
)
...
...
serialization/tests/TestSerializeCustomCVForce.cpp
View file @
4c6cf680
...
@@ -45,6 +45,7 @@ void testSerialization() {
...
@@ -45,6 +45,7 @@ void testSerialization() {
CustomCVForce
force
(
"2*v1+v2"
);
CustomCVForce
force
(
"2*v1+v2"
);
force
.
setForceGroup
(
3
);
force
.
setForceGroup
(
3
);
force
.
setName
(
"custom name"
);
force
.
addGlobalParameter
(
"x"
,
1.3
);
force
.
addGlobalParameter
(
"x"
,
1.3
);
force
.
addGlobalParameter
(
"y"
,
2.221
);
force
.
addGlobalParameter
(
"y"
,
2.221
);
force
.
addEnergyParameterDerivative
(
"y"
);
force
.
addEnergyParameterDerivative
(
"y"
);
...
@@ -69,6 +70,7 @@ void testSerialization() {
...
@@ -69,6 +70,7 @@ void testSerialization() {
CustomCVForce
&
force2
=
*
copy
;
CustomCVForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getName
(),
force2
.
getName
());
ASSERT_EQUAL
(
force
.
getEnergyFunction
(),
force2
.
getEnergyFunction
());
ASSERT_EQUAL
(
force
.
getEnergyFunction
(),
force2
.
getEnergyFunction
());
ASSERT_EQUAL
(
force
.
getNumGlobalParameters
(),
force2
.
getNumGlobalParameters
());
ASSERT_EQUAL
(
force
.
getNumGlobalParameters
(),
force2
.
getNumGlobalParameters
());
for
(
int
i
=
0
;
i
<
force
.
getNumGlobalParameters
();
i
++
)
{
for
(
int
i
=
0
;
i
<
force
.
getNumGlobalParameters
();
i
++
)
{
...
...
serialization/tests/TestSerializeCustomCentroidBondForce.cpp
View file @
4c6cf680
...
@@ -43,6 +43,7 @@ void testSerialization() {
...
@@ -43,6 +43,7 @@ void testSerialization() {
CustomCentroidBondForce
force
(
3
,
"5*sin(distance(g1,g2))^2+y*z"
);
CustomCentroidBondForce
force
(
3
,
"5*sin(distance(g1,g2))^2+y*z"
);
force
.
setForceGroup
(
3
);
force
.
setForceGroup
(
3
);
force
.
setName
(
"custom name"
);
force
.
addGlobalParameter
(
"x"
,
1.3
);
force
.
addGlobalParameter
(
"x"
,
1.3
);
force
.
addGlobalParameter
(
"y"
,
2.221
);
force
.
addGlobalParameter
(
"y"
,
2.221
);
force
.
addPerBondParameter
(
"z"
);
force
.
addPerBondParameter
(
"z"
);
...
@@ -90,6 +91,7 @@ void testSerialization() {
...
@@ -90,6 +91,7 @@ void testSerialization() {
CustomCentroidBondForce
&
force2
=
*
copy
;
CustomCentroidBondForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getName
(),
force2
.
getName
());
ASSERT_EQUAL
(
force
.
getNumGroupsPerBond
(),
force2
.
getNumGroupsPerBond
());
ASSERT_EQUAL
(
force
.
getNumGroupsPerBond
(),
force2
.
getNumGroupsPerBond
());
ASSERT_EQUAL
(
force
.
getEnergyFunction
(),
force2
.
getEnergyFunction
());
ASSERT_EQUAL
(
force
.
getEnergyFunction
(),
force2
.
getEnergyFunction
());
ASSERT_EQUAL
(
force
.
getNumPerBondParameters
(),
force2
.
getNumPerBondParameters
());
ASSERT_EQUAL
(
force
.
getNumPerBondParameters
(),
force2
.
getNumPerBondParameters
());
...
...
serialization/tests/TestSerializeCustomCompoundBondForce.cpp
View file @
4c6cf680
...
@@ -43,6 +43,7 @@ void testSerialization() {
...
@@ -43,6 +43,7 @@ void testSerialization() {
CustomCompoundBondForce
force
(
3
,
"5*sin(distance(p1,p2))^2+y*z"
);
CustomCompoundBondForce
force
(
3
,
"5*sin(distance(p1,p2))^2+y*z"
);
force
.
setForceGroup
(
3
);
force
.
setForceGroup
(
3
);
force
.
setName
(
"custom name"
);
force
.
addGlobalParameter
(
"x"
,
1.3
);
force
.
addGlobalParameter
(
"x"
,
1.3
);
force
.
addGlobalParameter
(
"y"
,
2.221
);
force
.
addGlobalParameter
(
"y"
,
2.221
);
force
.
addPerBondParameter
(
"z"
);
force
.
addPerBondParameter
(
"z"
);
...
@@ -80,6 +81,7 @@ void testSerialization() {
...
@@ -80,6 +81,7 @@ void testSerialization() {
CustomCompoundBondForce
&
force2
=
*
copy
;
CustomCompoundBondForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getName
(),
force2
.
getName
());
ASSERT_EQUAL
(
force
.
getNumParticlesPerBond
(),
force2
.
getNumParticlesPerBond
());
ASSERT_EQUAL
(
force
.
getNumParticlesPerBond
(),
force2
.
getNumParticlesPerBond
());
ASSERT_EQUAL
(
force
.
getEnergyFunction
(),
force2
.
getEnergyFunction
());
ASSERT_EQUAL
(
force
.
getEnergyFunction
(),
force2
.
getEnergyFunction
());
ASSERT_EQUAL
(
force
.
getNumPerBondParameters
(),
force2
.
getNumPerBondParameters
());
ASSERT_EQUAL
(
force
.
getNumPerBondParameters
(),
force2
.
getNumPerBondParameters
());
...
...
serialization/tests/TestSerializeCustomExternalForce.cpp
View file @
4c6cf680
...
@@ -43,6 +43,7 @@ void testSerialization() {
...
@@ -43,6 +43,7 @@ void testSerialization() {
CustomExternalForce
force
(
"5*sin(x)^2+y*z"
);
CustomExternalForce
force
(
"5*sin(x)^2+y*z"
);
force
.
setForceGroup
(
3
);
force
.
setForceGroup
(
3
);
force
.
setName
(
"custom name"
);
force
.
addGlobalParameter
(
"x"
,
1.3
);
force
.
addGlobalParameter
(
"x"
,
1.3
);
force
.
addGlobalParameter
(
"y"
,
2.221
);
force
.
addGlobalParameter
(
"y"
,
2.221
);
force
.
addPerParticleParameter
(
"z"
);
force
.
addPerParticleParameter
(
"z"
);
...
@@ -64,6 +65,7 @@ void testSerialization() {
...
@@ -64,6 +65,7 @@ void testSerialization() {
CustomExternalForce
&
force2
=
*
copy
;
CustomExternalForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getName
(),
force2
.
getName
());
ASSERT_EQUAL
(
force
.
getEnergyFunction
(),
force2
.
getEnergyFunction
());
ASSERT_EQUAL
(
force
.
getEnergyFunction
(),
force2
.
getEnergyFunction
());
ASSERT_EQUAL
(
force
.
getNumPerParticleParameters
(),
force2
.
getNumPerParticleParameters
());
ASSERT_EQUAL
(
force
.
getNumPerParticleParameters
(),
force2
.
getNumPerParticleParameters
());
for
(
int
i
=
0
;
i
<
force
.
getNumPerParticleParameters
();
i
++
)
for
(
int
i
=
0
;
i
<
force
.
getNumPerParticleParameters
();
i
++
)
...
...
serialization/tests/TestSerializeCustomGBForce.cpp
View file @
4c6cf680
...
@@ -43,6 +43,7 @@ void testSerialization() {
...
@@ -43,6 +43,7 @@ void testSerialization() {
CustomGBForce
force
;
CustomGBForce
force
;
force
.
setForceGroup
(
3
);
force
.
setForceGroup
(
3
);
force
.
setName
(
"custom name"
);
force
.
setNonbondedMethod
(
CustomGBForce
::
CutoffPeriodic
);
force
.
setNonbondedMethod
(
CustomGBForce
::
CutoffPeriodic
);
force
.
setCutoffDistance
(
2.1
);
force
.
setCutoffDistance
(
2.1
);
force
.
addGlobalParameter
(
"x"
,
1.3
);
force
.
addGlobalParameter
(
"x"
,
1.3
);
...
@@ -77,6 +78,7 @@ void testSerialization() {
...
@@ -77,6 +78,7 @@ void testSerialization() {
CustomGBForce
&
force2
=
*
copy
;
CustomGBForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getName
(),
force2
.
getName
());
ASSERT_EQUAL
(
force
.
getNonbondedMethod
(),
force2
.
getNonbondedMethod
());
ASSERT_EQUAL
(
force
.
getNonbondedMethod
(),
force2
.
getNonbondedMethod
());
ASSERT_EQUAL
(
force
.
getCutoffDistance
(),
force2
.
getCutoffDistance
());
ASSERT_EQUAL
(
force
.
getCutoffDistance
(),
force2
.
getCutoffDistance
());
ASSERT_EQUAL
(
force
.
getNumPerParticleParameters
(),
force2
.
getNumPerParticleParameters
());
ASSERT_EQUAL
(
force
.
getNumPerParticleParameters
(),
force2
.
getNumPerParticleParameters
());
...
...
serialization/tests/TestSerializeCustomHbondForce.cpp
View file @
4c6cf680
...
@@ -43,6 +43,7 @@ void testSerialization() {
...
@@ -43,6 +43,7 @@ void testSerialization() {
CustomHbondForce
force
(
"5*sin(x)^2+y*z"
);
CustomHbondForce
force
(
"5*sin(x)^2+y*z"
);
force
.
setForceGroup
(
3
);
force
.
setForceGroup
(
3
);
force
.
setName
(
"custom name"
);
force
.
setNonbondedMethod
(
CustomHbondForce
::
CutoffPeriodic
);
force
.
setNonbondedMethod
(
CustomHbondForce
::
CutoffPeriodic
);
force
.
setCutoffDistance
(
2.1
);
force
.
setCutoffDistance
(
2.1
);
force
.
addGlobalParameter
(
"x"
,
1.3
);
force
.
addGlobalParameter
(
"x"
,
1.3
);
...
@@ -79,6 +80,7 @@ void testSerialization() {
...
@@ -79,6 +80,7 @@ void testSerialization() {
CustomHbondForce
&
force2
=
*
copy
;
CustomHbondForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getName
(),
force2
.
getName
());
ASSERT_EQUAL
(
force
.
getEnergyFunction
(),
force2
.
getEnergyFunction
());
ASSERT_EQUAL
(
force
.
getEnergyFunction
(),
force2
.
getEnergyFunction
());
ASSERT_EQUAL
(
force
.
getNonbondedMethod
(),
force2
.
getNonbondedMethod
());
ASSERT_EQUAL
(
force
.
getNonbondedMethod
(),
force2
.
getNonbondedMethod
());
ASSERT_EQUAL
(
force
.
getCutoffDistance
(),
force2
.
getCutoffDistance
());
ASSERT_EQUAL
(
force
.
getCutoffDistance
(),
force2
.
getCutoffDistance
());
...
...
serialization/tests/TestSerializeCustomManyParticleForce.cpp
View file @
4c6cf680
...
@@ -43,6 +43,7 @@ void testSerialization() {
...
@@ -43,6 +43,7 @@ void testSerialization() {
CustomManyParticleForce
force
(
3
,
"C*(a1+a2+a3)*(distance(p1,p2)+distance(p1,p3))"
);
CustomManyParticleForce
force
(
3
,
"C*(a1+a2+a3)*(distance(p1,p2)+distance(p1,p3))"
);
force
.
setForceGroup
(
3
);
force
.
setForceGroup
(
3
);
force
.
setName
(
"custom name"
);
force
.
setNonbondedMethod
(
CustomManyParticleForce
::
CutoffPeriodic
);
force
.
setNonbondedMethod
(
CustomManyParticleForce
::
CutoffPeriodic
);
force
.
setPermutationMode
(
CustomManyParticleForce
::
UniqueCentralParticle
);
force
.
setPermutationMode
(
CustomManyParticleForce
::
UniqueCentralParticle
);
force
.
setCutoffDistance
(
2.1
);
force
.
setCutoffDistance
(
2.1
);
...
@@ -78,6 +79,7 @@ void testSerialization() {
...
@@ -78,6 +79,7 @@ void testSerialization() {
CustomManyParticleForce
&
force2
=
*
copy
;
CustomManyParticleForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getName
(),
force2
.
getName
());
ASSERT_EQUAL
(
force
.
getNumParticlesPerSet
(),
force2
.
getNumParticlesPerSet
());
ASSERT_EQUAL
(
force
.
getNumParticlesPerSet
(),
force2
.
getNumParticlesPerSet
());
ASSERT_EQUAL
(
force
.
getEnergyFunction
(),
force2
.
getEnergyFunction
());
ASSERT_EQUAL
(
force
.
getEnergyFunction
(),
force2
.
getEnergyFunction
());
ASSERT_EQUAL
(
force
.
getNonbondedMethod
(),
force2
.
getNonbondedMethod
());
ASSERT_EQUAL
(
force
.
getNonbondedMethod
(),
force2
.
getNonbondedMethod
());
...
...
serialization/tests/TestSerializeCustomNonbondedForce.cpp
View file @
4c6cf680
...
@@ -43,6 +43,7 @@ void testSerialization() {
...
@@ -43,6 +43,7 @@ void testSerialization() {
CustomNonbondedForce
force
(
"5*sin(x)^2+y*z"
);
CustomNonbondedForce
force
(
"5*sin(x)^2+y*z"
);
force
.
setForceGroup
(
3
);
force
.
setForceGroup
(
3
);
force
.
setName
(
"custom name"
);
force
.
setNonbondedMethod
(
CustomNonbondedForce
::
CutoffPeriodic
);
force
.
setNonbondedMethod
(
CustomNonbondedForce
::
CutoffPeriodic
);
force
.
setUseSwitchingFunction
(
true
);
force
.
setUseSwitchingFunction
(
true
);
force
.
setUseLongRangeCorrection
(
true
);
force
.
setUseLongRangeCorrection
(
true
);
...
@@ -81,6 +82,7 @@ void testSerialization() {
...
@@ -81,6 +82,7 @@ void testSerialization() {
CustomNonbondedForce
&
force2
=
*
copy
;
CustomNonbondedForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getName
(),
force2
.
getName
());
ASSERT_EQUAL
(
force
.
getEnergyFunction
(),
force2
.
getEnergyFunction
());
ASSERT_EQUAL
(
force
.
getEnergyFunction
(),
force2
.
getEnergyFunction
());
ASSERT_EQUAL
(
force
.
getNonbondedMethod
(),
force2
.
getNonbondedMethod
());
ASSERT_EQUAL
(
force
.
getNonbondedMethod
(),
force2
.
getNonbondedMethod
());
ASSERT_EQUAL
(
force
.
getCutoffDistance
(),
force2
.
getCutoffDistance
());
ASSERT_EQUAL
(
force
.
getCutoffDistance
(),
force2
.
getCutoffDistance
());
...
...
serialization/tests/TestSerializeCustomTorsionForce.cpp
View file @
4c6cf680
...
@@ -43,6 +43,7 @@ void testSerialization() {
...
@@ -43,6 +43,7 @@ void testSerialization() {
CustomTorsionForce
force
(
"5*sin(x)^2+y*z"
);
CustomTorsionForce
force
(
"5*sin(x)^2+y*z"
);
force
.
setForceGroup
(
3
);
force
.
setForceGroup
(
3
);
force
.
setName
(
"custom name"
);
force
.
addGlobalParameter
(
"x"
,
1.3
);
force
.
addGlobalParameter
(
"x"
,
1.3
);
force
.
addGlobalParameter
(
"y"
,
2.221
);
force
.
addGlobalParameter
(
"y"
,
2.221
);
force
.
addPerTorsionParameter
(
"z"
);
force
.
addPerTorsionParameter
(
"z"
);
...
@@ -66,6 +67,7 @@ void testSerialization() {
...
@@ -66,6 +67,7 @@ void testSerialization() {
CustomTorsionForce
&
force2
=
*
copy
;
CustomTorsionForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getName
(),
force2
.
getName
());
ASSERT_EQUAL
(
force
.
getEnergyFunction
(),
force2
.
getEnergyFunction
());
ASSERT_EQUAL
(
force
.
getEnergyFunction
(),
force2
.
getEnergyFunction
());
ASSERT_EQUAL
(
force
.
getNumPerTorsionParameters
(),
force2
.
getNumPerTorsionParameters
());
ASSERT_EQUAL
(
force
.
getNumPerTorsionParameters
(),
force2
.
getNumPerTorsionParameters
());
for
(
int
i
=
0
;
i
<
force
.
getNumPerTorsionParameters
();
i
++
)
for
(
int
i
=
0
;
i
<
force
.
getNumPerTorsionParameters
();
i
++
)
...
...
serialization/tests/TestSerializeGBSAOBCForce.cpp
View file @
4c6cf680
...
@@ -43,6 +43,7 @@ void testSerialization() {
...
@@ -43,6 +43,7 @@ void testSerialization() {
GBSAOBCForce
force
;
GBSAOBCForce
force
;
force
.
setForceGroup
(
3
);
force
.
setForceGroup
(
3
);
force
.
setName
(
"custom name"
);
force
.
setNonbondedMethod
(
GBSAOBCForce
::
CutoffPeriodic
);
force
.
setNonbondedMethod
(
GBSAOBCForce
::
CutoffPeriodic
);
force
.
setCutoffDistance
(
2.0
);
force
.
setCutoffDistance
(
2.0
);
force
.
setSoluteDielectric
(
5.1
);
force
.
setSoluteDielectric
(
5.1
);
...
@@ -62,6 +63,7 @@ void testSerialization() {
...
@@ -62,6 +63,7 @@ void testSerialization() {
GBSAOBCForce
&
force2
=
*
copy
;
GBSAOBCForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getName
(),
force2
.
getName
());
ASSERT_EQUAL
(
force
.
getNonbondedMethod
(),
force2
.
getNonbondedMethod
());
ASSERT_EQUAL
(
force
.
getNonbondedMethod
(),
force2
.
getNonbondedMethod
());
ASSERT_EQUAL
(
force
.
getCutoffDistance
(),
force2
.
getCutoffDistance
());
ASSERT_EQUAL
(
force
.
getCutoffDistance
(),
force2
.
getCutoffDistance
());
ASSERT_EQUAL
(
force
.
getSoluteDielectric
(),
force2
.
getSoluteDielectric
());
ASSERT_EQUAL
(
force
.
getSoluteDielectric
(),
force2
.
getSoluteDielectric
());
...
...
serialization/tests/TestSerializeGayBerneForce.cpp
View file @
4c6cf680
...
@@ -43,6 +43,7 @@ void testSerialization() {
...
@@ -43,6 +43,7 @@ void testSerialization() {
GayBerneForce
force
;
GayBerneForce
force
;
force
.
setForceGroup
(
3
);
force
.
setForceGroup
(
3
);
force
.
setName
(
"custom name"
);
force
.
setNonbondedMethod
(
GayBerneForce
::
CutoffPeriodic
);
force
.
setNonbondedMethod
(
GayBerneForce
::
CutoffPeriodic
);
force
.
setSwitchingDistance
(
1.5
);
force
.
setSwitchingDistance
(
1.5
);
force
.
setUseSwitchingFunction
(
true
);
force
.
setUseSwitchingFunction
(
true
);
...
@@ -63,6 +64,7 @@ void testSerialization() {
...
@@ -63,6 +64,7 @@ void testSerialization() {
GayBerneForce
&
force2
=
*
copy
;
GayBerneForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getName
(),
force2
.
getName
());
ASSERT_EQUAL
(
force
.
getNonbondedMethod
(),
force2
.
getNonbondedMethod
());
ASSERT_EQUAL
(
force
.
getNonbondedMethod
(),
force2
.
getNonbondedMethod
());
ASSERT_EQUAL
(
force
.
getSwitchingDistance
(),
force2
.
getSwitchingDistance
());
ASSERT_EQUAL
(
force
.
getSwitchingDistance
(),
force2
.
getSwitchingDistance
());
ASSERT_EQUAL
(
force
.
getUseSwitchingFunction
(),
force2
.
getUseSwitchingFunction
());
ASSERT_EQUAL
(
force
.
getUseSwitchingFunction
(),
force2
.
getUseSwitchingFunction
());
...
...
serialization/tests/TestSerializeHarmonicAngleForce.cpp
View file @
4c6cf680
...
@@ -43,6 +43,7 @@ void testSerialization() {
...
@@ -43,6 +43,7 @@ void testSerialization() {
HarmonicAngleForce
force
;
HarmonicAngleForce
force
;
force
.
setForceGroup
(
3
);
force
.
setForceGroup
(
3
);
force
.
setName
(
"custom name"
);
force
.
addAngle
(
0
,
1
,
2
,
1.0
,
2.0
);
force
.
addAngle
(
0
,
1
,
2
,
1.0
,
2.0
);
force
.
addAngle
(
0
,
2
,
3
,
2.0
,
2.1
);
force
.
addAngle
(
0
,
2
,
3
,
2.0
,
2.1
);
force
.
addAngle
(
2
,
3
,
4
,
3.0
,
2.2
);
force
.
addAngle
(
2
,
3
,
4
,
3.0
,
2.2
);
...
@@ -59,6 +60,7 @@ void testSerialization() {
...
@@ -59,6 +60,7 @@ void testSerialization() {
HarmonicAngleForce
&
force2
=
*
copy
;
HarmonicAngleForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getName
(),
force2
.
getName
());
ASSERT_EQUAL
(
force
.
usesPeriodicBoundaryConditions
(),
force2
.
usesPeriodicBoundaryConditions
());
ASSERT_EQUAL
(
force
.
usesPeriodicBoundaryConditions
(),
force2
.
usesPeriodicBoundaryConditions
());
ASSERT_EQUAL
(
force
.
getNumAngles
(),
force2
.
getNumAngles
());
ASSERT_EQUAL
(
force
.
getNumAngles
(),
force2
.
getNumAngles
());
for
(
int
i
=
0
;
i
<
force
.
getNumAngles
();
i
++
)
{
for
(
int
i
=
0
;
i
<
force
.
getNumAngles
();
i
++
)
{
...
...
serialization/tests/TestSerializeHarmonicBondForce.cpp
View file @
4c6cf680
...
@@ -43,6 +43,7 @@ void testSerialization() {
...
@@ -43,6 +43,7 @@ void testSerialization() {
HarmonicBondForce
force
;
HarmonicBondForce
force
;
force
.
setForceGroup
(
3
);
force
.
setForceGroup
(
3
);
force
.
setName
(
"custom name"
);
force
.
addBond
(
0
,
1
,
1.0
,
2.0
);
force
.
addBond
(
0
,
1
,
1.0
,
2.0
);
force
.
addBond
(
0
,
2
,
2.0
,
2.1
);
force
.
addBond
(
0
,
2
,
2.0
,
2.1
);
force
.
addBond
(
2
,
3
,
3.0
,
2.2
);
force
.
addBond
(
2
,
3
,
3.0
,
2.2
);
...
@@ -59,6 +60,7 @@ void testSerialization() {
...
@@ -59,6 +60,7 @@ void testSerialization() {
HarmonicBondForce
&
force2
=
*
copy
;
HarmonicBondForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getName
(),
force2
.
getName
());
ASSERT_EQUAL
(
force
.
usesPeriodicBoundaryConditions
(),
force2
.
usesPeriodicBoundaryConditions
());
ASSERT_EQUAL
(
force
.
usesPeriodicBoundaryConditions
(),
force2
.
usesPeriodicBoundaryConditions
());
ASSERT_EQUAL
(
force
.
getNumBonds
(),
force2
.
getNumBonds
());
ASSERT_EQUAL
(
force
.
getNumBonds
(),
force2
.
getNumBonds
());
for
(
int
i
=
0
;
i
<
force
.
getNumBonds
();
i
++
)
{
for
(
int
i
=
0
;
i
<
force
.
getNumBonds
();
i
++
)
{
...
...
serialization/tests/TestSerializeMonteCarloAnisotropicBarostat.cpp
View file @
4c6cf680
...
@@ -43,6 +43,7 @@ void testSerialization() {
...
@@ -43,6 +43,7 @@ void testSerialization() {
MonteCarloAnisotropicBarostat
force
(
Vec3
(
15.1
,
18.2
,
19.3
),
250.0
,
true
,
false
,
true
,
14
);
MonteCarloAnisotropicBarostat
force
(
Vec3
(
15.1
,
18.2
,
19.3
),
250.0
,
true
,
false
,
true
,
14
);
force
.
setForceGroup
(
3
);
force
.
setForceGroup
(
3
);
force
.
setName
(
"custom name"
);
force
.
setRandomNumberSeed
(
3
);
force
.
setRandomNumberSeed
(
3
);
// Serialize and then deserialize it.
// Serialize and then deserialize it.
...
@@ -55,6 +56,7 @@ void testSerialization() {
...
@@ -55,6 +56,7 @@ void testSerialization() {
MonteCarloAnisotropicBarostat
&
force2
=
*
copy
;
MonteCarloAnisotropicBarostat
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getName
(),
force2
.
getName
());
ASSERT_EQUAL_VEC
(
force
.
getDefaultPressure
(),
force2
.
getDefaultPressure
(),
0.0
);
ASSERT_EQUAL_VEC
(
force
.
getDefaultPressure
(),
force2
.
getDefaultPressure
(),
0.0
);
ASSERT_EQUAL
(
force
.
getDefaultTemperature
(),
force2
.
getDefaultTemperature
());
ASSERT_EQUAL
(
force
.
getDefaultTemperature
(),
force2
.
getDefaultTemperature
());
ASSERT_EQUAL
(
force
.
getScaleX
(),
force2
.
getScaleX
());
ASSERT_EQUAL
(
force
.
getScaleX
(),
force2
.
getScaleX
());
...
...
Prev
1
2
3
4
Next
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