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
202c24d9
Commit
202c24d9
authored
Jan 14, 2016
by
peastman
Browse files
Fixed a bug in serializing CustomCentroidBondForce
parent
71de4b1b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
serialization/src/CustomCentroidBondForceProxy.cpp
serialization/src/CustomCentroidBondForceProxy.cpp
+4
-2
serialization/tests/TestSerializeCustomCentroidBondForce.cpp
serialization/tests/TestSerializeCustomCentroidBondForce.cpp
+2
-1
No files found.
serialization/src/CustomCentroidBondForceProxy.cpp
View file @
202c24d9
...
@@ -64,7 +64,8 @@ void CustomCentroidBondForceProxy::serialize(const void* object, SerializationNo
...
@@ -64,7 +64,8 @@ void CustomCentroidBondForceProxy::serialize(const void* object, SerializationNo
for
(
int
j
=
0
;
j
<
(
int
)
particles
.
size
();
j
++
)
{
for
(
int
j
=
0
;
j
<
(
int
)
particles
.
size
();
j
++
)
{
SerializationNode
&
node
=
group
.
createChildNode
(
"Particle"
);
SerializationNode
&
node
=
group
.
createChildNode
(
"Particle"
);
node
.
setIntProperty
(
"p"
,
particles
[
j
]);
node
.
setIntProperty
(
"p"
,
particles
[
j
]);
node
.
setDoubleProperty
(
"weight"
,
weights
[
j
]);
if
(
j
<
weights
.
size
())
node
.
setDoubleProperty
(
"weight"
,
weights
[
j
]);
}
}
}
}
SerializationNode
&
bonds
=
node
.
createChildNode
(
"Bonds"
);
SerializationNode
&
bonds
=
node
.
createChildNode
(
"Bonds"
);
...
@@ -115,7 +116,8 @@ void* CustomCentroidBondForceProxy::deserialize(const SerializationNode& node) c
...
@@ -115,7 +116,8 @@ void* CustomCentroidBondForceProxy::deserialize(const SerializationNode& node) c
vector
<
double
>
weights
;
vector
<
double
>
weights
;
for
(
int
j
=
0
;
j
<
(
int
)
group
.
getChildren
().
size
();
j
++
)
{
for
(
int
j
=
0
;
j
<
(
int
)
group
.
getChildren
().
size
();
j
++
)
{
particles
.
push_back
(
group
.
getChildren
()[
j
].
getIntProperty
(
"p"
));
particles
.
push_back
(
group
.
getChildren
()[
j
].
getIntProperty
(
"p"
));
weights
.
push_back
(
group
.
getChildren
()[
j
].
getDoubleProperty
(
"weight"
));
if
(
group
.
getChildren
()[
j
].
hasProperty
(
"weight"
))
weights
.
push_back
(
group
.
getChildren
()[
j
].
getDoubleProperty
(
"weight"
));
}
}
force
->
addGroup
(
particles
,
weights
);
force
->
addGroup
(
particles
,
weights
);
}
}
...
...
serialization/tests/TestSerializeCustomCentroidBondForce.cpp
View file @
202c24d9
...
@@ -51,7 +51,8 @@ void testSerialization() {
...
@@ -51,7 +51,8 @@ void testSerialization() {
vector
<
double
>
weights
;
vector
<
double
>
weights
;
for
(
int
j
=
0
;
j
<
i
+
1
;
j
++
)
{
for
(
int
j
=
0
;
j
<
i
+
1
;
j
++
)
{
particles
.
push_back
(
i
+
j
);
particles
.
push_back
(
i
+
j
);
weights
.
push_back
(
1.0
/
(
i
+
1
));
if
(
i
<
2
)
weights
.
push_back
(
1.0
/
(
i
+
1
));
}
}
force
.
addGroup
(
particles
,
weights
);
force
.
addGroup
(
particles
,
weights
);
}
}
...
...
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