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
d4441c15
Commit
d4441c15
authored
Oct 20, 2011
by
Mark Friedrichs
Browse files
Added Born radius scaling method and associated parameters
parent
ca9e8f8d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
serialization/src/GBVIForceProxy.cpp
serialization/src/GBVIForceProxy.cpp
+12
-2
serialization/tests/TestSerializeGBVIForce.cpp
serialization/tests/TestSerializeGBVIForce.cpp
+6
-0
No files found.
serialization/src/GBVIForceProxy.cpp
View file @
d4441c15
...
@@ -42,9 +42,12 @@ GBVIForceProxy::GBVIForceProxy() : SerializationProxy("GBVIForce") {
...
@@ -42,9 +42,12 @@ GBVIForceProxy::GBVIForceProxy() : SerializationProxy("GBVIForce") {
}
}
void
GBVIForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
void
GBVIForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
node
.
setIntProperty
(
"version"
,
2
);
const
GBVIForce
&
force
=
*
reinterpret_cast
<
const
GBVIForce
*>
(
object
);
const
GBVIForce
&
force
=
*
reinterpret_cast
<
const
GBVIForce
*>
(
object
);
node
.
setIntProperty
(
"method"
,
(
int
)
force
.
getNonbondedMethod
());
node
.
setIntProperty
(
"method"
,
(
int
)
force
.
getNonbondedMethod
());
node
.
setIntProperty
(
"scalingMethod"
,
(
int
)
force
.
getBornRadiusScalingMethod
());
node
.
setDoubleProperty
(
"quinticLowerLimitFactor"
,
force
.
getQuinticLowerLimitFactor
());
node
.
setDoubleProperty
(
"quinticUpperBornRadiusLimit"
,
force
.
getQuinticUpperBornRadiusLimit
());
node
.
setDoubleProperty
(
"cutoff"
,
force
.
getCutoffDistance
());
node
.
setDoubleProperty
(
"cutoff"
,
force
.
getCutoffDistance
());
node
.
setDoubleProperty
(
"soluteDielectric"
,
force
.
getSoluteDielectric
());
node
.
setDoubleProperty
(
"soluteDielectric"
,
force
.
getSoluteDielectric
());
node
.
setDoubleProperty
(
"solventDielectric"
,
force
.
getSolventDielectric
());
node
.
setDoubleProperty
(
"solventDielectric"
,
force
.
getSolventDielectric
());
...
@@ -64,7 +67,7 @@ void GBVIForceProxy::serialize(const void* object, SerializationNode& node) cons
...
@@ -64,7 +67,7 @@ void GBVIForceProxy::serialize(const void* object, SerializationNode& node) cons
}
}
void
*
GBVIForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
void
*
GBVIForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
if
(
node
.
getIntProperty
(
"version"
)
!=
1
&&
node
.
getIntProperty
(
"version"
)
!=
2
)
throw
OpenMMException
(
"Unsupported version number"
);
throw
OpenMMException
(
"Unsupported version number"
);
GBVIForce
*
force
=
new
GBVIForce
();
GBVIForce
*
force
=
new
GBVIForce
();
try
{
try
{
...
@@ -72,6 +75,13 @@ void* GBVIForceProxy::deserialize(const SerializationNode& node) const {
...
@@ -72,6 +75,13 @@ void* GBVIForceProxy::deserialize(const SerializationNode& node) const {
force
->
setCutoffDistance
(
node
.
getDoubleProperty
(
"cutoff"
));
force
->
setCutoffDistance
(
node
.
getDoubleProperty
(
"cutoff"
));
force
->
setSoluteDielectric
(
node
.
getDoubleProperty
(
"soluteDielectric"
));
force
->
setSoluteDielectric
(
node
.
getDoubleProperty
(
"soluteDielectric"
));
force
->
setSolventDielectric
(
node
.
getDoubleProperty
(
"solventDielectric"
));
force
->
setSolventDielectric
(
node
.
getDoubleProperty
(
"solventDielectric"
));
if
(
node
.
getIntProperty
(
"version"
)
>=
2
){
force
->
setBornRadiusScalingMethod
(
(
GBVIForce
::
BornRadiusScalingMethod
)
node
.
getIntProperty
(
"scalingMethod"
));
force
->
setQuinticLowerLimitFactor
(
node
.
getDoubleProperty
(
"quinticLowerLimitFactor"
));
force
->
setQuinticUpperBornRadiusLimit
(
node
.
getDoubleProperty
(
"quinticUpperBornRadiusLimit"
));
}
const
SerializationNode
&
particles
=
node
.
getChildNode
(
"Particles"
);
const
SerializationNode
&
particles
=
node
.
getChildNode
(
"Particles"
);
for
(
int
i
=
0
;
i
<
(
int
)
particles
.
getChildren
().
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
(
int
)
particles
.
getChildren
().
size
();
i
++
)
{
const
SerializationNode
&
particle
=
particles
.
getChildren
()[
i
];
const
SerializationNode
&
particle
=
particles
.
getChildren
()[
i
];
...
...
serialization/tests/TestSerializeGBVIForce.cpp
View file @
d4441c15
...
@@ -43,6 +43,9 @@ void testSerialization() {
...
@@ -43,6 +43,9 @@ void testSerialization() {
GBVIForce
force
;
GBVIForce
force
;
force
.
setNonbondedMethod
(
GBVIForce
::
CutoffPeriodic
);
force
.
setNonbondedMethod
(
GBVIForce
::
CutoffPeriodic
);
force
.
setBornRadiusScalingMethod
(
GBVIForce
::
QuinticSpline
);
force
.
setQuinticLowerLimitFactor
(
0.123
);
force
.
setQuinticUpperBornRadiusLimit
(
5.123
);
force
.
setCutoffDistance
(
2.0
);
force
.
setCutoffDistance
(
2.0
);
force
.
setSoluteDielectric
(
5.1
);
force
.
setSoluteDielectric
(
5.1
);
force
.
setSolventDielectric
(
50.0
);
force
.
setSolventDielectric
(
50.0
);
...
@@ -66,6 +69,9 @@ void testSerialization() {
...
@@ -66,6 +69,9 @@ void testSerialization() {
ASSERT_EQUAL
(
force
.
getSoluteDielectric
(),
force2
.
getSoluteDielectric
());
ASSERT_EQUAL
(
force
.
getSoluteDielectric
(),
force2
.
getSoluteDielectric
());
ASSERT_EQUAL
(
force
.
getSolventDielectric
(),
force2
.
getSolventDielectric
());
ASSERT_EQUAL
(
force
.
getSolventDielectric
(),
force2
.
getSolventDielectric
());
ASSERT_EQUAL
(
force
.
getNumParticles
(),
force2
.
getNumParticles
());
ASSERT_EQUAL
(
force
.
getNumParticles
(),
force2
.
getNumParticles
());
ASSERT_EQUAL
(
force
.
getQuinticUpperBornRadiusLimit
(),
force2
.
getQuinticUpperBornRadiusLimit
());
ASSERT_EQUAL
(
force
.
getQuinticLowerLimitFactor
(),
force2
.
getQuinticLowerLimitFactor
());
ASSERT_EQUAL
(
force
.
getBornRadiusScalingMethod
(),
force2
.
getBornRadiusScalingMethod
());
for
(
int
i
=
0
;
i
<
force
.
getNumParticles
();
i
++
)
{
for
(
int
i
=
0
;
i
<
force
.
getNumParticles
();
i
++
)
{
double
charge1
,
radius1
,
scale1
;
double
charge1
,
radius1
,
scale1
;
double
charge2
,
radius2
,
scale2
;
double
charge2
,
radius2
,
scale2
;
...
...
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