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
3c2a3b1f
Commit
3c2a3b1f
authored
Oct 03, 2016
by
Kyle Beauchamp
Browse files
Add support for customIntegrator serialization and test
parent
c2166480
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
4 deletions
+16
-4
serialization/src/CustomIntegratorProxy.cpp
serialization/src/CustomIntegratorProxy.cpp
+7
-1
serialization/tests/TestSerializeIntegrator.cpp
serialization/tests/TestSerializeIntegrator.cpp
+9
-3
No files found.
serialization/src/CustomIntegratorProxy.cpp
View file @
3c2a3b1f
...
...
@@ -107,6 +107,12 @@ void* CustomIntegratorProxy::deserialize(const SerializationNode& node) const {
integrator
->
addConstrainVelocities
();
}
else
if
(
computationType
==
CustomIntegrator
::
UpdateContextState
)
{
integrator
->
addUpdateContextState
();
}
else
if
(
computationType
==
CustomIntegrator
::
IfBlockStart
)
{
integrator
->
beginIfBlock
(
cit
->
getStringProperty
(
"computationExpression"
));
}
else
if
(
computationType
==
CustomIntegrator
::
WhileBlockStart
)
{
integrator
->
beginWhileBlock
(
cit
->
getStringProperty
(
"computationExpression"
));
}
else
if
(
computationType
==
CustomIntegrator
::
BlockEnd
)
{
integrator
->
endBlock
();
}
else
{
throw
(
OpenMMException
(
"Custom Integrator Deserialization: Unknown computation type"
));
}
...
...
@@ -115,4 +121,4 @@ void* CustomIntegratorProxy::deserialize(const SerializationNode& node) const {
integrator
->
setRandomNumberSeed
(
node
.
getIntProperty
(
"randomSeed"
));
integrator
->
setConstraintTolerance
(
node
.
getDoubleProperty
(
"constraintTolerance"
));
return
integrator
;
}
\ No newline at end of file
}
serialization/tests/TestSerializeIntegrator.cpp
View file @
3c2a3b1f
...
...
@@ -137,12 +137,20 @@ void testSerializeCustomIntegrator() {
intg
->
addGlobalVariable
(
"oute"
,
0
);
intg
->
addGlobalVariable
(
"oute1"
,
0
);
intg
->
addGlobalVariable
(
"oute2"
,
0
);
intg
->
addGlobalVariable
(
"conditional_v1"
,
0
);
intg
->
addGlobalVariable
(
"conditional_v2"
,
0
);
intg
->
addComputePerDof
(
"outf"
,
"f"
);
intg
->
addComputePerDof
(
"outf1"
,
"f1"
);
intg
->
addComputePerDof
(
"outf2"
,
"f2"
);
intg
->
addComputeGlobal
(
"oute"
,
"energy"
);
intg
->
addComputeGlobal
(
"oute1"
,
"energy1"
);
intg
->
addComputeGlobal
(
"oute2"
,
"energy2"
);
intg
->
beginIfBlock
(
"1 > 0"
);
intg
->
addComputeGlobal
(
"conditional_v1"
,
"1"
);
intg
->
endBlock
();
intg
->
beginWhileBlock
(
"0 > 1"
);
intg
->
addComputeGlobal
(
"conditional_v2"
,
"1"
);
intg
->
endBlock
();
intg
->
addUpdateContextState
();
intg
->
addConstrainVelocities
();
intg
->
addComputeSum
(
"summand2"
,
"v*v+f*f"
);
...
...
@@ -216,7 +224,7 @@ int main() {
testSerializeVerletIntegrator
();
testSerializeVariableLangevinIntegrator
();
testSerializeVariableVerletIntegrator
();
testSerializeLangevinIntegrator
();
testSerializeLangevinIntegrator
();
testSerializeCompoundIntegrator
();
}
catch
(
const
exception
&
e
)
{
...
...
@@ -224,5 +232,3 @@ int main() {
}
return
0
;
}
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