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
d9cfd736
Commit
d9cfd736
authored
Jul 07, 2015
by
peastman
Browse files
Fixed a change to AmoebaStretchBendForceProxy that broke compatibility with old files
parent
89d3d50d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
plugins/amoeba/serialization/src/AmoebaStretchBendForceProxy.cpp
.../amoeba/serialization/src/AmoebaStretchBendForceProxy.cpp
+12
-4
No files found.
plugins/amoeba/serialization/src/AmoebaStretchBendForceProxy.cpp
View file @
d9cfd736
...
...
@@ -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 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2015
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -42,7 +42,7 @@ AmoebaStretchBendForceProxy::AmoebaStretchBendForceProxy() : SerializationProxy(
}
void
AmoebaStretchBendForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
node
.
setIntProperty
(
"version"
,
2
);
const
AmoebaStretchBendForce
&
force
=
*
reinterpret_cast
<
const
AmoebaStretchBendForce
*>
(
object
);
SerializationNode
&
bonds
=
node
.
createChildNode
(
"StretchBendAngles"
);
for
(
unsigned
int
ii
=
0
;
ii
<
static_cast
<
unsigned
int
>
(
force
.
getNumStretchBends
());
ii
++
)
{
...
...
@@ -55,14 +55,22 @@ void AmoebaStretchBendForceProxy::serialize(const void* object, SerializationNod
}
void
*
AmoebaStretchBendForceProxy
::
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"
);
AmoebaStretchBendForce
*
force
=
new
AmoebaStretchBendForce
();
try
{
const
SerializationNode
&
bonds
=
node
.
getChildNode
(
"StretchBendAngles"
);
for
(
unsigned
int
ii
=
0
;
ii
<
(
int
)
bonds
.
getChildren
().
size
();
ii
++
)
{
const
SerializationNode
&
bond
=
bonds
.
getChildren
()[
ii
];
force
->
addStretchBend
(
bond
.
getIntProperty
(
"p1"
),
bond
.
getIntProperty
(
"p2"
),
bond
.
getIntProperty
(
"p3"
),
bond
.
getDoubleProperty
(
"dAB"
),
bond
.
getDoubleProperty
(
"dCB"
),
bond
.
getDoubleProperty
(
"angle"
),
bond
.
getDoubleProperty
(
"k1"
),
bond
.
getDoubleProperty
(
"k2"
));
double
k1
,
k2
;
if
(
version
==
1
)
k1
=
k2
=
bond
.
getDoubleProperty
(
"k"
);
else
{
k1
=
bond
.
getDoubleProperty
(
"k1"
);
k2
=
bond
.
getDoubleProperty
(
"k2"
);
}
force
->
addStretchBend
(
bond
.
getIntProperty
(
"p1"
),
bond
.
getIntProperty
(
"p2"
),
bond
.
getIntProperty
(
"p3"
),
bond
.
getDoubleProperty
(
"dAB"
),
bond
.
getDoubleProperty
(
"dCB"
),
bond
.
getDoubleProperty
(
"angle"
),
k1
,
k2
);
}
}
...
...
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