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
46c5f78f
"platforms/vscode:/vscode.git/clone" did not exist on "08c2e027571cf9eae53aefe67726fdd9bb9bc5a3"
Commit
46c5f78f
authored
Apr 18, 2014
by
Jason Swails
Browse files
Merge branch 'master' of
https://github.com/SimTk/openmm
parents
d825e6ab
c4877bec
Changes
41
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
113 additions
and
19 deletions
+113
-19
serialization/src/RBTorsionForceProxy.cpp
serialization/src/RBTorsionForceProxy.cpp
+3
-1
serialization/src/SerializationNode.cpp
serialization/src/SerializationNode.cpp
+26
-0
serialization/tests/TestSerializeAndersenThermostat.cpp
serialization/tests/TestSerializeAndersenThermostat.cpp
+3
-1
serialization/tests/TestSerializeCMAPTorsion.cpp
serialization/tests/TestSerializeCMAPTorsion.cpp
+3
-1
serialization/tests/TestSerializeCMMotionRemover.cpp
serialization/tests/TestSerializeCMMotionRemover.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/TestSerializeCustomCompoundBondForce.cpp
serialization/tests/TestSerializeCustomCompoundBondForce.cpp
+3
-1
serialization/tests/TestSerializeCustomExternalForce.cpp
serialization/tests/TestSerializeCustomExternalForce.cpp
+3
-1
serialization/tests/TestSerializeCustomGBForce.cpp
serialization/tests/TestSerializeCustomGBForce.cpp
+3
-1
serialization/tests/TestSerializeCustomHbondForce.cpp
serialization/tests/TestSerializeCustomHbondForce.cpp
+3
-1
serialization/tests/TestSerializeCustomNonbondedForce.cpp
serialization/tests/TestSerializeCustomNonbondedForce.cpp
+19
-1
serialization/tests/TestSerializeCustomTorsionForce.cpp
serialization/tests/TestSerializeCustomTorsionForce.cpp
+3
-1
serialization/tests/TestSerializeGBSAOBCForce.cpp
serialization/tests/TestSerializeGBSAOBCForce.cpp
+3
-1
serialization/tests/TestSerializeGBVIForce.cpp
serialization/tests/TestSerializeGBVIForce.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/TestSerializeMonteCarloBarostat.cpp
serialization/tests/TestSerializeMonteCarloBarostat.cpp
+3
-1
serialization/tests/TestSerializeNonbondedForce.cpp
serialization/tests/TestSerializeNonbondedForce.cpp
+17
-1
serialization/tests/TestSerializePeriodicTorsionForce.cpp
serialization/tests/TestSerializePeriodicTorsionForce.cpp
+3
-1
No files found.
serialization/src/RBTorsionForceProxy.cpp
View file @
46c5f78f
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2014
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -44,6 +44,7 @@ RBTorsionForceProxy::RBTorsionForceProxy() : SerializationProxy("RBTorsionForce"
...
@@ -44,6 +44,7 @@ RBTorsionForceProxy::RBTorsionForceProxy() : SerializationProxy("RBTorsionForce"
void
RBTorsionForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
void
RBTorsionForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
node
.
setIntProperty
(
"version"
,
1
);
const
RBTorsionForce
&
force
=
*
reinterpret_cast
<
const
RBTorsionForce
*>
(
object
);
const
RBTorsionForce
&
force
=
*
reinterpret_cast
<
const
RBTorsionForce
*>
(
object
);
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
SerializationNode
&
torsions
=
node
.
createChildNode
(
"Torsions"
);
SerializationNode
&
torsions
=
node
.
createChildNode
(
"Torsions"
);
for
(
int
i
=
0
;
i
<
force
.
getNumTorsions
();
i
++
)
{
for
(
int
i
=
0
;
i
<
force
.
getNumTorsions
();
i
++
)
{
int
particle1
,
particle2
,
particle3
,
particle4
;
int
particle1
,
particle2
,
particle3
,
particle4
;
...
@@ -58,6 +59,7 @@ void* RBTorsionForceProxy::deserialize(const SerializationNode& node) const {
...
@@ -58,6 +59,7 @@ void* RBTorsionForceProxy::deserialize(const SerializationNode& node) const {
throw
OpenMMException
(
"Unsupported version number"
);
throw
OpenMMException
(
"Unsupported version number"
);
RBTorsionForce
*
force
=
new
RBTorsionForce
();
RBTorsionForce
*
force
=
new
RBTorsionForce
();
try
{
try
{
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
const
SerializationNode
&
torsions
=
node
.
getChildNode
(
"Torsions"
);
const
SerializationNode
&
torsions
=
node
.
getChildNode
(
"Torsions"
);
for
(
int
i
=
0
;
i
<
(
int
)
torsions
.
getChildren
().
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
(
int
)
torsions
.
getChildren
().
size
();
i
++
)
{
const
SerializationNode
&
torsion
=
torsions
.
getChildren
()[
i
];
const
SerializationNode
&
torsion
=
torsions
.
getChildren
()[
i
];
...
...
serialization/src/SerializationNode.cpp
View file @
46c5f78f
...
@@ -121,6 +121,32 @@ SerializationNode& SerializationNode::setIntProperty(const string& name, int val
...
@@ -121,6 +121,32 @@ SerializationNode& SerializationNode::setIntProperty(const string& name, int val
return
*
this
;
return
*
this
;
}
}
bool
SerializationNode
::
getBoolProperty
(
const
string
&
name
)
const
{
map
<
string
,
string
>::
const_iterator
iter
=
properties
.
find
(
name
);
if
(
iter
==
properties
.
end
())
throw
OpenMMException
(
"Unknown property '"
+
name
+
"' in node '"
+
getName
()
+
"'"
);
bool
value
;
stringstream
(
iter
->
second
)
>>
value
;
return
value
;
}
bool
SerializationNode
::
getBoolProperty
(
const
string
&
name
,
bool
defaultValue
)
const
{
map
<
string
,
string
>::
const_iterator
iter
=
properties
.
find
(
name
);
if
(
iter
==
properties
.
end
())
return
defaultValue
;
bool
value
;
stringstream
(
iter
->
second
)
>>
value
;
return
value
;
}
SerializationNode
&
SerializationNode
::
setBoolProperty
(
const
string
&
name
,
bool
value
)
{
stringstream
s
;
s
<<
value
;
properties
[
name
]
=
s
.
str
();
return
*
this
;
}
double
SerializationNode
::
getDoubleProperty
(
const
string
&
name
)
const
{
double
SerializationNode
::
getDoubleProperty
(
const
string
&
name
)
const
{
map
<
string
,
string
>::
const_iterator
iter
=
properties
.
find
(
name
);
map
<
string
,
string
>::
const_iterator
iter
=
properties
.
find
(
name
);
if
(
iter
==
properties
.
end
())
if
(
iter
==
properties
.
end
())
...
...
serialization/tests/TestSerializeAndersenThermostat.cpp
View file @
46c5f78f
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2014
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -42,6 +42,7 @@ void testSerialization() {
...
@@ -42,6 +42,7 @@ void testSerialization() {
// Create a Force.
// Create a Force.
AndersenThermostat
force
(
250.0
,
0.2
);
AndersenThermostat
force
(
250.0
,
0.2
);
force
.
setForceGroup
(
3
);
force
.
setRandomNumberSeed
(
3
);
force
.
setRandomNumberSeed
(
3
);
// Serialize and then deserialize it.
// Serialize and then deserialize it.
...
@@ -53,6 +54,7 @@ void testSerialization() {
...
@@ -53,6 +54,7 @@ void testSerialization() {
// Compare the two forces to see if they are identical.
// Compare the two forces to see if they are identical.
AndersenThermostat
&
force2
=
*
copy
;
AndersenThermostat
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
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 @
46c5f78f
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2014
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -42,6 +42,7 @@ void testSerialization() {
...
@@ -42,6 +42,7 @@ void testSerialization() {
// Create a Force.
// Create a Force.
CMAPTorsionForce
force
;
CMAPTorsionForce
force
;
force
.
setForceGroup
(
3
);
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
;
...
@@ -64,6 +65,7 @@ void testSerialization() {
...
@@ -64,6 +65,7 @@ void testSerialization() {
// Compare the two forces to see if they are identical.
// Compare the two forces to see if they are identical.
CMAPTorsionForce
&
force2
=
*
copy
;
CMAPTorsionForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
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
++
)
{
int
size1
,
size2
;
int
size1
,
size2
;
...
...
serialization/tests/TestSerializeCMMotionRemover.cpp
View file @
46c5f78f
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2014
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -42,6 +42,7 @@ void testSerialization() {
...
@@ -42,6 +42,7 @@ void testSerialization() {
// Create a Force.
// Create a Force.
CMMotionRemover
force
(
5
);
CMMotionRemover
force
(
5
);
force
.
setForceGroup
(
3
);
// Serialize and then deserialize it.
// Serialize and then deserialize it.
...
@@ -52,6 +53,7 @@ void testSerialization() {
...
@@ -52,6 +53,7 @@ void testSerialization() {
// Compare the two forces to see if they are identical.
// Compare the two forces to see if they are identical.
CMMotionRemover
&
force2
=
*
copy
;
CMMotionRemover
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getFrequency
(),
force2
.
getFrequency
());
ASSERT_EQUAL
(
force
.
getFrequency
(),
force2
.
getFrequency
());
}
}
...
...
serialization/tests/TestSerializeCustomAngleForce.cpp
View file @
46c5f78f
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2014
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -42,6 +42,7 @@ void testSerialization() {
...
@@ -42,6 +42,7 @@ void testSerialization() {
// Create a Force.
// Create a Force.
CustomAngleForce
force
(
"5*sin(x)^2+y*z"
);
CustomAngleForce
force
(
"5*sin(x)^2+y*z"
);
force
.
setForceGroup
(
3
);
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"
);
...
@@ -62,6 +63,7 @@ void testSerialization() {
...
@@ -62,6 +63,7 @@ void testSerialization() {
// Compare the two forces to see if they are identical.
// Compare the two forces to see if they are identical.
CustomAngleForce
&
force2
=
*
copy
;
CustomAngleForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
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 @
46c5f78f
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2014
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -42,6 +42,7 @@ void testSerialization() {
...
@@ -42,6 +42,7 @@ void testSerialization() {
// Create a Force.
// Create a Force.
CustomBondForce
force
(
"5*sin(x)^2+y*z"
);
CustomBondForce
force
(
"5*sin(x)^2+y*z"
);
force
.
setForceGroup
(
3
);
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"
);
...
@@ -62,6 +63,7 @@ void testSerialization() {
...
@@ -62,6 +63,7 @@ void testSerialization() {
// Compare the two forces to see if they are identical.
// Compare the two forces to see if they are identical.
CustomBondForce
&
force2
=
*
copy
;
CustomBondForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
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/TestSerializeCustomCompoundBondForce.cpp
View file @
46c5f78f
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010-201
2
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
4
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -42,6 +42,7 @@ void testSerialization() {
...
@@ -42,6 +42,7 @@ void testSerialization() {
// Create a Force.
// Create a Force.
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
.
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"
);
...
@@ -76,6 +77,7 @@ void testSerialization() {
...
@@ -76,6 +77,7 @@ void testSerialization() {
// Compare the two forces to see if they are identical.
// Compare the two forces to see if they are identical.
CustomCompoundBondForce
&
force2
=
*
copy
;
CustomCompoundBondForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
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 @
46c5f78f
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2014
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -42,6 +42,7 @@ void testSerialization() {
...
@@ -42,6 +42,7 @@ void testSerialization() {
// Create a Force.
// Create a Force.
CustomExternalForce
force
(
"5*sin(x)^2+y*z"
);
CustomExternalForce
force
(
"5*sin(x)^2+y*z"
);
force
.
setForceGroup
(
3
);
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"
);
...
@@ -62,6 +63,7 @@ void testSerialization() {
...
@@ -62,6 +63,7 @@ void testSerialization() {
// Compare the two forces to see if they are identical.
// Compare the two forces to see if they are identical.
CustomExternalForce
&
force2
=
*
copy
;
CustomExternalForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
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 @
46c5f78f
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2014
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -42,6 +42,7 @@ void testSerialization() {
...
@@ -42,6 +42,7 @@ void testSerialization() {
// Create a Force.
// Create a Force.
CustomGBForce
force
;
CustomGBForce
force
;
force
.
setForceGroup
(
3
);
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
);
...
@@ -74,6 +75,7 @@ void testSerialization() {
...
@@ -74,6 +75,7 @@ void testSerialization() {
// Compare the two forces to see if they are identical.
// Compare the two forces to see if they are identical.
CustomGBForce
&
force2
=
*
copy
;
CustomGBForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
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 @
46c5f78f
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2014
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -42,6 +42,7 @@ void testSerialization() {
...
@@ -42,6 +42,7 @@ void testSerialization() {
// Create a Force.
// Create a Force.
CustomHbondForce
force
(
"5*sin(x)^2+y*z"
);
CustomHbondForce
force
(
"5*sin(x)^2+y*z"
);
force
.
setForceGroup
(
3
);
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
);
...
@@ -77,6 +78,7 @@ void testSerialization() {
...
@@ -77,6 +78,7 @@ void testSerialization() {
// Compare the two forces to see if they are identical.
// Compare the two forces to see if they are identical.
CustomHbondForce
&
force2
=
*
copy
;
CustomHbondForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
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/TestSerializeCustomNonbondedForce.cpp
View file @
46c5f78f
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2014
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -42,7 +42,11 @@ void testSerialization() {
...
@@ -42,7 +42,11 @@ void testSerialization() {
// Create a Force.
// Create a Force.
CustomNonbondedForce
force
(
"5*sin(x)^2+y*z"
);
CustomNonbondedForce
force
(
"5*sin(x)^2+y*z"
);
force
.
setForceGroup
(
3
);
force
.
setNonbondedMethod
(
CustomNonbondedForce
::
CutoffPeriodic
);
force
.
setNonbondedMethod
(
CustomNonbondedForce
::
CutoffPeriodic
);
force
.
setUseSwitchingFunction
(
true
);
force
.
setUseLongRangeCorrection
(
true
);
force
.
setSwitchingDistance
(
2.0
);
force
.
setCutoffDistance
(
2.1
);
force
.
setCutoffDistance
(
2.1
);
force
.
addGlobalParameter
(
"x"
,
1.3
);
force
.
addGlobalParameter
(
"x"
,
1.3
);
force
.
addGlobalParameter
(
"y"
,
2.221
);
force
.
addGlobalParameter
(
"y"
,
2.221
);
...
@@ -60,6 +64,11 @@ void testSerialization() {
...
@@ -60,6 +64,11 @@ void testSerialization() {
for
(
int
i
=
0
;
i
<
10
;
i
++
)
for
(
int
i
=
0
;
i
<
10
;
i
++
)
values
[
i
]
=
sin
((
double
)
i
);
values
[
i
]
=
sin
((
double
)
i
);
force
.
addFunction
(
"f"
,
values
,
0.5
,
1.5
);
force
.
addFunction
(
"f"
,
values
,
0.5
,
1.5
);
std
::
set
<
int
>
set1
,
set2
;
set1
.
insert
(
0
);
set2
.
insert
(
1
);
set2
.
insert
(
2
);
force
.
addInteractionGroup
(
set1
,
set2
);
// Serialize and then deserialize it.
// Serialize and then deserialize it.
...
@@ -70,9 +79,13 @@ void testSerialization() {
...
@@ -70,9 +79,13 @@ void testSerialization() {
// Compare the two forces to see if they are identical.
// Compare the two forces to see if they are identical.
CustomNonbondedForce
&
force2
=
*
copy
;
CustomNonbondedForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
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
());
ASSERT_EQUAL
(
force
.
getSwitchingDistance
(),
force2
.
getSwitchingDistance
());
ASSERT_EQUAL
(
force
.
getUseSwitchingFunction
(),
force2
.
getUseSwitchingFunction
());
ASSERT_EQUAL
(
force
.
getUseLongRangeCorrection
(),
force2
.
getUseLongRangeCorrection
());
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
++
)
ASSERT_EQUAL
(
force
.
getPerParticleParameterName
(
i
),
force2
.
getPerParticleParameterName
(
i
));
ASSERT_EQUAL
(
force
.
getPerParticleParameterName
(
i
),
force2
.
getPerParticleParameterName
(
i
));
...
@@ -111,6 +124,11 @@ void testSerialization() {
...
@@ -111,6 +124,11 @@ void testSerialization() {
for
(
int
j
=
0
;
j
<
(
int
)
val1
.
size
();
j
++
)
for
(
int
j
=
0
;
j
<
(
int
)
val1
.
size
();
j
++
)
ASSERT_EQUAL
(
val1
[
j
],
val2
[
j
]);
ASSERT_EQUAL
(
val1
[
j
],
val2
[
j
]);
}
}
ASSERT_EQUAL
(
force
.
getNumInteractionGroups
(),
force2
.
getNumInteractionGroups
());
std
::
set
<
int
>
set1c
,
set2c
;
force2
.
getInteractionGroupParameters
(
0
,
set1c
,
set2c
);
ASSERT_EQUAL_CONTAINERS
(
set1
,
set1c
);
ASSERT_EQUAL_CONTAINERS
(
set2
,
set2c
);
}
}
int
main
()
{
int
main
()
{
...
...
serialization/tests/TestSerializeCustomTorsionForce.cpp
View file @
46c5f78f
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2014
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -42,6 +42,7 @@ void testSerialization() {
...
@@ -42,6 +42,7 @@ void testSerialization() {
// Create a Force.
// Create a Force.
CustomTorsionForce
force
(
"5*sin(x)^2+y*z"
);
CustomTorsionForce
force
(
"5*sin(x)^2+y*z"
);
force
.
setForceGroup
(
3
);
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"
);
...
@@ -62,6 +63,7 @@ void testSerialization() {
...
@@ -62,6 +63,7 @@ void testSerialization() {
// Compare the two forces to see if they are identical.
// Compare the two forces to see if they are identical.
CustomTorsionForce
&
force2
=
*
copy
;
CustomTorsionForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
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 @
46c5f78f
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2014
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -42,6 +42,7 @@ void testSerialization() {
...
@@ -42,6 +42,7 @@ void testSerialization() {
// Create a Force.
// Create a Force.
GBSAOBCForce
force
;
GBSAOBCForce
force
;
force
.
setForceGroup
(
3
);
force
.
setNonbondedMethod
(
GBSAOBCForce
::
CutoffPeriodic
);
force
.
setNonbondedMethod
(
GBSAOBCForce
::
CutoffPeriodic
);
force
.
setCutoffDistance
(
2.0
);
force
.
setCutoffDistance
(
2.0
);
force
.
setSoluteDielectric
(
5.1
);
force
.
setSoluteDielectric
(
5.1
);
...
@@ -59,6 +60,7 @@ void testSerialization() {
...
@@ -59,6 +60,7 @@ void testSerialization() {
// Compare the two forces to see if they are identical.
// Compare the two forces to see if they are identical.
GBSAOBCForce
&
force2
=
*
copy
;
GBSAOBCForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
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/TestSerializeGBVIForce.cpp
View file @
46c5f78f
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2014
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -42,6 +42,7 @@ void testSerialization() {
...
@@ -42,6 +42,7 @@ void testSerialization() {
// Create a Force.
// Create a Force.
GBVIForce
force
;
GBVIForce
force
;
force
.
setForceGroup
(
3
);
force
.
setNonbondedMethod
(
GBVIForce
::
CutoffPeriodic
);
force
.
setNonbondedMethod
(
GBVIForce
::
CutoffPeriodic
);
force
.
setBornRadiusScalingMethod
(
GBVIForce
::
QuinticSpline
);
force
.
setBornRadiusScalingMethod
(
GBVIForce
::
QuinticSpline
);
force
.
setQuinticLowerLimitFactor
(
0.123
);
force
.
setQuinticLowerLimitFactor
(
0.123
);
...
@@ -64,6 +65,7 @@ void testSerialization() {
...
@@ -64,6 +65,7 @@ void testSerialization() {
// Compare the two forces to see if they are identical.
// Compare the two forces to see if they are identical.
GBVIForce
&
force2
=
*
copy
;
GBVIForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
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/TestSerializeHarmonicAngleForce.cpp
View file @
46c5f78f
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2014
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -42,6 +42,7 @@ void testSerialization() {
...
@@ -42,6 +42,7 @@ void testSerialization() {
// Create a Force.
// Create a Force.
HarmonicAngleForce
force
;
HarmonicAngleForce
force
;
force
.
setForceGroup
(
3
);
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
);
...
@@ -56,6 +57,7 @@ void testSerialization() {
...
@@ -56,6 +57,7 @@ void testSerialization() {
// Compare the two forces to see if they are identical.
// Compare the two forces to see if they are identical.
HarmonicAngleForce
&
force2
=
*
copy
;
HarmonicAngleForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
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
++
)
{
int
a1
,
a2
,
a3
,
b1
,
b2
,
b3
;
int
a1
,
a2
,
a3
,
b1
,
b2
,
b3
;
...
...
serialization/tests/TestSerializeHarmonicBondForce.cpp
View file @
46c5f78f
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2014
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -42,6 +42,7 @@ void testSerialization() {
...
@@ -42,6 +42,7 @@ void testSerialization() {
// Create a Force.
// Create a Force.
HarmonicBondForce
force
;
HarmonicBondForce
force
;
force
.
setForceGroup
(
3
);
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
);
...
@@ -56,6 +57,7 @@ void testSerialization() {
...
@@ -56,6 +57,7 @@ void testSerialization() {
// Compare the two forces to see if they are identical.
// Compare the two forces to see if they are identical.
HarmonicBondForce
&
force2
=
*
copy
;
HarmonicBondForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
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
++
)
{
int
a1
,
a2
,
b1
,
b2
;
int
a1
,
a2
,
b1
,
b2
;
...
...
serialization/tests/TestSerializeMonteCarloBarostat.cpp
View file @
46c5f78f
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2014
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -42,6 +42,7 @@ void testSerialization() {
...
@@ -42,6 +42,7 @@ void testSerialization() {
// Create a Force.
// Create a Force.
MonteCarloBarostat
force
(
25.5
,
250.0
,
14
);
MonteCarloBarostat
force
(
25.5
,
250.0
,
14
);
force
.
setForceGroup
(
3
);
force
.
setRandomNumberSeed
(
3
);
force
.
setRandomNumberSeed
(
3
);
// Serialize and then deserialize it.
// Serialize and then deserialize it.
...
@@ -53,6 +54,7 @@ void testSerialization() {
...
@@ -53,6 +54,7 @@ void testSerialization() {
// Compare the two forces to see if they are identical.
// Compare the two forces to see if they are identical.
MonteCarloBarostat
&
force2
=
*
copy
;
MonteCarloBarostat
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getDefaultPressure
(),
force2
.
getDefaultPressure
());
ASSERT_EQUAL
(
force
.
getDefaultPressure
(),
force2
.
getDefaultPressure
());
ASSERT_EQUAL
(
force
.
getTemperature
(),
force2
.
getTemperature
());
ASSERT_EQUAL
(
force
.
getTemperature
(),
force2
.
getTemperature
());
ASSERT_EQUAL
(
force
.
getFrequency
(),
force2
.
getFrequency
());
ASSERT_EQUAL
(
force
.
getFrequency
(),
force2
.
getFrequency
());
...
...
serialization/tests/TestSerializeNonbondedForce.cpp
View file @
46c5f78f
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2014
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -42,11 +42,17 @@ void testSerialization() {
...
@@ -42,11 +42,17 @@ void testSerialization() {
// Create a Force.
// Create a Force.
NonbondedForce
force
;
NonbondedForce
force
;
force
.
setForceGroup
(
3
);
force
.
setNonbondedMethod
(
NonbondedForce
::
CutoffPeriodic
);
force
.
setNonbondedMethod
(
NonbondedForce
::
CutoffPeriodic
);
force
.
setSwitchingDistance
(
1.5
);
force
.
setUseSwitchingFunction
(
true
);
force
.
setCutoffDistance
(
2.0
);
force
.
setCutoffDistance
(
2.0
);
force
.
setEwaldErrorTolerance
(
1e-3
);
force
.
setEwaldErrorTolerance
(
1e-3
);
force
.
setReactionFieldDielectric
(
50.0
);
force
.
setReactionFieldDielectric
(
50.0
);
force
.
setUseDispersionCorrection
(
false
);
force
.
setUseDispersionCorrection
(
false
);
double
alpha
=
0.5
;
int
nx
=
3
,
ny
=
5
,
nz
=
7
;
force
.
setPMEParameters
(
alpha
,
nx
,
ny
,
nz
);
force
.
addParticle
(
1
,
0.1
,
0.01
);
force
.
addParticle
(
1
,
0.1
,
0.01
);
force
.
addParticle
(
0.5
,
0.2
,
0.02
);
force
.
addParticle
(
0.5
,
0.2
,
0.02
);
force
.
addParticle
(
-
0.5
,
0.3
,
0.03
);
force
.
addParticle
(
-
0.5
,
0.3
,
0.03
);
...
@@ -62,12 +68,22 @@ void testSerialization() {
...
@@ -62,12 +68,22 @@ void testSerialization() {
// Compare the two forces to see if they are identical.
// Compare the two forces to see if they are identical.
NonbondedForce
&
force2
=
*
copy
;
NonbondedForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getNonbondedMethod
(),
force2
.
getNonbondedMethod
());
ASSERT_EQUAL
(
force
.
getNonbondedMethod
(),
force2
.
getNonbondedMethod
());
ASSERT_EQUAL
(
force
.
getSwitchingDistance
(),
force2
.
getSwitchingDistance
());
ASSERT_EQUAL
(
force
.
getUseSwitchingFunction
(),
force2
.
getUseSwitchingFunction
());
ASSERT_EQUAL
(
force
.
getCutoffDistance
(),
force2
.
getCutoffDistance
());
ASSERT_EQUAL
(
force
.
getCutoffDistance
(),
force2
.
getCutoffDistance
());
ASSERT_EQUAL
(
force
.
getEwaldErrorTolerance
(),
force2
.
getEwaldErrorTolerance
());
ASSERT_EQUAL
(
force
.
getEwaldErrorTolerance
(),
force2
.
getEwaldErrorTolerance
());
ASSERT_EQUAL
(
force
.
getReactionFieldDielectric
(),
force2
.
getReactionFieldDielectric
());
ASSERT_EQUAL
(
force
.
getReactionFieldDielectric
(),
force2
.
getReactionFieldDielectric
());
ASSERT_EQUAL
(
force
.
getUseDispersionCorrection
(),
force2
.
getUseDispersionCorrection
());
ASSERT_EQUAL
(
force
.
getUseDispersionCorrection
(),
force2
.
getUseDispersionCorrection
());
ASSERT_EQUAL
(
force
.
getNumParticles
(),
force2
.
getNumParticles
());
ASSERT_EQUAL
(
force
.
getNumParticles
(),
force2
.
getNumParticles
());
double
alpha2
;
int
nx2
,
ny2
,
nz2
;
force2
.
getPMEParameters
(
alpha2
,
nx2
,
ny2
,
nz2
);
ASSERT_EQUAL
(
alpha
,
alpha2
);
ASSERT_EQUAL
(
nx
,
nx2
);
ASSERT_EQUAL
(
ny
,
ny2
);
ASSERT_EQUAL
(
nz
,
nz2
);
for
(
int
i
=
0
;
i
<
force
.
getNumParticles
();
i
++
)
{
for
(
int
i
=
0
;
i
<
force
.
getNumParticles
();
i
++
)
{
double
charge1
,
sigma1
,
epsilon1
;
double
charge1
,
sigma1
,
epsilon1
;
double
charge2
,
sigma2
,
epsilon2
;
double
charge2
,
sigma2
,
epsilon2
;
...
...
serialization/tests/TestSerializePeriodicTorsionForce.cpp
View file @
46c5f78f
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2014
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -42,6 +42,7 @@ void testSerialization() {
...
@@ -42,6 +42,7 @@ void testSerialization() {
// Create a Force.
// Create a Force.
PeriodicTorsionForce
force
;
PeriodicTorsionForce
force
;
force
.
setForceGroup
(
3
);
force
.
addTorsion
(
0
,
1
,
2
,
3
,
2
,
1.0
,
2.0
);
force
.
addTorsion
(
0
,
1
,
2
,
3
,
2
,
1.0
,
2.0
);
force
.
addTorsion
(
0
,
2
,
3
,
4
,
2
,
2.0
,
2.1
);
force
.
addTorsion
(
0
,
2
,
3
,
4
,
2
,
2.0
,
2.1
);
force
.
addTorsion
(
2
,
3
,
4
,
7
,
1
,
3.0
,
2.2
);
force
.
addTorsion
(
2
,
3
,
4
,
7
,
1
,
3.0
,
2.2
);
...
@@ -56,6 +57,7 @@ void testSerialization() {
...
@@ -56,6 +57,7 @@ void testSerialization() {
// Compare the two forces to see if they are identical.
// Compare the two forces to see if they are identical.
PeriodicTorsionForce
&
force2
=
*
copy
;
PeriodicTorsionForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getNumTorsions
(),
force2
.
getNumTorsions
());
ASSERT_EQUAL
(
force
.
getNumTorsions
(),
force2
.
getNumTorsions
());
for
(
int
i
=
0
;
i
<
force
.
getNumTorsions
();
i
++
)
{
for
(
int
i
=
0
;
i
<
force
.
getNumTorsions
();
i
++
)
{
int
a1
,
a2
,
a3
,
a4
,
b1
,
b2
,
b3
,
b4
,
perioda
,
periodb
;
int
a1
,
a2
,
a3
,
a4
,
b1
,
b2
,
b3
,
b4
,
perioda
,
periodb
;
...
...
Prev
1
2
3
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