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
6786cc75
Unverified
Commit
6786cc75
authored
Feb 26, 2020
by
peastman
Committed by
GitHub
Feb 26, 2020
Browse files
Merge pull request #2561 from peastman/middle
Converted BAOABLangevinIntegrator to LangevinMiddleIntegrator
parents
3fdc297c
cc59da1a
Changes
44
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
21 deletions
+21
-21
serialization/src/LangevinMiddleIntegratorProxy.cpp
serialization/src/LangevinMiddleIntegratorProxy.cpp
+6
-6
serialization/src/SerializationProxyRegistration.cpp
serialization/src/SerializationProxyRegistration.cpp
+3
-3
serialization/tests/TestSerializeIntegrator.cpp
serialization/tests/TestSerializeIntegrator.cpp
+6
-6
tests/TestLangevinMiddleIntegrator.h
tests/TestLangevinMiddleIntegrator.h
+6
-6
No files found.
serialization/src/
BAOAB
LangevinIntegratorProxy.cpp
→
serialization/src/Langevin
Middle
IntegratorProxy.cpp
View file @
6786cc75
...
...
@@ -29,19 +29,19 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/serialization/
BAOAB
LangevinIntegratorProxy.h"
#include "openmm/serialization/Langevin
Middle
IntegratorProxy.h"
#include <OpenMM.h>
using
namespace
std
;
using
namespace
OpenMM
;
BAOAB
LangevinIntegratorProxy
::
BAOAB
LangevinIntegratorProxy
()
:
SerializationProxy
(
"
BAOAB
LangevinIntegrator"
)
{
Langevin
Middle
IntegratorProxy
::
Langevin
Middle
IntegratorProxy
()
:
SerializationProxy
(
"Langevin
Middle
Integrator"
)
{
}
void
BAOAB
LangevinIntegratorProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
void
Langevin
Middle
IntegratorProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
const
BAOAB
LangevinIntegrator
&
integrator
=
*
reinterpret_cast
<
const
BAOAB
LangevinIntegrator
*>
(
object
);
const
Langevin
Middle
Integrator
&
integrator
=
*
reinterpret_cast
<
const
Langevin
Middle
Integrator
*>
(
object
);
node
.
setDoubleProperty
(
"stepSize"
,
integrator
.
getStepSize
());
node
.
setDoubleProperty
(
"constraintTolerance"
,
integrator
.
getConstraintTolerance
());
node
.
setDoubleProperty
(
"temperature"
,
integrator
.
getTemperature
());
...
...
@@ -49,10 +49,10 @@ void BAOABLangevinIntegratorProxy::serialize(const void* object, SerializationNo
node
.
setIntProperty
(
"randomSeed"
,
integrator
.
getRandomNumberSeed
());
}
void
*
BAOAB
LangevinIntegratorProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
void
*
Langevin
Middle
IntegratorProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
throw
OpenMMException
(
"Unsupported version number"
);
BAOAB
LangevinIntegrator
*
integrator
=
new
BAOAB
LangevinIntegrator
(
node
.
getDoubleProperty
(
"temperature"
),
Langevin
Middle
Integrator
*
integrator
=
new
Langevin
Middle
Integrator
(
node
.
getDoubleProperty
(
"temperature"
),
node
.
getDoubleProperty
(
"friction"
),
node
.
getDoubleProperty
(
"stepSize"
));
integrator
->
setConstraintTolerance
(
node
.
getDoubleProperty
(
"constraintTolerance"
));
integrator
->
setRandomNumberSeed
(
node
.
getIntProperty
(
"randomSeed"
));
...
...
serialization/src/SerializationProxyRegistration.cpp
View file @
6786cc75
...
...
@@ -30,7 +30,6 @@
* -------------------------------------------------------------------------- */
#include "openmm/AndersenThermostat.h"
#include "openmm/BAOABLangevinIntegrator.h"
#include "openmm/BrownianIntegrator.h"
#include "openmm/CMAPTorsionForce.h"
#include "openmm/CMMotionRemover.h"
...
...
@@ -52,6 +51,7 @@
#include "openmm/HarmonicAngleForce.h"
#include "openmm/HarmonicBondForce.h"
#include "openmm/LangevinIntegrator.h"
#include "openmm/LangevinMiddleIntegrator.h"
#include "openmm/MonteCarloAnisotropicBarostat.h"
#include "openmm/MonteCarloBarostat.h"
#include "openmm/MonteCarloMembraneBarostat.h"
...
...
@@ -67,7 +67,6 @@
#include "openmm/VerletIntegrator.h"
#include "openmm/serialization/SerializationProxy.h"
#include "openmm/serialization/BAOABLangevinIntegratorProxy.h"
#include "openmm/serialization/BrownianIntegratorProxy.h"
#include "openmm/serialization/AndersenThermostatProxy.h"
#include "openmm/serialization/CMAPTorsionForceProxy.h"
...
...
@@ -90,6 +89,7 @@
#include "openmm/serialization/HarmonicAngleForceProxy.h"
#include "openmm/serialization/HarmonicBondForceProxy.h"
#include "openmm/serialization/LangevinIntegratorProxy.h"
#include "openmm/serialization/LangevinMiddleIntegratorProxy.h"
#include "openmm/serialization/MonteCarloAnisotropicBarostatProxy.h"
#include "openmm/serialization/MonteCarloBarostatProxy.h"
#include "openmm/serialization/MonteCarloMembraneBarostatProxy.h"
...
...
@@ -121,7 +121,6 @@ using namespace OpenMM;
extern
"C"
void
registerSerializationProxies
()
{
SerializationProxy
::
registerProxy
(
typeid
(
AndersenThermostat
),
new
AndersenThermostatProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
BAOABLangevinIntegrator
),
new
BAOABLangevinIntegratorProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
BrownianIntegrator
),
new
BrownianIntegratorProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
CMAPTorsionForce
),
new
CMAPTorsionForceProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
CMMotionRemover
),
new
CMMotionRemoverProxy
());
...
...
@@ -149,6 +148,7 @@ extern "C" void registerSerializationProxies() {
SerializationProxy
::
registerProxy
(
typeid
(
HarmonicAngleForce
),
new
HarmonicAngleForceProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
HarmonicBondForce
),
new
HarmonicBondForceProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
LangevinIntegrator
),
new
LangevinIntegratorProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
LangevinMiddleIntegrator
),
new
LangevinMiddleIntegratorProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
MonteCarloAnisotropicBarostat
),
new
MonteCarloAnisotropicBarostatProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
MonteCarloBarostat
),
new
MonteCarloBarostatProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
MonteCarloMembraneBarostat
),
new
MonteCarloMembraneBarostatProxy
());
...
...
serialization/tests/TestSerializeIntegrator.cpp
View file @
6786cc75
...
...
@@ -31,11 +31,11 @@
#include "openmm/internal/AssertionUtilities.h"
#include "openmm/BAOABLangevinIntegrator.h"
#include "openmm/BrownianIntegrator.h"
#include "openmm/CompoundIntegrator.h"
#include "openmm/CustomIntegrator.h"
#include "openmm/LangevinIntegrator.h"
#include "openmm/LangevinMiddleIntegrator.h"
#include "openmm/VariableLangevinIntegrator.h"
#include "openmm/VariableVerletIntegrator.h"
#include "openmm/VerletIntegrator.h"
...
...
@@ -75,11 +75,11 @@ void testSerializeLangevinIntegrator() {
delete
intg2
;
}
void
testSerialize
BAOAB
LangevinIntegrator
()
{
BAOAB
LangevinIntegrator
*
intg
=
new
BAOAB
LangevinIntegrator
(
372.4
,
1.234
,
0.0018
);
void
testSerializeLangevin
Middle
Integrator
()
{
Langevin
Middle
Integrator
*
intg
=
new
Langevin
Middle
Integrator
(
372.4
,
1.234
,
0.0018
);
stringstream
ss
;
XmlSerializer
::
serialize
<
Integrator
>
(
intg
,
"
BAOAB
LangevinIntegrator"
,
ss
);
BAOAB
LangevinIntegrator
*
intg2
=
dynamic_cast
<
BAOAB
LangevinIntegrator
*>
(
XmlSerializer
::
deserialize
<
Integrator
>
(
ss
));
XmlSerializer
::
serialize
<
Integrator
>
(
intg
,
"Langevin
Middle
Integrator"
,
ss
);
Langevin
Middle
Integrator
*
intg2
=
dynamic_cast
<
Langevin
Middle
Integrator
*>
(
XmlSerializer
::
deserialize
<
Integrator
>
(
ss
));
ASSERT_EQUAL
(
intg
->
getConstraintTolerance
(),
intg2
->
getConstraintTolerance
());
ASSERT_EQUAL
(
intg
->
getStepSize
(),
intg2
->
getStepSize
());
ASSERT_EQUAL
(
intg
->
getTemperature
(),
intg2
->
getTemperature
());
...
...
@@ -259,7 +259,7 @@ int main() {
testSerializeVariableLangevinIntegrator
();
testSerializeVariableVerletIntegrator
();
testSerializeLangevinIntegrator
();
testSerialize
BAOAB
LangevinIntegrator
();
testSerializeLangevin
Middle
Integrator
();
testSerializeCompoundIntegrator
();
}
catch
(
const
exception
&
e
)
{
...
...
tests/Test
BAOAB
LangevinIntegrator.h
→
tests/TestLangevin
Middle
Integrator.h
View file @
6786cc75
...
...
@@ -34,7 +34,7 @@
#include "openmm/HarmonicBondForce.h"
#include "openmm/NonbondedForce.h"
#include "openmm/System.h"
#include "openmm/
BAOAB
LangevinIntegrator.h"
#include "openmm/Langevin
Middle
Integrator.h"
#include "SimTKOpenMMRealType.h"
#include "sfmt/SFMT.h"
#include <iostream>
...
...
@@ -49,7 +49,7 @@ void testSingleBond() {
System
system
;
system
.
addParticle
(
2.0
);
system
.
addParticle
(
2.0
);
BAOAB
LangevinIntegrator
integrator
(
0
,
0.1
,
0.01
);
Langevin
Middle
Integrator
integrator
(
0
,
0.1
,
0.01
);
HarmonicBondForce
*
forceField
=
new
HarmonicBondForce
();
forceField
->
addBond
(
0
,
1
,
1.5
,
1
);
system
.
addForce
(
forceField
);
...
...
@@ -93,7 +93,7 @@ void testTemperature() {
const
double
temp
=
100.0
;
System
system
;
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
5
,
0
,
0
),
Vec3
(
0
,
5
,
0
),
Vec3
(
0
,
0
,
5
));
BAOAB
LangevinIntegrator
integrator
(
temp
,
3.0
,
0.01
);
Langevin
Middle
Integrator
integrator
(
temp
,
3.0
,
0.01
);
NonbondedForce
*
forceField
=
new
NonbondedForce
();
forceField
->
setNonbondedMethod
(
NonbondedForce
::
CutoffPeriodic
);
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
...
...
@@ -130,7 +130,7 @@ void testConstraints() {
const
int
numConstraints
=
5
;
const
double
temp
=
100.0
;
System
system
;
BAOAB
LangevinIntegrator
integrator
(
temp
,
2.0
,
0.01
);
Langevin
Middle
Integrator
integrator
(
temp
,
2.0
,
0.01
);
integrator
.
setConstraintTolerance
(
1e-5
);
NonbondedForce
*
forceField
=
new
NonbondedForce
();
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
...
...
@@ -181,7 +181,7 @@ void testConstrainedMasslessParticles() {
vector
<
Vec3
>
positions
(
2
);
positions
[
0
]
=
Vec3
(
-
1
,
0
,
0
);
positions
[
1
]
=
Vec3
(
1
,
0
,
0
);
BAOAB
LangevinIntegrator
integrator
(
300.0
,
2.0
,
0.01
);
Langevin
Middle
Integrator
integrator
(
300.0
,
2.0
,
0.01
);
bool
failed
=
false
;
try
{
// This should throw an exception.
...
...
@@ -208,7 +208,7 @@ void testRandomSeed() {
const
int
numParticles
=
8
;
const
double
temp
=
100.0
;
System
system
;
BAOAB
LangevinIntegrator
integrator
(
temp
,
2.0
,
0.01
);
Langevin
Middle
Integrator
integrator
(
temp
,
2.0
,
0.01
);
NonbondedForce
*
forceField
=
new
NonbondedForce
();
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
system
.
addParticle
(
2.0
);
...
...
Prev
1
2
3
Next
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