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
ead929de
Commit
ead929de
authored
Oct 13, 2014
by
peastman
Browse files
Setting surface area energy works with serialization
parent
438b29b4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
serialization/src/GBSAOBCForceProxy.cpp
serialization/src/GBSAOBCForceProxy.cpp
+6
-2
serialization/tests/TestSerializeGBSAOBCForce.cpp
serialization/tests/TestSerializeGBSAOBCForce.cpp
+2
-0
No files found.
serialization/src/GBSAOBCForceProxy.cpp
View file @
ead929de
...
...
@@ -42,13 +42,14 @@ GBSAOBCForceProxy::GBSAOBCForceProxy() : SerializationProxy("GBSAOBCForce") {
}
void
GBSAOBCForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
node
.
setIntProperty
(
"version"
,
2
);
const
GBSAOBCForce
&
force
=
*
reinterpret_cast
<
const
GBSAOBCForce
*>
(
object
);
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
node
.
setIntProperty
(
"method"
,
(
int
)
force
.
getNonbondedMethod
());
node
.
setDoubleProperty
(
"cutoff"
,
force
.
getCutoffDistance
());
node
.
setDoubleProperty
(
"soluteDielectric"
,
force
.
getSoluteDielectric
());
node
.
setDoubleProperty
(
"solventDielectric"
,
force
.
getSolventDielectric
());
node
.
setDoubleProperty
(
"surfaceAreaEnergy"
,
force
.
getSurfaceAreaEnergy
());
SerializationNode
&
particles
=
node
.
createChildNode
(
"Particles"
);
for
(
int
i
=
0
;
i
<
force
.
getNumParticles
();
i
++
)
{
double
charge
,
radius
,
scale
;
...
...
@@ -58,7 +59,8 @@ void GBSAOBCForceProxy::serialize(const void* object, SerializationNode& node) c
}
void
*
GBSAOBCForceProxy
::
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"
);
GBSAOBCForce
*
force
=
new
GBSAOBCForce
();
try
{
...
...
@@ -67,6 +69,8 @@ void* GBSAOBCForceProxy::deserialize(const SerializationNode& node) const {
force
->
setCutoffDistance
(
node
.
getDoubleProperty
(
"cutoff"
));
force
->
setSoluteDielectric
(
node
.
getDoubleProperty
(
"soluteDielectric"
));
force
->
setSolventDielectric
(
node
.
getDoubleProperty
(
"solventDielectric"
));
if
(
version
>
1
)
force
->
setSurfaceAreaEnergy
(
node
.
getDoubleProperty
(
"surfaceAreaEnergy"
));
const
SerializationNode
&
particles
=
node
.
getChildNode
(
"Particles"
);
for
(
int
i
=
0
;
i
<
(
int
)
particles
.
getChildren
().
size
();
i
++
)
{
const
SerializationNode
&
particle
=
particles
.
getChildren
()[
i
];
...
...
serialization/tests/TestSerializeGBSAOBCForce.cpp
View file @
ead929de
...
...
@@ -47,6 +47,7 @@ void testSerialization() {
force
.
setCutoffDistance
(
2.0
);
force
.
setSoluteDielectric
(
5.1
);
force
.
setSolventDielectric
(
50.0
);
force
.
setSurfaceAreaEnergy
(
1.7
);
force
.
addParticle
(
1
,
0.1
,
0.01
);
force
.
addParticle
(
0.5
,
0.2
,
0.02
);
force
.
addParticle
(
-
0.5
,
0.3
,
0.03
);
...
...
@@ -65,6 +66,7 @@ void testSerialization() {
ASSERT_EQUAL
(
force
.
getCutoffDistance
(),
force2
.
getCutoffDistance
());
ASSERT_EQUAL
(
force
.
getSoluteDielectric
(),
force2
.
getSoluteDielectric
());
ASSERT_EQUAL
(
force
.
getSolventDielectric
(),
force2
.
getSolventDielectric
());
ASSERT_EQUAL
(
force
.
getSurfaceAreaEnergy
(),
force2
.
getSurfaceAreaEnergy
());
ASSERT_EQUAL
(
force
.
getNumParticles
(),
force2
.
getNumParticles
());
for
(
int
i
=
0
;
i
<
force
.
getNumParticles
();
i
++
)
{
double
charge1
,
radius1
,
scale1
;
...
...
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