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
73f5921c
Commit
73f5921c
authored
Sep 24, 2010
by
Peter Eastman
Browse files
Continuing to implement serialization
parent
d350fb55
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
840 additions
and
4 deletions
+840
-4
serialization/include/openmm/serialization/CMAPTorsionForceProxy.h
...tion/include/openmm/serialization/CMAPTorsionForceProxy.h
+53
-0
serialization/include/openmm/serialization/CMMotionRemoverProxy.h
...ation/include/openmm/serialization/CMMotionRemoverProxy.h
+53
-0
serialization/include/openmm/serialization/GBVIForceProxy.h
serialization/include/openmm/serialization/GBVIForceProxy.h
+53
-0
serialization/include/openmm/serialization/MonteCarloBarostatProxy.h
...on/include/openmm/serialization/MonteCarloBarostatProxy.h
+53
-0
serialization/src/AndersenThermostatProxy.cpp
serialization/src/AndersenThermostatProxy.cpp
+3
-0
serialization/src/CMAPTorsionForceProxy.cpp
serialization/src/CMAPTorsionForceProxy.cpp
+92
-0
serialization/src/CMMotionRemoverProxy.cpp
serialization/src/CMMotionRemoverProxy.cpp
+63
-0
serialization/src/GBSAOBCForceProxy.cpp
serialization/src/GBSAOBCForceProxy.cpp
+3
-0
serialization/src/GBVIForceProxy.cpp
serialization/src/GBVIForceProxy.cpp
+91
-0
serialization/src/HarmonicAngleForceProxy.cpp
serialization/src/HarmonicAngleForceProxy.cpp
+4
-1
serialization/src/HarmonicBondForceProxy.cpp
serialization/src/HarmonicBondForceProxy.cpp
+4
-1
serialization/src/MonteCarloBarostatProxy.cpp
serialization/src/MonteCarloBarostatProxy.cpp
+67
-0
serialization/src/NonbondedForceProxy.cpp
serialization/src/NonbondedForceProxy.cpp
+3
-0
serialization/src/PeriodicTorsionForceProxy.cpp
serialization/src/PeriodicTorsionForceProxy.cpp
+4
-1
serialization/src/RBTorsionForceProxy.cpp
serialization/src/RBTorsionForceProxy.cpp
+4
-1
serialization/src/SerializationProxyRegistration.cpp
serialization/src/SerializationProxyRegistration.cpp
+12
-0
serialization/src/SystemProxy.cpp
serialization/src/SystemProxy.cpp
+3
-0
serialization/tests/TestSerializeCMAPTorsion.cpp
serialization/tests/TestSerializeCMAPTorsion.cpp
+107
-0
serialization/tests/TestSerializeCMMotionRemover.cpp
serialization/tests/TestSerializeCMMotionRemover.cpp
+68
-0
serialization/tests/TestSerializeGBVIForce.cpp
serialization/tests/TestSerializeGBVIForce.cpp
+100
-0
No files found.
serialization/include/openmm/serialization/CMAPTorsionForceProxy.h
0 → 100644
View file @
73f5921c
#ifndef OPENMM_CMAPTORSIONFORCE_PROXY_H_
#define OPENMM_CMAPTORSIONFORCE_PROXY_H_
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* 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. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/internal/windowsExport.h"
#include "openmm/serialization/SerializationProxy.h"
namespace
OpenMM
{
/**
* This is a proxy for serializing CMAPTorsionForce objects.
*/
class
OPENMM_EXPORT
CMAPTorsionForceProxy
:
public
SerializationProxy
{
public:
CMAPTorsionForceProxy
();
void
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
;
void
*
deserialize
(
const
SerializationNode
&
node
)
const
;
};
}
// namespace OpenMM
#endif
/*OPENMM_CMAPTORSIONFORCE_PROXY_H_*/
serialization/include/openmm/serialization/CMMotionRemoverProxy.h
0 → 100644
View file @
73f5921c
#ifndef OPENMM_CMMOTIONREMOVER_PROXY_H_
#define OPENMM_CMMOTIONREMOVER_PROXY_H_
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* 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. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/internal/windowsExport.h"
#include "openmm/serialization/SerializationProxy.h"
namespace
OpenMM
{
/**
* This is a proxy for serializing CMMotionRemover objects.
*/
class
OPENMM_EXPORT
CMMotionRemoverProxy
:
public
SerializationProxy
{
public:
CMMotionRemoverProxy
();
void
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
;
void
*
deserialize
(
const
SerializationNode
&
node
)
const
;
};
}
// namespace OpenMM
#endif
/*OPENMM_CMMOTIONREMOVER_PROXY_H_*/
serialization/include/openmm/serialization/GBVIForceProxy.h
0 → 100644
View file @
73f5921c
#ifndef OPENMM_GBVIFORCE_PROXY_H_
#define OPENMM_GBVIFORCE_PROXY_H_
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* 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. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/internal/windowsExport.h"
#include "openmm/serialization/SerializationProxy.h"
namespace
OpenMM
{
/**
* This is a proxy for serializing GBVIForce objects.
*/
class
OPENMM_EXPORT
GBVIForceProxy
:
public
SerializationProxy
{
public:
GBVIForceProxy
();
void
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
;
void
*
deserialize
(
const
SerializationNode
&
node
)
const
;
};
}
// namespace OpenMM
#endif
/*OPENMM_GBVIFORCE_PROXY_H_*/
serialization/include/openmm/serialization/MonteCarloBarostatProxy.h
0 → 100644
View file @
73f5921c
#ifndef OPENMM_MONTECARLOBAROSTAT_PROXY_H_
#define OPENMM_MONTECARLOBAROSTAT_PROXY_H_
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* 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. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/internal/windowsExport.h"
#include "openmm/serialization/SerializationProxy.h"
namespace
OpenMM
{
/**
* This is a proxy for serializing MonteCarloBarostat objects.
*/
class
OPENMM_EXPORT
MonteCarloBarostatProxy
:
public
SerializationProxy
{
public:
MonteCarloBarostatProxy
();
void
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
;
void
*
deserialize
(
const
SerializationNode
&
node
)
const
;
};
}
// namespace OpenMM
#endif
/*OPENMM_MONTECARLOBAROSTAT_PROXY_H_*/
serialization/src/AndersenThermostatProxy.cpp
View file @
73f5921c
...
@@ -42,6 +42,7 @@ AndersenThermostatProxy::AndersenThermostatProxy() : SerializationProxy("Anderse
...
@@ -42,6 +42,7 @@ AndersenThermostatProxy::AndersenThermostatProxy() : SerializationProxy("Anderse
}
}
void
AndersenThermostatProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
void
AndersenThermostatProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
const
AndersenThermostat
&
force
=
*
reinterpret_cast
<
const
AndersenThermostat
*>
(
object
);
const
AndersenThermostat
&
force
=
*
reinterpret_cast
<
const
AndersenThermostat
*>
(
object
);
node
.
setDoubleProperty
(
"temperature"
,
force
.
getDefaultTemperature
());
node
.
setDoubleProperty
(
"temperature"
,
force
.
getDefaultTemperature
());
node
.
setDoubleProperty
(
"frequency"
,
force
.
getDefaultCollisionFrequency
());
node
.
setDoubleProperty
(
"frequency"
,
force
.
getDefaultCollisionFrequency
());
...
@@ -49,6 +50,8 @@ void AndersenThermostatProxy::serialize(const void* object, SerializationNode& n
...
@@ -49,6 +50,8 @@ void AndersenThermostatProxy::serialize(const void* object, SerializationNode& n
}
}
void
*
AndersenThermostatProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
void
*
AndersenThermostatProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
throw
OpenMMException
(
"Unsupported version number"
);
AndersenThermostat
*
force
=
NULL
;
AndersenThermostat
*
force
=
NULL
;
try
{
try
{
AndersenThermostat
*
force
=
new
AndersenThermostat
(
node
.
getDoubleProperty
(
"temperature"
),
node
.
getDoubleProperty
(
"frequency"
));
AndersenThermostat
*
force
=
new
AndersenThermostat
(
node
.
getDoubleProperty
(
"temperature"
),
node
.
getDoubleProperty
(
"frequency"
));
...
...
serialization/src/CMAPTorsionForceProxy.cpp
0 → 100644
View file @
73f5921c
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* 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. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/serialization/CMAPTorsionForceProxy.h"
#include "openmm/serialization/SerializationNode.h"
#include "openmm/Force.h"
#include "openmm/CMAPTorsionForce.h"
#include <vector>
using
namespace
OpenMM
;
using
namespace
std
;
CMAPTorsionForceProxy
::
CMAPTorsionForceProxy
()
:
SerializationProxy
(
"CMAPTorsionForce"
)
{
}
void
CMAPTorsionForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
const
CMAPTorsionForce
&
force
=
*
reinterpret_cast
<
const
CMAPTorsionForce
*>
(
object
);
SerializationNode
&
maps
=
node
.
createChildNode
(
"Maps"
);
for
(
int
i
=
0
;
i
<
force
.
getNumMaps
();
i
++
)
{
int
size
;
vector
<
double
>
energy
;
force
.
getMapParameters
(
i
,
size
,
energy
);
SerializationNode
&
map
=
maps
.
createChildNode
(
"Torsion"
).
setIntProperty
(
"size"
,
size
);
for
(
int
i
=
0
;
i
<
(
int
)
energy
.
size
();
i
++
)
map
.
createChildNode
(
"Energy"
).
setDoubleProperty
(
"e"
,
energy
[
i
]);
}
SerializationNode
&
torsions
=
node
.
createChildNode
(
"Torsions"
);
for
(
int
i
=
0
;
i
<
force
.
getNumTorsions
();
i
++
)
{
int
map
,
a1
,
a2
,
a3
,
a4
,
b1
,
b2
,
b3
,
b4
;
force
.
getTorsionParameters
(
i
,
map
,
a1
,
a2
,
a3
,
a4
,
b1
,
b2
,
b3
,
b4
);
torsions
.
createChildNode
(
"Torsion"
).
setIntProperty
(
"a1"
,
a1
).
setIntProperty
(
"a2"
,
a2
).
setIntProperty
(
"a3"
,
a3
).
setIntProperty
(
"a4"
,
a4
).
setIntProperty
(
"b1"
,
b1
).
setIntProperty
(
"b2"
,
b2
).
setIntProperty
(
"b3"
,
b3
).
setIntProperty
(
"b4"
,
b4
).
setIntProperty
(
"map"
,
map
);
}
}
void
*
CMAPTorsionForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
throw
OpenMMException
(
"Unsupported version number"
);
CMAPTorsionForce
*
force
=
new
CMAPTorsionForce
();
try
{
const
SerializationNode
&
maps
=
node
.
getChildNode
(
"Maps"
);
for
(
int
i
=
0
;
i
<
(
int
)
maps
.
getChildren
().
size
();
i
++
)
{
const
SerializationNode
&
map
=
maps
.
getChildren
()[
i
];
int
size
=
map
.
getIntProperty
(
"size"
);
if
(
size
*
size
!=
map
.
getChildren
().
size
())
throw
OpenMMException
(
"Wrong number of values specified for CMAP"
);
vector
<
double
>
energy
(
size
*
size
);
for
(
int
j
=
0
;
j
<
(
int
)
energy
.
size
();
j
++
)
energy
[
j
]
=
map
.
getChildren
()[
j
].
getDoubleProperty
(
"e"
);
force
->
addMap
(
size
,
energy
);
}
const
SerializationNode
&
torsions
=
node
.
getChildNode
(
"Torsions"
);
for
(
int
i
=
0
;
i
<
(
int
)
torsions
.
getChildren
().
size
();
i
++
)
{
const
SerializationNode
&
torsion
=
torsions
.
getChildren
()[
i
];
force
->
addTorsion
(
torsion
.
getIntProperty
(
"map"
),
torsion
.
getIntProperty
(
"a1"
),
torsion
.
getIntProperty
(
"a2"
),
torsion
.
getIntProperty
(
"a3"
),
torsion
.
getIntProperty
(
"a4"
),
torsion
.
getIntProperty
(
"b1"
),
torsion
.
getIntProperty
(
"b2"
),
torsion
.
getIntProperty
(
"b3"
),
torsion
.
getIntProperty
(
"b4"
));
}
}
catch
(...)
{
delete
force
;
throw
;
}
return
force
;
}
serialization/src/CMMotionRemoverProxy.cpp
0 → 100644
View file @
73f5921c
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* 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. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/serialization/CMMotionRemoverProxy.h"
#include "openmm/serialization/SerializationNode.h"
#include "openmm/Force.h"
#include "openmm/CMMotionRemover.h"
#include <sstream>
using
namespace
OpenMM
;
using
namespace
std
;
CMMotionRemoverProxy
::
CMMotionRemoverProxy
()
:
SerializationProxy
(
"CMMotionRemover"
)
{
}
void
CMMotionRemoverProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
const
CMMotionRemover
&
force
=
*
reinterpret_cast
<
const
CMMotionRemover
*>
(
object
);
node
.
setIntProperty
(
"frequency"
,
force
.
getFrequency
());
}
void
*
CMMotionRemoverProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
throw
OpenMMException
(
"Unsupported version number"
);
CMMotionRemover
*
force
=
NULL
;
try
{
CMMotionRemover
*
force
=
new
CMMotionRemover
(
node
.
getIntProperty
(
"frequency"
));
return
force
;
}
catch
(...)
{
if
(
force
!=
NULL
)
delete
force
;
throw
;
}
}
serialization/src/GBSAOBCForceProxy.cpp
View file @
73f5921c
...
@@ -42,6 +42,7 @@ GBSAOBCForceProxy::GBSAOBCForceProxy() : SerializationProxy("GBSAOBCForce") {
...
@@ -42,6 +42,7 @@ GBSAOBCForceProxy::GBSAOBCForceProxy() : SerializationProxy("GBSAOBCForce") {
}
}
void
GBSAOBCForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
void
GBSAOBCForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
const
GBSAOBCForce
&
force
=
*
reinterpret_cast
<
const
GBSAOBCForce
*>
(
object
);
const
GBSAOBCForce
&
force
=
*
reinterpret_cast
<
const
GBSAOBCForce
*>
(
object
);
node
.
setIntProperty
(
"method"
,
(
int
)
force
.
getNonbondedMethod
());
node
.
setIntProperty
(
"method"
,
(
int
)
force
.
getNonbondedMethod
());
node
.
setDoubleProperty
(
"cutoff"
,
force
.
getCutoffDistance
());
node
.
setDoubleProperty
(
"cutoff"
,
force
.
getCutoffDistance
());
...
@@ -56,6 +57,8 @@ void GBSAOBCForceProxy::serialize(const void* object, SerializationNode& node) c
...
@@ -56,6 +57,8 @@ void GBSAOBCForceProxy::serialize(const void* object, SerializationNode& node) c
}
}
void
*
GBSAOBCForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
void
*
GBSAOBCForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
throw
OpenMMException
(
"Unsupported version number"
);
GBSAOBCForce
*
force
=
new
GBSAOBCForce
();
GBSAOBCForce
*
force
=
new
GBSAOBCForce
();
try
{
try
{
force
->
setNonbondedMethod
((
GBSAOBCForce
::
NonbondedMethod
)
node
.
getIntProperty
(
"method"
));
force
->
setNonbondedMethod
((
GBSAOBCForce
::
NonbondedMethod
)
node
.
getIntProperty
(
"method"
));
...
...
serialization/src/GBVIForceProxy.cpp
0 → 100644
View file @
73f5921c
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* 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. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/serialization/GBVIForceProxy.h"
#include "openmm/serialization/SerializationNode.h"
#include "openmm/Force.h"
#include "openmm/GBVIForce.h"
#include <sstream>
using
namespace
OpenMM
;
using
namespace
std
;
GBVIForceProxy
::
GBVIForceProxy
()
:
SerializationProxy
(
"GBVIForce"
)
{
}
void
GBVIForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
const
GBVIForce
&
force
=
*
reinterpret_cast
<
const
GBVIForce
*>
(
object
);
node
.
setIntProperty
(
"method"
,
(
int
)
force
.
getNonbondedMethod
());
node
.
setDoubleProperty
(
"cutoff"
,
force
.
getCutoffDistance
());
node
.
setDoubleProperty
(
"soluteDielectric"
,
force
.
getSoluteDielectric
());
node
.
setDoubleProperty
(
"solventDielectric"
,
force
.
getSolventDielectric
());
SerializationNode
&
particles
=
node
.
createChildNode
(
"Particles"
);
for
(
int
i
=
0
;
i
<
force
.
getNumParticles
();
i
++
)
{
double
charge
,
radius
,
gamma
;
force
.
getParticleParameters
(
i
,
charge
,
radius
,
gamma
);
particles
.
createChildNode
(
"Particle"
).
setDoubleProperty
(
"q"
,
charge
).
setDoubleProperty
(
"r"
,
radius
).
setDoubleProperty
(
"gamma"
,
gamma
);
}
SerializationNode
&
bonds
=
node
.
createChildNode
(
"Bonds"
);
for
(
int
i
=
0
;
i
<
force
.
getNumBonds
();
i
++
)
{
int
particle1
,
particle2
;
double
distance
;
force
.
getBondParameters
(
i
,
particle1
,
particle2
,
distance
);
bonds
.
createChildNode
(
"Bond"
).
setIntProperty
(
"p1"
,
particle1
).
setIntProperty
(
"p2"
,
particle2
).
setDoubleProperty
(
"d"
,
distance
);
}
}
void
*
GBVIForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
throw
OpenMMException
(
"Unsupported version number"
);
GBVIForce
*
force
=
new
GBVIForce
();
try
{
force
->
setNonbondedMethod
((
GBVIForce
::
NonbondedMethod
)
node
.
getIntProperty
(
"method"
));
force
->
setCutoffDistance
(
node
.
getDoubleProperty
(
"cutoff"
));
force
->
setSoluteDielectric
(
node
.
getDoubleProperty
(
"soluteDielectric"
));
force
->
setSolventDielectric
(
node
.
getDoubleProperty
(
"solventDielectric"
));
const
SerializationNode
&
particles
=
node
.
getChildNode
(
"Particles"
);
for
(
int
i
=
0
;
i
<
(
int
)
particles
.
getChildren
().
size
();
i
++
)
{
const
SerializationNode
&
particle
=
particles
.
getChildren
()[
i
];
force
->
addParticle
(
particle
.
getDoubleProperty
(
"q"
),
particle
.
getDoubleProperty
(
"r"
),
particle
.
getDoubleProperty
(
"gamma"
));
}
const
SerializationNode
&
bonds
=
node
.
getChildNode
(
"Bonds"
);
for
(
int
i
=
0
;
i
<
(
int
)
bonds
.
getChildren
().
size
();
i
++
)
{
const
SerializationNode
&
bond
=
bonds
.
getChildren
()[
i
];
force
->
addBond
(
bond
.
getIntProperty
(
"p1"
),
bond
.
getIntProperty
(
"p2"
),
bond
.
getDoubleProperty
(
"d"
));
}
}
catch
(...)
{
delete
force
;
throw
;
}
return
force
;
}
serialization/src/HarmonicAngleForceProxy.cpp
View file @
73f5921c
...
@@ -42,6 +42,7 @@ HarmonicAngleForceProxy::HarmonicAngleForceProxy() : SerializationProxy("Harmoni
...
@@ -42,6 +42,7 @@ HarmonicAngleForceProxy::HarmonicAngleForceProxy() : SerializationProxy("Harmoni
}
}
void
HarmonicAngleForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
void
HarmonicAngleForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
const
HarmonicAngleForce
&
force
=
*
reinterpret_cast
<
const
HarmonicAngleForce
*>
(
object
);
const
HarmonicAngleForce
&
force
=
*
reinterpret_cast
<
const
HarmonicAngleForce
*>
(
object
);
SerializationNode
&
bonds
=
node
.
createChildNode
(
"Angles"
);
SerializationNode
&
bonds
=
node
.
createChildNode
(
"Angles"
);
for
(
int
i
=
0
;
i
<
force
.
getNumAngles
();
i
++
)
{
for
(
int
i
=
0
;
i
<
force
.
getNumAngles
();
i
++
)
{
...
@@ -53,12 +54,14 @@ void HarmonicAngleForceProxy::serialize(const void* object, SerializationNode& n
...
@@ -53,12 +54,14 @@ void HarmonicAngleForceProxy::serialize(const void* object, SerializationNode& n
}
}
void
*
HarmonicAngleForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
void
*
HarmonicAngleForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
throw
OpenMMException
(
"Unsupported version number"
);
HarmonicAngleForce
*
force
=
new
HarmonicAngleForce
();
HarmonicAngleForce
*
force
=
new
HarmonicAngleForce
();
try
{
try
{
const
SerializationNode
&
angles
=
node
.
getChildNode
(
"Angles"
);
const
SerializationNode
&
angles
=
node
.
getChildNode
(
"Angles"
);
for
(
int
i
=
0
;
i
<
(
int
)
angles
.
getChildren
().
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
(
int
)
angles
.
getChildren
().
size
();
i
++
)
{
const
SerializationNode
&
angle
=
angles
.
getChildren
()[
i
];
const
SerializationNode
&
angle
=
angles
.
getChildren
()[
i
];
force
->
addAngle
(
angle
.
get
Double
Property
(
"p1"
),
angle
.
get
Double
Property
(
"p2"
),
angle
.
get
Double
Property
(
"p3"
),
angle
.
getDoubleProperty
(
"a"
),
angle
.
getDoubleProperty
(
"k"
));
force
->
addAngle
(
angle
.
get
Int
Property
(
"p1"
),
angle
.
get
Int
Property
(
"p2"
),
angle
.
get
Int
Property
(
"p3"
),
angle
.
getDoubleProperty
(
"a"
),
angle
.
getDoubleProperty
(
"k"
));
}
}
}
}
catch
(...)
{
catch
(...)
{
...
...
serialization/src/HarmonicBondForceProxy.cpp
View file @
73f5921c
...
@@ -42,6 +42,7 @@ HarmonicBondForceProxy::HarmonicBondForceProxy() : SerializationProxy("HarmonicB
...
@@ -42,6 +42,7 @@ HarmonicBondForceProxy::HarmonicBondForceProxy() : SerializationProxy("HarmonicB
}
}
void
HarmonicBondForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
void
HarmonicBondForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
const
HarmonicBondForce
&
force
=
*
reinterpret_cast
<
const
HarmonicBondForce
*>
(
object
);
const
HarmonicBondForce
&
force
=
*
reinterpret_cast
<
const
HarmonicBondForce
*>
(
object
);
SerializationNode
&
bonds
=
node
.
createChildNode
(
"Bonds"
);
SerializationNode
&
bonds
=
node
.
createChildNode
(
"Bonds"
);
for
(
int
i
=
0
;
i
<
force
.
getNumBonds
();
i
++
)
{
for
(
int
i
=
0
;
i
<
force
.
getNumBonds
();
i
++
)
{
...
@@ -53,12 +54,14 @@ void HarmonicBondForceProxy::serialize(const void* object, SerializationNode& no
...
@@ -53,12 +54,14 @@ void HarmonicBondForceProxy::serialize(const void* object, SerializationNode& no
}
}
void
*
HarmonicBondForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
void
*
HarmonicBondForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
throw
OpenMMException
(
"Unsupported version number"
);
HarmonicBondForce
*
force
=
new
HarmonicBondForce
();
HarmonicBondForce
*
force
=
new
HarmonicBondForce
();
try
{
try
{
const
SerializationNode
&
bonds
=
node
.
getChildNode
(
"Bonds"
);
const
SerializationNode
&
bonds
=
node
.
getChildNode
(
"Bonds"
);
for
(
int
i
=
0
;
i
<
(
int
)
bonds
.
getChildren
().
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
(
int
)
bonds
.
getChildren
().
size
();
i
++
)
{
const
SerializationNode
&
bond
=
bonds
.
getChildren
()[
i
];
const
SerializationNode
&
bond
=
bonds
.
getChildren
()[
i
];
force
->
addBond
(
bond
.
get
Double
Property
(
"p1"
),
bond
.
get
Double
Property
(
"p2"
),
bond
.
getDoubleProperty
(
"d"
),
bond
.
getDoubleProperty
(
"k"
));
force
->
addBond
(
bond
.
get
Int
Property
(
"p1"
),
bond
.
get
Int
Property
(
"p2"
),
bond
.
getDoubleProperty
(
"d"
),
bond
.
getDoubleProperty
(
"k"
));
}
}
}
}
catch
(...)
{
catch
(...)
{
...
...
serialization/src/MonteCarloBarostatProxy.cpp
0 → 100644
View file @
73f5921c
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* 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. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/serialization/MonteCarloBarostatProxy.h"
#include "openmm/serialization/SerializationNode.h"
#include "openmm/Force.h"
#include "openmm/MonteCarloBarostat.h"
#include <sstream>
using
namespace
OpenMM
;
using
namespace
std
;
MonteCarloBarostatProxy
::
MonteCarloBarostatProxy
()
:
SerializationProxy
(
"MonteCarloBarostat"
)
{
}
void
MonteCarloBarostatProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
const
MonteCarloBarostat
&
force
=
*
reinterpret_cast
<
const
MonteCarloBarostat
*>
(
object
);
node
.
setDoubleProperty
(
"pressure"
,
force
.
getDefaultPressure
());
node
.
setDoubleProperty
(
"temperature"
,
force
.
getTemperature
());
node
.
setIntProperty
(
"frequency"
,
force
.
getFrequency
());
node
.
setIntProperty
(
"randomSeed"
,
force
.
getRandomNumberSeed
());
}
void
*
MonteCarloBarostatProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
throw
OpenMMException
(
"Unsupported version number"
);
MonteCarloBarostat
*
force
=
NULL
;
try
{
MonteCarloBarostat
*
force
=
new
MonteCarloBarostat
(
node
.
getDoubleProperty
(
"pressure"
),
node
.
getDoubleProperty
(
"temperature"
),
node
.
getIntProperty
(
"frequency"
));
force
->
setRandomNumberSeed
(
node
.
getIntProperty
(
"randomSeed"
));
return
force
;
}
catch
(...)
{
if
(
force
!=
NULL
)
delete
force
;
throw
;
}
}
serialization/src/NonbondedForceProxy.cpp
View file @
73f5921c
...
@@ -42,6 +42,7 @@ NonbondedForceProxy::NonbondedForceProxy() : SerializationProxy("NonbondedForce"
...
@@ -42,6 +42,7 @@ NonbondedForceProxy::NonbondedForceProxy() : SerializationProxy("NonbondedForce"
}
}
void
NonbondedForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
void
NonbondedForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
const
NonbondedForce
&
force
=
*
reinterpret_cast
<
const
NonbondedForce
*>
(
object
);
const
NonbondedForce
&
force
=
*
reinterpret_cast
<
const
NonbondedForce
*>
(
object
);
node
.
setIntProperty
(
"method"
,
(
int
)
force
.
getNonbondedMethod
());
node
.
setIntProperty
(
"method"
,
(
int
)
force
.
getNonbondedMethod
());
node
.
setDoubleProperty
(
"cutoff"
,
force
.
getCutoffDistance
());
node
.
setDoubleProperty
(
"cutoff"
,
force
.
getCutoffDistance
());
...
@@ -64,6 +65,8 @@ void NonbondedForceProxy::serialize(const void* object, SerializationNode& node)
...
@@ -64,6 +65,8 @@ void NonbondedForceProxy::serialize(const void* object, SerializationNode& node)
}
}
void
*
NonbondedForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
void
*
NonbondedForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
throw
OpenMMException
(
"Unsupported version number"
);
NonbondedForce
*
force
=
new
NonbondedForce
();
NonbondedForce
*
force
=
new
NonbondedForce
();
try
{
try
{
force
->
setNonbondedMethod
((
NonbondedForce
::
NonbondedMethod
)
node
.
getIntProperty
(
"method"
));
force
->
setNonbondedMethod
((
NonbondedForce
::
NonbondedMethod
)
node
.
getIntProperty
(
"method"
));
...
...
serialization/src/PeriodicTorsionForceProxy.cpp
View file @
73f5921c
...
@@ -42,6 +42,7 @@ PeriodicTorsionForceProxy::PeriodicTorsionForceProxy() : SerializationProxy("Per
...
@@ -42,6 +42,7 @@ PeriodicTorsionForceProxy::PeriodicTorsionForceProxy() : SerializationProxy("Per
}
}
void
PeriodicTorsionForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
void
PeriodicTorsionForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
const
PeriodicTorsionForce
&
force
=
*
reinterpret_cast
<
const
PeriodicTorsionForce
*>
(
object
);
const
PeriodicTorsionForce
&
force
=
*
reinterpret_cast
<
const
PeriodicTorsionForce
*>
(
object
);
SerializationNode
&
torsions
=
node
.
createChildNode
(
"Torsions"
);
SerializationNode
&
torsions
=
node
.
createChildNode
(
"Torsions"
);
for
(
int
i
=
0
;
i
<
force
.
getNumTorsions
();
i
++
)
{
for
(
int
i
=
0
;
i
<
force
.
getNumTorsions
();
i
++
)
{
...
@@ -53,12 +54,14 @@ void PeriodicTorsionForceProxy::serialize(const void* object, SerializationNode&
...
@@ -53,12 +54,14 @@ void PeriodicTorsionForceProxy::serialize(const void* object, SerializationNode&
}
}
void
*
PeriodicTorsionForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
void
*
PeriodicTorsionForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
throw
OpenMMException
(
"Unsupported version number"
);
PeriodicTorsionForce
*
force
=
new
PeriodicTorsionForce
();
PeriodicTorsionForce
*
force
=
new
PeriodicTorsionForce
();
try
{
try
{
const
SerializationNode
&
torsions
=
node
.
getChildNode
(
"Torsions"
);
const
SerializationNode
&
torsions
=
node
.
getChildNode
(
"Torsions"
);
for
(
int
i
=
0
;
i
<
(
int
)
torsions
.
getChildren
().
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
(
int
)
torsions
.
getChildren
().
size
();
i
++
)
{
const
SerializationNode
&
torsion
=
torsions
.
getChildren
()[
i
];
const
SerializationNode
&
torsion
=
torsions
.
getChildren
()[
i
];
force
->
addTorsion
(
torsion
.
get
Double
Property
(
"p1"
),
torsion
.
get
Double
Property
(
"p2"
),
torsion
.
get
Double
Property
(
"p3"
),
torsion
.
get
Double
Property
(
"p4"
),
force
->
addTorsion
(
torsion
.
get
Int
Property
(
"p1"
),
torsion
.
get
Int
Property
(
"p2"
),
torsion
.
get
Int
Property
(
"p3"
),
torsion
.
get
Int
Property
(
"p4"
),
torsion
.
getIntProperty
(
"periodicity"
),
torsion
.
getDoubleProperty
(
"phase"
),
torsion
.
getDoubleProperty
(
"k"
));
torsion
.
getIntProperty
(
"periodicity"
),
torsion
.
getDoubleProperty
(
"phase"
),
torsion
.
getDoubleProperty
(
"k"
));
}
}
}
}
...
...
serialization/src/RBTorsionForceProxy.cpp
View file @
73f5921c
...
@@ -42,6 +42,7 @@ RBTorsionForceProxy::RBTorsionForceProxy() : SerializationProxy("RBTorsionForce"
...
@@ -42,6 +42,7 @@ RBTorsionForceProxy::RBTorsionForceProxy() : SerializationProxy("RBTorsionForce"
}
}
void
RBTorsionForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
void
RBTorsionForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
const
RBTorsionForce
&
force
=
*
reinterpret_cast
<
const
RBTorsionForce
*>
(
object
);
const
RBTorsionForce
&
force
=
*
reinterpret_cast
<
const
RBTorsionForce
*>
(
object
);
SerializationNode
&
torsions
=
node
.
createChildNode
(
"Torsions"
);
SerializationNode
&
torsions
=
node
.
createChildNode
(
"Torsions"
);
for
(
int
i
=
0
;
i
<
force
.
getNumTorsions
();
i
++
)
{
for
(
int
i
=
0
;
i
<
force
.
getNumTorsions
();
i
++
)
{
...
@@ -53,12 +54,14 @@ void RBTorsionForceProxy::serialize(const void* object, SerializationNode& node)
...
@@ -53,12 +54,14 @@ void RBTorsionForceProxy::serialize(const void* object, SerializationNode& node)
}
}
void
*
RBTorsionForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
void
*
RBTorsionForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
throw
OpenMMException
(
"Unsupported version number"
);
RBTorsionForce
*
force
=
new
RBTorsionForce
();
RBTorsionForce
*
force
=
new
RBTorsionForce
();
try
{
try
{
const
SerializationNode
&
torsions
=
node
.
getChildNode
(
"Torsions"
);
const
SerializationNode
&
torsions
=
node
.
getChildNode
(
"Torsions"
);
for
(
int
i
=
0
;
i
<
(
int
)
torsions
.
getChildren
().
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
(
int
)
torsions
.
getChildren
().
size
();
i
++
)
{
const
SerializationNode
&
torsion
=
torsions
.
getChildren
()[
i
];
const
SerializationNode
&
torsion
=
torsions
.
getChildren
()[
i
];
force
->
addTorsion
(
torsion
.
get
Double
Property
(
"p1"
),
torsion
.
get
Double
Property
(
"p2"
),
torsion
.
get
Double
Property
(
"p3"
),
torsion
.
get
Double
Property
(
"p4"
),
force
->
addTorsion
(
torsion
.
get
Int
Property
(
"p1"
),
torsion
.
get
Int
Property
(
"p2"
),
torsion
.
get
Int
Property
(
"p3"
),
torsion
.
get
Int
Property
(
"p4"
),
torsion
.
getDoubleProperty
(
"c0"
),
torsion
.
getDoubleProperty
(
"c1"
),
torsion
.
getDoubleProperty
(
"c2"
),
torsion
.
getDoubleProperty
(
"c0"
),
torsion
.
getDoubleProperty
(
"c1"
),
torsion
.
getDoubleProperty
(
"c2"
),
torsion
.
getDoubleProperty
(
"c3"
),
torsion
.
getDoubleProperty
(
"c4"
),
torsion
.
getDoubleProperty
(
"c5"
));
torsion
.
getDoubleProperty
(
"c3"
),
torsion
.
getDoubleProperty
(
"c4"
),
torsion
.
getDoubleProperty
(
"c5"
));
}
}
...
...
serialization/src/SerializationProxyRegistration.cpp
View file @
73f5921c
...
@@ -30,18 +30,26 @@
...
@@ -30,18 +30,26 @@
* -------------------------------------------------------------------------- */
* -------------------------------------------------------------------------- */
#include "openmm/AndersenThermostat.h"
#include "openmm/AndersenThermostat.h"
#include "openmm/CMAPTorsionForce.h"
#include "openmm/CMMotionRemover.h"
#include "openmm/HarmonicAngleForce.h"
#include "openmm/HarmonicAngleForce.h"
#include "openmm/GBSAOBCForce.h"
#include "openmm/GBSAOBCForce.h"
#include "openmm/GBVIForce.h"
#include "openmm/HarmonicBondForce.h"
#include "openmm/HarmonicBondForce.h"
#include "openmm/MonteCarloBarostat.h"
#include "openmm/NonbondedForce.h"
#include "openmm/NonbondedForce.h"
#include "openmm/PeriodicTorsionForce.h"
#include "openmm/PeriodicTorsionForce.h"
#include "openmm/RBTorsionForce.h"
#include "openmm/RBTorsionForce.h"
#include "openmm/System.h"
#include "openmm/System.h"
#include "openmm/serialization/SerializationProxy.h"
#include "openmm/serialization/SerializationProxy.h"
#include "openmm/serialization/AndersenThermostatProxy.h"
#include "openmm/serialization/AndersenThermostatProxy.h"
#include "openmm/serialization/CMAPTorsionForceProxy.h"
#include "openmm/serialization/CMMotionRemoverProxy.h"
#include "openmm/serialization/GBSAOBCForceProxy.h"
#include "openmm/serialization/GBSAOBCForceProxy.h"
#include "openmm/serialization/GBVIForceProxy.h"
#include "openmm/serialization/HarmonicAngleForceProxy.h"
#include "openmm/serialization/HarmonicAngleForceProxy.h"
#include "openmm/serialization/HarmonicBondForceProxy.h"
#include "openmm/serialization/HarmonicBondForceProxy.h"
#include "openmm/serialization/MonteCarloBarostatProxy.h"
#include "openmm/serialization/NonbondedForceProxy.h"
#include "openmm/serialization/NonbondedForceProxy.h"
#include "openmm/serialization/PeriodicTorsionForceProxy.h"
#include "openmm/serialization/PeriodicTorsionForceProxy.h"
#include "openmm/serialization/RBTorsionForceProxy.h"
#include "openmm/serialization/RBTorsionForceProxy.h"
...
@@ -63,9 +71,13 @@ using namespace OpenMM;
...
@@ -63,9 +71,13 @@ using namespace OpenMM;
extern
"C"
void
registerSerializationProxies
()
{
extern
"C"
void
registerSerializationProxies
()
{
SerializationProxy
::
registerProxy
(
typeid
(
AndersenThermostat
),
new
AndersenThermostatProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
AndersenThermostat
),
new
AndersenThermostatProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
CMAPTorsionForce
),
new
CMAPTorsionForceProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
CMMotionRemover
),
new
CMMotionRemoverProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
GBSAOBCForce
),
new
GBSAOBCForceProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
GBSAOBCForce
),
new
GBSAOBCForceProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
GBVIForce
),
new
GBVIForceProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
HarmonicAngleForce
),
new
HarmonicAngleForceProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
HarmonicAngleForce
),
new
HarmonicAngleForceProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
HarmonicBondForce
),
new
HarmonicBondForceProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
HarmonicBondForce
),
new
HarmonicBondForceProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
MonteCarloBarostat
),
new
MonteCarloBarostatProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
NonbondedForce
),
new
NonbondedForceProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
NonbondedForce
),
new
NonbondedForceProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
PeriodicTorsionForce
),
new
PeriodicTorsionForceProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
PeriodicTorsionForce
),
new
PeriodicTorsionForceProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
RBTorsionForce
),
new
RBTorsionForceProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
RBTorsionForce
),
new
RBTorsionForceProxy
());
...
...
serialization/src/SystemProxy.cpp
View file @
73f5921c
...
@@ -42,6 +42,7 @@ SystemProxy::SystemProxy() : SerializationProxy("System") {
...
@@ -42,6 +42,7 @@ SystemProxy::SystemProxy() : SerializationProxy("System") {
}
}
void
SystemProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
void
SystemProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
const
System
&
system
=
*
reinterpret_cast
<
const
System
*>
(
object
);
const
System
&
system
=
*
reinterpret_cast
<
const
System
*>
(
object
);
Vec3
a
,
b
,
c
;
Vec3
a
,
b
,
c
;
system
.
getDefaultPeriodicBoxVectors
(
a
,
b
,
c
);
system
.
getDefaultPeriodicBoxVectors
(
a
,
b
,
c
);
...
@@ -65,6 +66,8 @@ void SystemProxy::serialize(const void* object, SerializationNode& node) const {
...
@@ -65,6 +66,8 @@ void SystemProxy::serialize(const void* object, SerializationNode& node) const {
}
}
void
*
SystemProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
void
*
SystemProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
throw
OpenMMException
(
"Unsupported version number"
);
System
*
system
=
new
System
();
System
*
system
=
new
System
();
try
{
try
{
const
SerializationNode
&
box
=
node
.
getChildNode
(
"PeriodicBoxVectors"
);
const
SerializationNode
&
box
=
node
.
getChildNode
(
"PeriodicBoxVectors"
);
...
...
serialization/tests/TestSerializeCMAPTorsion.cpp
0 → 100644
View file @
73f5921c
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* 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. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "../../../tests/AssertionUtilities.h"
#include "openmm/CMAPTorsionForce.h"
#include "openmm/serialization/XmlSerializer.h"
#include <iostream>
#include <sstream>
using
namespace
OpenMM
;
using
namespace
std
;
void
testSerialization
()
{
// Create a Force.
CMAPTorsionForce
force
;
vector
<
double
>
map1
(
9
);
for
(
int
i
=
0
;
i
<
9
;
i
++
)
map1
[
i
]
=
0.1
*
i
;
force
.
addMap
(
3
,
map1
);
vector
<
double
>
map2
(
16
);
for
(
int
i
=
0
;
i
<
16
;
i
++
)
map2
[
i
]
=
0.2
*
i
;
force
.
addMap
(
4
,
map2
);
force
.
addTorsion
(
0
,
0
,
1
,
2
,
3
,
2
,
3
,
4
,
5
);
force
.
addTorsion
(
0
,
0
,
2
,
3
,
4
,
5
,
6
,
7
,
8
);
force
.
addTorsion
(
1
,
2
,
3
,
4
,
7
,
1
,
2
,
3
,
4
);
force
.
addTorsion
(
1
,
5
,
1
,
2
,
3
,
2
,
3
,
4
,
8
);
// Serialize and then deserialize it.
stringstream
buffer
;
XmlSerializer
::
serialize
<
CMAPTorsionForce
>
(
&
force
,
"Force"
,
buffer
);
CMAPTorsionForce
*
copy
=
XmlSerializer
::
deserialize
<
CMAPTorsionForce
>
(
buffer
);
// Compare the two forces to see if they are identical.
CMAPTorsionForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getNumMaps
(),
force2
.
getNumMaps
());
for
(
int
i
=
0
;
i
<
force
.
getNumMaps
();
i
++
)
{
int
size1
,
size2
;
vector
<
double
>
energy1
,
energy2
;
force
.
getMapParameters
(
i
,
size1
,
energy1
);
force2
.
getMapParameters
(
i
,
size2
,
energy2
);
ASSERT_EQUAL
(
size1
,
size2
);
ASSERT_EQUAL
(
energy1
.
size
(),
energy2
.
size
());
for
(
int
j
=
0
;
j
<
(
int
)
energy1
.
size
();
j
++
)
ASSERT_EQUAL
(
energy1
[
j
],
energy2
[
j
]);
}
ASSERT_EQUAL
(
force
.
getNumTorsions
(),
force2
.
getNumTorsions
());
for
(
int
i
=
0
;
i
<
force
.
getNumTorsions
();
i
++
)
{
int
map1
,
map2
;
int
a11
,
a21
,
a31
,
a41
,
a12
,
a22
,
a32
,
a42
;
int
b11
,
b21
,
b31
,
b41
,
b12
,
b22
,
b32
,
b42
;
force
.
getTorsionParameters
(
i
,
map1
,
a11
,
a21
,
a31
,
a41
,
b11
,
b21
,
b31
,
b41
);
force2
.
getTorsionParameters
(
i
,
map2
,
a12
,
a22
,
a32
,
a42
,
b12
,
b22
,
b32
,
b42
);
ASSERT_EQUAL
(
map1
,
map2
);
ASSERT_EQUAL
(
a11
,
a12
);
ASSERT_EQUAL
(
a21
,
a22
);
ASSERT_EQUAL
(
a31
,
a32
);
ASSERT_EQUAL
(
a41
,
a42
);
ASSERT_EQUAL
(
b11
,
b12
);
ASSERT_EQUAL
(
b21
,
b22
);
ASSERT_EQUAL
(
b31
,
b32
);
ASSERT_EQUAL
(
b41
,
b42
);
}
}
int
main
()
{
try
{
testSerialization
();
}
catch
(
const
exception
&
e
)
{
cout
<<
"exception: "
<<
e
.
what
()
<<
endl
;
return
1
;
}
cout
<<
"Done"
<<
endl
;
return
0
;
}
serialization/tests/TestSerializeCMMotionRemover.cpp
0 → 100644
View file @
73f5921c
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* 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. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "../../../tests/AssertionUtilities.h"
#include "openmm/CMMotionRemover.h"
#include "openmm/serialization/XmlSerializer.h"
#include <iostream>
#include <sstream>
using
namespace
OpenMM
;
using
namespace
std
;
void
testSerialization
()
{
// Create a Force.
CMMotionRemover
force
(
5
);
// Serialize and then deserialize it.
stringstream
buffer
;
XmlSerializer
::
serialize
<
CMMotionRemover
>
(
&
force
,
"Force"
,
buffer
);
CMMotionRemover
*
copy
=
XmlSerializer
::
deserialize
<
CMMotionRemover
>
(
buffer
);
// Compare the two forces to see if they are identical.
CMMotionRemover
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getFrequency
(),
force2
.
getFrequency
());
}
int
main
()
{
try
{
testSerialization
();
}
catch
(
const
exception
&
e
)
{
cout
<<
"exception: "
<<
e
.
what
()
<<
endl
;
return
1
;
}
cout
<<
"Done"
<<
endl
;
return
0
;
}
serialization/tests/TestSerializeGBVIForce.cpp
0 → 100644
View file @
73f5921c
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* 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. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "../../../tests/AssertionUtilities.h"
#include "openmm/GBVIForce.h"
#include "openmm/serialization/XmlSerializer.h"
#include <iostream>
#include <sstream>
using
namespace
OpenMM
;
using
namespace
std
;
void
testSerialization
()
{
// Create a Force.
GBVIForce
force
;
force
.
setNonbondedMethod
(
GBVIForce
::
CutoffPeriodic
);
force
.
setCutoffDistance
(
2.0
);
force
.
setSoluteDielectric
(
5.1
);
force
.
setSolventDielectric
(
50.0
);
force
.
addParticle
(
1
,
0.1
,
0.01
);
force
.
addParticle
(
0.5
,
0.2
,
0.02
);
force
.
addParticle
(
-
0.5
,
0.3
,
0.03
);
force
.
addBond
(
0
,
1
,
2.0
);
force
.
addBond
(
3
,
5
,
1.2
);
// Serialize and then deserialize it.
stringstream
buffer
;
XmlSerializer
::
serialize
<
GBVIForce
>
(
&
force
,
"Force"
,
buffer
);
GBVIForce
*
copy
=
XmlSerializer
::
deserialize
<
GBVIForce
>
(
buffer
);
// Compare the two forces to see if they are identical.
GBVIForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getNonbondedMethod
(),
force2
.
getNonbondedMethod
());
ASSERT_EQUAL
(
force
.
getCutoffDistance
(),
force2
.
getCutoffDistance
());
ASSERT_EQUAL
(
force
.
getSoluteDielectric
(),
force2
.
getSoluteDielectric
());
ASSERT_EQUAL
(
force
.
getSolventDielectric
(),
force2
.
getSolventDielectric
());
ASSERT_EQUAL
(
force
.
getNumParticles
(),
force2
.
getNumParticles
());
for
(
int
i
=
0
;
i
<
force
.
getNumParticles
();
i
++
)
{
double
charge1
,
radius1
,
scale1
;
double
charge2
,
radius2
,
scale2
;
force
.
getParticleParameters
(
i
,
charge1
,
radius1
,
scale1
);
force2
.
getParticleParameters
(
i
,
charge2
,
radius2
,
scale2
);
ASSERT_EQUAL
(
charge1
,
charge2
);
ASSERT_EQUAL
(
radius1
,
radius2
);
ASSERT_EQUAL
(
scale1
,
scale2
);
}
ASSERT_EQUAL
(
force
.
getNumBonds
(),
force2
.
getNumBonds
());
for
(
int
i
=
0
;
i
<
force
.
getNumBonds
();
i
++
)
{
int
a1
,
a2
,
b1
,
b2
;
double
da
,
db
;
force
.
getBondParameters
(
i
,
a1
,
a2
,
da
);
force2
.
getBondParameters
(
i
,
b1
,
b2
,
db
);
ASSERT_EQUAL
(
a1
,
b1
);
ASSERT_EQUAL
(
a2
,
b2
);
ASSERT_EQUAL
(
da
,
db
);
}
}
int
main
()
{
try
{
testSerialization
();
}
catch
(
const
exception
&
e
)
{
cout
<<
"exception: "
<<
e
.
what
()
<<
endl
;
return
1
;
}
cout
<<
"Done"
<<
endl
;
return
0
;
}
Prev
1
2
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