Commit a5d900d1 authored by peastman's avatar peastman
Browse files

Merge pull request #1340 from peastman/amoebagroups

Record force group for AMOEBA forces
parents 34fdeae4 7ccd10ca
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -42,10 +42,11 @@ AmoebaAngleForceProxy::AmoebaAngleForceProxy() : SerializationProxy("AmoebaAngle ...@@ -42,10 +42,11 @@ AmoebaAngleForceProxy::AmoebaAngleForceProxy() : SerializationProxy("AmoebaAngle
} }
void AmoebaAngleForceProxy::serialize(const void* object, SerializationNode& node) const { void AmoebaAngleForceProxy::serialize(const void* object, SerializationNode& node) const {
node.setIntProperty("version", 1); node.setIntProperty("version", 2);
const AmoebaAngleForce& force = *reinterpret_cast<const AmoebaAngleForce*>(object); const AmoebaAngleForce& force = *reinterpret_cast<const AmoebaAngleForce*>(object);
node.setIntProperty("forceGroup", force.getForceGroup());
node.setDoubleProperty("cubic", force.getAmoebaGlobalAngleCubic()); node.setDoubleProperty("cubic", force.getAmoebaGlobalAngleCubic());
node.setDoubleProperty("quartic", force.getAmoebaGlobalAngleQuartic()); node.setDoubleProperty("quartic", force.getAmoebaGlobalAngleQuartic());
node.setDoubleProperty("pentic", force.getAmoebaGlobalAnglePentic()); node.setDoubleProperty("pentic", force.getAmoebaGlobalAnglePentic());
...@@ -61,11 +62,13 @@ void AmoebaAngleForceProxy::serialize(const void* object, SerializationNode& nod ...@@ -61,11 +62,13 @@ void AmoebaAngleForceProxy::serialize(const void* object, SerializationNode& nod
} }
void* AmoebaAngleForceProxy::deserialize(const SerializationNode& node) const { void* AmoebaAngleForceProxy::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"); throw OpenMMException("Unsupported version number");
AmoebaAngleForce* force = new AmoebaAngleForce(); AmoebaAngleForce* force = new AmoebaAngleForce();
try { try {
if (version > 1)
force->setForceGroup(node.getIntProperty("forceGroup", 0));
force->setAmoebaGlobalAngleCubic(node.getDoubleProperty("cubic")); force->setAmoebaGlobalAngleCubic(node.getDoubleProperty("cubic"));
force->setAmoebaGlobalAngleQuartic(node.getDoubleProperty("quartic")); force->setAmoebaGlobalAngleQuartic(node.getDoubleProperty("quartic"));
force->setAmoebaGlobalAnglePentic(node.getDoubleProperty("pentic")); force->setAmoebaGlobalAnglePentic(node.getDoubleProperty("pentic"));
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -42,9 +42,10 @@ AmoebaBondForceProxy::AmoebaBondForceProxy() : SerializationProxy("AmoebaBondFor ...@@ -42,9 +42,10 @@ AmoebaBondForceProxy::AmoebaBondForceProxy() : SerializationProxy("AmoebaBondFor
} }
void AmoebaBondForceProxy::serialize(const void* object, SerializationNode& node) const { void AmoebaBondForceProxy::serialize(const void* object, SerializationNode& node) const {
node.setIntProperty("version", 1); node.setIntProperty("version", 2);
const AmoebaBondForce& force = *reinterpret_cast<const AmoebaBondForce*>(object); const AmoebaBondForce& force = *reinterpret_cast<const AmoebaBondForce*>(object);
node.setIntProperty("forceGroup", force.getForceGroup());
node.setDoubleProperty("cubic", force.getAmoebaGlobalBondCubic()); node.setDoubleProperty("cubic", force.getAmoebaGlobalBondCubic());
node.setDoubleProperty("quartic", force.getAmoebaGlobalBondQuartic()); node.setDoubleProperty("quartic", force.getAmoebaGlobalBondQuartic());
...@@ -58,10 +59,13 @@ void AmoebaBondForceProxy::serialize(const void* object, SerializationNode& node ...@@ -58,10 +59,13 @@ void AmoebaBondForceProxy::serialize(const void* object, SerializationNode& node
} }
void* AmoebaBondForceProxy::deserialize(const SerializationNode& node) const { void* AmoebaBondForceProxy::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"); throw OpenMMException("Unsupported version number");
AmoebaBondForce* force = new AmoebaBondForce(); AmoebaBondForce* force = new AmoebaBondForce();
try { try {
if (version > 1)
force->setForceGroup(node.getIntProperty("forceGroup", 0));
force->setAmoebaGlobalBondCubic(node.getDoubleProperty("cubic")); force->setAmoebaGlobalBondCubic(node.getDoubleProperty("cubic"));
force->setAmoebaGlobalBondQuartic(node.getDoubleProperty("quartic")); force->setAmoebaGlobalBondQuartic(node.getDoubleProperty("quartic"));
const SerializationNode& bonds = node.getChildNode("Bonds"); const SerializationNode& bonds = node.getChildNode("Bonds");
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -42,9 +42,10 @@ AmoebaGeneralizedKirkwoodForceProxy::AmoebaGeneralizedKirkwoodForceProxy() : Ser ...@@ -42,9 +42,10 @@ AmoebaGeneralizedKirkwoodForceProxy::AmoebaGeneralizedKirkwoodForceProxy() : Ser
} }
void AmoebaGeneralizedKirkwoodForceProxy::serialize(const void* object, SerializationNode& node) const { void AmoebaGeneralizedKirkwoodForceProxy::serialize(const void* object, SerializationNode& node) const {
node.setIntProperty("version", 1); node.setIntProperty("version", 2);
const AmoebaGeneralizedKirkwoodForce& force = *reinterpret_cast<const AmoebaGeneralizedKirkwoodForce*>(object); const AmoebaGeneralizedKirkwoodForce& force = *reinterpret_cast<const AmoebaGeneralizedKirkwoodForce*>(object);
node.setIntProperty("forceGroup", force.getForceGroup());
node.setDoubleProperty("GeneralizedKirkwoodSolventDielectric", force.getSolventDielectric()); node.setDoubleProperty("GeneralizedKirkwoodSolventDielectric", force.getSolventDielectric());
node.setDoubleProperty("GeneralizedKirkwoodSoluteDielectric", force.getSoluteDielectric()); node.setDoubleProperty("GeneralizedKirkwoodSoluteDielectric", force.getSoluteDielectric());
//node.setDoubleProperty("GeneralizedKirkwoodDielectricOffset", force.getDielectricOffset()); //node.setDoubleProperty("GeneralizedKirkwoodDielectricOffset", force.getDielectricOffset());
...@@ -62,11 +63,13 @@ void AmoebaGeneralizedKirkwoodForceProxy::serialize(const void* object, Serializ ...@@ -62,11 +63,13 @@ void AmoebaGeneralizedKirkwoodForceProxy::serialize(const void* object, Serializ
} }
void* AmoebaGeneralizedKirkwoodForceProxy::deserialize(const SerializationNode& node) const { void* AmoebaGeneralizedKirkwoodForceProxy::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"); throw OpenMMException("Unsupported version number");
AmoebaGeneralizedKirkwoodForce* force = new AmoebaGeneralizedKirkwoodForce(); AmoebaGeneralizedKirkwoodForce* force = new AmoebaGeneralizedKirkwoodForce();
try { try {
if (version > 1)
force->setForceGroup(node.getIntProperty("forceGroup", 0));
force->setSolventDielectric( node.getDoubleProperty("GeneralizedKirkwoodSolventDielectric")); force->setSolventDielectric( node.getDoubleProperty("GeneralizedKirkwoodSolventDielectric"));
force->setSoluteDielectric( node.getDoubleProperty("GeneralizedKirkwoodSoluteDielectric")); force->setSoluteDielectric( node.getDoubleProperty("GeneralizedKirkwoodSoluteDielectric"));
//force->setDielectricOffset( node.getDoubleProperty("GeneralizedKirkwoodDielectricOffset")); //force->setDielectricOffset( node.getDoubleProperty("GeneralizedKirkwoodDielectricOffset"));
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -43,9 +43,10 @@ AmoebaInPlaneAngleForceProxy::AmoebaInPlaneAngleForceProxy() : SerializationProx ...@@ -43,9 +43,10 @@ AmoebaInPlaneAngleForceProxy::AmoebaInPlaneAngleForceProxy() : SerializationProx
void AmoebaInPlaneAngleForceProxy::serialize(const void* object, SerializationNode& node) const { void AmoebaInPlaneAngleForceProxy::serialize(const void* object, SerializationNode& node) const {
node.setIntProperty("version", 1); node.setIntProperty("version", 2);
const AmoebaInPlaneAngleForce& force = *reinterpret_cast<const AmoebaInPlaneAngleForce*>(object); const AmoebaInPlaneAngleForce& force = *reinterpret_cast<const AmoebaInPlaneAngleForce*>(object);
node.setIntProperty("forceGroup", force.getForceGroup());
node.setDoubleProperty("cubic", force.getAmoebaGlobalInPlaneAngleCubic()); node.setDoubleProperty("cubic", force.getAmoebaGlobalInPlaneAngleCubic());
node.setDoubleProperty("quartic", force.getAmoebaGlobalInPlaneAngleQuartic()); node.setDoubleProperty("quartic", force.getAmoebaGlobalInPlaneAngleQuartic());
node.setDoubleProperty("pentic", force.getAmoebaGlobalInPlaneAnglePentic()); node.setDoubleProperty("pentic", force.getAmoebaGlobalInPlaneAnglePentic());
...@@ -61,11 +62,13 @@ void AmoebaInPlaneAngleForceProxy::serialize(const void* object, SerializationNo ...@@ -61,11 +62,13 @@ void AmoebaInPlaneAngleForceProxy::serialize(const void* object, SerializationNo
} }
void* AmoebaInPlaneAngleForceProxy::deserialize(const SerializationNode& node) const { void* AmoebaInPlaneAngleForceProxy::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"); throw OpenMMException("Unsupported version number");
AmoebaInPlaneAngleForce* force = new AmoebaInPlaneAngleForce(); AmoebaInPlaneAngleForce* force = new AmoebaInPlaneAngleForce();
try { try {
if (version > 1)
force->setForceGroup(node.getIntProperty("forceGroup", 0));
force->setAmoebaGlobalInPlaneAngleCubic( node.getDoubleProperty("cubic")); force->setAmoebaGlobalInPlaneAngleCubic( node.getDoubleProperty("cubic"));
force->setAmoebaGlobalInPlaneAngleQuartic(node.getDoubleProperty("quartic")); force->setAmoebaGlobalInPlaneAngleQuartic(node.getDoubleProperty("quartic"));
force->setAmoebaGlobalInPlaneAnglePentic(node.getDoubleProperty("pentic")); force->setAmoebaGlobalInPlaneAnglePentic(node.getDoubleProperty("pentic"));
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -68,9 +68,10 @@ void loadCovalentMap(const SerializationNode& map, std::vector< int >& covalentM ...@@ -68,9 +68,10 @@ void loadCovalentMap(const SerializationNode& map, std::vector< int >& covalentM
} }
void AmoebaMultipoleForceProxy::serialize(const void* object, SerializationNode& node) const { void AmoebaMultipoleForceProxy::serialize(const void* object, SerializationNode& node) const {
node.setIntProperty("version", 3); node.setIntProperty("version", 4);
const AmoebaMultipoleForce& force = *reinterpret_cast<const AmoebaMultipoleForce*>(object); const AmoebaMultipoleForce& force = *reinterpret_cast<const AmoebaMultipoleForce*>(object);
node.setIntProperty("forceGroup", force.getForceGroup());
node.setIntProperty("nonbondedMethod", force.getNonbondedMethod()); node.setIntProperty("nonbondedMethod", force.getNonbondedMethod());
node.setIntProperty("polarizationType", force.getPolarizationType()); node.setIntProperty("polarizationType", force.getPolarizationType());
//node.setIntProperty("pmeBSplineOrder", force.getPmeBSplineOrder()); //node.setIntProperty("pmeBSplineOrder", force.getPmeBSplineOrder());
...@@ -133,12 +134,13 @@ void AmoebaMultipoleForceProxy::serialize(const void* object, SerializationNode& ...@@ -133,12 +134,13 @@ void AmoebaMultipoleForceProxy::serialize(const void* object, SerializationNode&
void* AmoebaMultipoleForceProxy::deserialize(const SerializationNode& node) const { void* AmoebaMultipoleForceProxy::deserialize(const SerializationNode& node) const {
int version = node.getIntProperty("version"); int version = node.getIntProperty("version");
if (version < 0 || version > 3) if (version < 0 || version > 4)
throw OpenMMException("Unsupported version number"); throw OpenMMException("Unsupported version number");
AmoebaMultipoleForce* force = new AmoebaMultipoleForce(); AmoebaMultipoleForce* force = new AmoebaMultipoleForce();
try { try {
if (version > 3)
force->setForceGroup(node.getIntProperty("forceGroup", 0));
force->setNonbondedMethod(static_cast<AmoebaMultipoleForce::NonbondedMethod>(node.getIntProperty("nonbondedMethod"))); force->setNonbondedMethod(static_cast<AmoebaMultipoleForce::NonbondedMethod>(node.getIntProperty("nonbondedMethod")));
if (version >= 2) if (version >= 2)
force->setPolarizationType(static_cast<AmoebaMultipoleForce::PolarizationType>(node.getIntProperty("polarizationType"))); force->setPolarizationType(static_cast<AmoebaMultipoleForce::PolarizationType>(node.getIntProperty("polarizationType")));
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -42,8 +42,9 @@ AmoebaOutOfPlaneBendForceProxy::AmoebaOutOfPlaneBendForceProxy() : Serialization ...@@ -42,8 +42,9 @@ AmoebaOutOfPlaneBendForceProxy::AmoebaOutOfPlaneBendForceProxy() : Serialization
} }
void AmoebaOutOfPlaneBendForceProxy::serialize(const void* object, SerializationNode& node) const { void AmoebaOutOfPlaneBendForceProxy::serialize(const void* object, SerializationNode& node) const {
node.setIntProperty("version", 1); node.setIntProperty("version", 2);
const AmoebaOutOfPlaneBendForce& force = *reinterpret_cast<const AmoebaOutOfPlaneBendForce*>(object); const AmoebaOutOfPlaneBendForce& force = *reinterpret_cast<const AmoebaOutOfPlaneBendForce*>(object);
node.setIntProperty("forceGroup", force.getForceGroup());
node.setDoubleProperty("cubic", force.getAmoebaGlobalOutOfPlaneBendCubic()); node.setDoubleProperty("cubic", force.getAmoebaGlobalOutOfPlaneBendCubic());
node.setDoubleProperty("quartic", force.getAmoebaGlobalOutOfPlaneBendQuartic()); node.setDoubleProperty("quartic", force.getAmoebaGlobalOutOfPlaneBendQuartic());
node.setDoubleProperty("pentic", force.getAmoebaGlobalOutOfPlaneBendPentic()); node.setDoubleProperty("pentic", force.getAmoebaGlobalOutOfPlaneBendPentic());
...@@ -59,11 +60,13 @@ void AmoebaOutOfPlaneBendForceProxy::serialize(const void* object, Serialization ...@@ -59,11 +60,13 @@ void AmoebaOutOfPlaneBendForceProxy::serialize(const void* object, Serialization
} }
void* AmoebaOutOfPlaneBendForceProxy::deserialize(const SerializationNode& node) const { void* AmoebaOutOfPlaneBendForceProxy::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"); throw OpenMMException("Unsupported version number");
AmoebaOutOfPlaneBendForce* force = new AmoebaOutOfPlaneBendForce(); AmoebaOutOfPlaneBendForce* force = new AmoebaOutOfPlaneBendForce();
try { try {
if (version > 1)
force->setForceGroup(node.getIntProperty("forceGroup", 0));
force->setAmoebaGlobalOutOfPlaneBendCubic(node.getDoubleProperty("cubic")); force->setAmoebaGlobalOutOfPlaneBendCubic(node.getDoubleProperty("cubic"));
force->setAmoebaGlobalOutOfPlaneBendQuartic(node.getDoubleProperty("quartic")); force->setAmoebaGlobalOutOfPlaneBendQuartic(node.getDoubleProperty("quartic"));
force->setAmoebaGlobalOutOfPlaneBendPentic(node.getDoubleProperty("pentic")); force->setAmoebaGlobalOutOfPlaneBendPentic(node.getDoubleProperty("pentic"));
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -42,8 +42,9 @@ AmoebaPiTorsionForceProxy::AmoebaPiTorsionForceProxy() : SerializationProxy("Amo ...@@ -42,8 +42,9 @@ AmoebaPiTorsionForceProxy::AmoebaPiTorsionForceProxy() : SerializationProxy("Amo
} }
void AmoebaPiTorsionForceProxy::serialize(const void* object, SerializationNode& node) const { void AmoebaPiTorsionForceProxy::serialize(const void* object, SerializationNode& node) const {
node.setIntProperty("version", 1); node.setIntProperty("version", 2);
const AmoebaPiTorsionForce& force = *reinterpret_cast<const AmoebaPiTorsionForce*>(object); const AmoebaPiTorsionForce& force = *reinterpret_cast<const AmoebaPiTorsionForce*>(object);
node.setIntProperty("forceGroup", force.getForceGroup());
SerializationNode& bonds = node.createChildNode("PiTorsion"); SerializationNode& bonds = node.createChildNode("PiTorsion");
for (unsigned int ii = 0; ii < static_cast<unsigned int>(force.getNumPiTorsions()); ii++) { for (unsigned int ii = 0; ii < static_cast<unsigned int>(force.getNumPiTorsions()); ii++) {
int particle1, particle2, particle3, particle4, particle5, particle6; int particle1, particle2, particle3, particle4, particle5, particle6;
...@@ -54,10 +55,13 @@ void AmoebaPiTorsionForceProxy::serialize(const void* object, SerializationNode& ...@@ -54,10 +55,13 @@ void AmoebaPiTorsionForceProxy::serialize(const void* object, SerializationNode&
} }
void* AmoebaPiTorsionForceProxy::deserialize(const SerializationNode& node) const { void* AmoebaPiTorsionForceProxy::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"); throw OpenMMException("Unsupported version number");
AmoebaPiTorsionForce* force = new AmoebaPiTorsionForce(); AmoebaPiTorsionForce* force = new AmoebaPiTorsionForce();
try { try {
if (version > 1)
force->setForceGroup(node.getIntProperty("forceGroup", 0));
const SerializationNode& bonds = node.getChildNode("PiTorsion"); const SerializationNode& bonds = node.getChildNode("PiTorsion");
for (unsigned int ii = 0; ii < bonds.getChildren().size(); ii++) { for (unsigned int ii = 0; ii < bonds.getChildren().size(); ii++) {
const SerializationNode& bond = bonds.getChildren()[ii]; const SerializationNode& bond = bonds.getChildren()[ii];
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010-2015 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -42,8 +42,9 @@ AmoebaStretchBendForceProxy::AmoebaStretchBendForceProxy() : SerializationProxy( ...@@ -42,8 +42,9 @@ AmoebaStretchBendForceProxy::AmoebaStretchBendForceProxy() : SerializationProxy(
} }
void AmoebaStretchBendForceProxy::serialize(const void* object, SerializationNode& node) const { void AmoebaStretchBendForceProxy::serialize(const void* object, SerializationNode& node) const {
node.setIntProperty("version", 2); node.setIntProperty("version", 3);
const AmoebaStretchBendForce& force = *reinterpret_cast<const AmoebaStretchBendForce*>(object); const AmoebaStretchBendForce& force = *reinterpret_cast<const AmoebaStretchBendForce*>(object);
node.setIntProperty("forceGroup", force.getForceGroup());
SerializationNode& bonds = node.createChildNode("StretchBendAngles"); SerializationNode& bonds = node.createChildNode("StretchBendAngles");
for (unsigned int ii = 0; ii < static_cast<unsigned int>(force.getNumStretchBends()); ii++) { for (unsigned int ii = 0; ii < static_cast<unsigned int>(force.getNumStretchBends()); ii++) {
int particle1, particle2, particle3; int particle1, particle2, particle3;
...@@ -56,10 +57,12 @@ void AmoebaStretchBendForceProxy::serialize(const void* object, SerializationNod ...@@ -56,10 +57,12 @@ void AmoebaStretchBendForceProxy::serialize(const void* object, SerializationNod
void* AmoebaStretchBendForceProxy::deserialize(const SerializationNode& node) const { void* AmoebaStretchBendForceProxy::deserialize(const SerializationNode& node) const {
int version = node.getIntProperty("version"); int version = node.getIntProperty("version");
if (version != 1 && version != 2) if (version < 1 || version > 3)
throw OpenMMException("Unsupported version number"); throw OpenMMException("Unsupported version number");
AmoebaStretchBendForce* force = new AmoebaStretchBendForce(); AmoebaStretchBendForce* force = new AmoebaStretchBendForce();
try { try {
if (version > 2)
force->setForceGroup(node.getIntProperty("forceGroup", 0));
const SerializationNode& bonds = node.getChildNode("StretchBendAngles"); const SerializationNode& bonds = node.getChildNode("StretchBendAngles");
for (unsigned int ii = 0; ii < (int) bonds.getChildren().size(); ii++) { for (unsigned int ii = 0; ii < (int) bonds.getChildren().size(); ii++) {
const SerializationNode& bond = bonds.getChildren()[ii]; const SerializationNode& bond = bonds.getChildren()[ii];
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -63,8 +63,9 @@ static void loadGrid(const SerializationNode& grid, std::vector< std::vector< st ...@@ -63,8 +63,9 @@ static void loadGrid(const SerializationNode& grid, std::vector< std::vector< st
} }
void AmoebaTorsionTorsionForceProxy::serialize(const void* object, SerializationNode& node) const { void AmoebaTorsionTorsionForceProxy::serialize(const void* object, SerializationNode& node) const {
node.setIntProperty("version", 1); node.setIntProperty("version", 2);
const AmoebaTorsionTorsionForce& force = *reinterpret_cast<const AmoebaTorsionTorsionForce*>(object); const AmoebaTorsionTorsionForce& force = *reinterpret_cast<const AmoebaTorsionTorsionForce*>(object);
node.setIntProperty("forceGroup", force.getForceGroup());
// grid[xIdx][yIdx][6 values] // grid[xIdx][yIdx][6 values]
...@@ -116,12 +117,14 @@ void AmoebaTorsionTorsionForceProxy::serialize(const void* object, Serialization ...@@ -116,12 +117,14 @@ void AmoebaTorsionTorsionForceProxy::serialize(const void* object, Serialization
void* AmoebaTorsionTorsionForceProxy::deserialize(const SerializationNode& node) const { void* AmoebaTorsionTorsionForceProxy::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"); throw OpenMMException("Unsupported version number");
AmoebaTorsionTorsionForce* force = new AmoebaTorsionTorsionForce(); AmoebaTorsionTorsionForce* force = new AmoebaTorsionTorsionForce();
try { try {
if (version > 1)
force->setForceGroup(node.getIntProperty("forceGroup", 0));
const SerializationNode& grids = node.getChildNode("TorsionTorsionGrids"); const SerializationNode& grids = node.getChildNode("TorsionTorsionGrids");
const std::vector<SerializationNode>& gridList = grids.getChildren(); const std::vector<SerializationNode>& gridList = grids.getChildren();
for (unsigned int ii = 0; ii < gridList.size(); ii++) { for (unsigned int ii = 0; ii < gridList.size(); ii++) {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -42,9 +42,10 @@ AmoebaVdwForceProxy::AmoebaVdwForceProxy() : SerializationProxy("AmoebaVdwForce" ...@@ -42,9 +42,10 @@ AmoebaVdwForceProxy::AmoebaVdwForceProxy() : SerializationProxy("AmoebaVdwForce"
} }
void AmoebaVdwForceProxy::serialize(const void* object, SerializationNode& node) const { void AmoebaVdwForceProxy::serialize(const void* object, SerializationNode& node) const {
node.setIntProperty("version", 1); node.setIntProperty("version", 2);
const AmoebaVdwForce& force = *reinterpret_cast<const AmoebaVdwForce*>(object); const AmoebaVdwForce& force = *reinterpret_cast<const AmoebaVdwForce*>(object);
node.setIntProperty("forceGroup", force.getForceGroup());
node.setStringProperty("SigmaCombiningRule", force.getSigmaCombiningRule()); node.setStringProperty("SigmaCombiningRule", force.getSigmaCombiningRule());
node.setStringProperty("EpsilonCombiningRule", force.getEpsilonCombiningRule()); node.setStringProperty("EpsilonCombiningRule", force.getEpsilonCombiningRule());
node.setDoubleProperty("VdwCutoff", force.getCutoff()); node.setDoubleProperty("VdwCutoff", force.getCutoff());
...@@ -72,11 +73,13 @@ void AmoebaVdwForceProxy::serialize(const void* object, SerializationNode& node) ...@@ -72,11 +73,13 @@ void AmoebaVdwForceProxy::serialize(const void* object, SerializationNode& node)
} }
void* AmoebaVdwForceProxy::deserialize(const SerializationNode& node) const { void* AmoebaVdwForceProxy::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"); throw OpenMMException("Unsupported version number");
AmoebaVdwForce* force = new AmoebaVdwForce(); AmoebaVdwForce* force = new AmoebaVdwForce();
try { try {
if (version > 1)
force->setForceGroup(node.getIntProperty("forceGroup", 0));
force->setSigmaCombiningRule(node.getStringProperty("SigmaCombiningRule")); force->setSigmaCombiningRule(node.getStringProperty("SigmaCombiningRule"));
force->setEpsilonCombiningRule(node.getStringProperty("EpsilonCombiningRule")); force->setEpsilonCombiningRule(node.getStringProperty("EpsilonCombiningRule"));
force->setCutoff(node.getDoubleProperty("VdwCutoff")); force->setCutoff(node.getDoubleProperty("VdwCutoff"));
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -42,8 +42,9 @@ AmoebaWcaDispersionForceProxy::AmoebaWcaDispersionForceProxy() : SerializationPr ...@@ -42,8 +42,9 @@ AmoebaWcaDispersionForceProxy::AmoebaWcaDispersionForceProxy() : SerializationPr
} }
void AmoebaWcaDispersionForceProxy::serialize(const void* object, SerializationNode& node) const { void AmoebaWcaDispersionForceProxy::serialize(const void* object, SerializationNode& node) const {
node.setIntProperty("version", 1); node.setIntProperty("version", 2);
const AmoebaWcaDispersionForce& force = *reinterpret_cast<const AmoebaWcaDispersionForce*>(object); const AmoebaWcaDispersionForce& force = *reinterpret_cast<const AmoebaWcaDispersionForce*>(object);
node.setIntProperty("forceGroup", force.getForceGroup());
node.setDoubleProperty("Epso", force.getEpso()); node.setDoubleProperty("Epso", force.getEpso());
node.setDoubleProperty("Epsh", force.getEpsh()); node.setDoubleProperty("Epsh", force.getEpsh());
node.setDoubleProperty("Rmino", force.getRmino()); node.setDoubleProperty("Rmino", force.getRmino());
...@@ -63,12 +64,14 @@ void AmoebaWcaDispersionForceProxy::serialize(const void* object, SerializationN ...@@ -63,12 +64,14 @@ void AmoebaWcaDispersionForceProxy::serialize(const void* object, SerializationN
} }
void* AmoebaWcaDispersionForceProxy::deserialize(const SerializationNode& node) const { void* AmoebaWcaDispersionForceProxy::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"); throw OpenMMException("Unsupported version number");
AmoebaWcaDispersionForce* force = new AmoebaWcaDispersionForce(); AmoebaWcaDispersionForce* force = new AmoebaWcaDispersionForce();
try { try {
if (version > 1)
force->setForceGroup(node.getIntProperty("forceGroup", 0));
force->setEpso( node.getDoubleProperty("Epso")); force->setEpso( node.getDoubleProperty("Epso"));
force->setEpsh( node.getDoubleProperty("Epsh")); force->setEpsh( node.getDoubleProperty("Epsh"));
force->setRmino( node.getDoubleProperty("Rmino")); force->setRmino( node.getDoubleProperty("Rmino"));
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -45,6 +45,7 @@ void testSerialization() { ...@@ -45,6 +45,7 @@ void testSerialization() {
// Create a Force. // Create a Force.
AmoebaAngleForce force1; AmoebaAngleForce force1;
force1.setForceGroup(3);
force1.setAmoebaGlobalAngleCubic(12.3); force1.setAmoebaGlobalAngleCubic(12.3);
force1.setAmoebaGlobalAngleQuartic(98.7); force1.setAmoebaGlobalAngleQuartic(98.7);
force1.setAmoebaGlobalAnglePentic(91.7); force1.setAmoebaGlobalAnglePentic(91.7);
...@@ -62,6 +63,7 @@ void testSerialization() { ...@@ -62,6 +63,7 @@ void testSerialization() {
// Compare the two forces to see if they are identical. // Compare the two forces to see if they are identical.
AmoebaAngleForce& force2 = *copy; AmoebaAngleForce& force2 = *copy;
ASSERT_EQUAL(force1.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force1.getAmoebaGlobalAngleCubic(), force2.getAmoebaGlobalAngleCubic()); ASSERT_EQUAL(force1.getAmoebaGlobalAngleCubic(), force2.getAmoebaGlobalAngleCubic());
ASSERT_EQUAL(force1.getAmoebaGlobalAngleQuartic(), force2.getAmoebaGlobalAngleQuartic()); ASSERT_EQUAL(force1.getAmoebaGlobalAngleQuartic(), force2.getAmoebaGlobalAngleQuartic());
ASSERT_EQUAL(force1.getAmoebaGlobalAnglePentic(), force2.getAmoebaGlobalAnglePentic()); ASSERT_EQUAL(force1.getAmoebaGlobalAnglePentic(), force2.getAmoebaGlobalAnglePentic());
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -45,6 +45,7 @@ void testSerialization() { ...@@ -45,6 +45,7 @@ void testSerialization() {
// Create a Force. // Create a Force.
AmoebaBondForce force1; AmoebaBondForce force1;
force1.setForceGroup(3);
force1.setAmoebaGlobalBondCubic(12.3); force1.setAmoebaGlobalBondCubic(12.3);
force1.setAmoebaGlobalBondQuartic(98.7); force1.setAmoebaGlobalBondQuartic(98.7);
force1.addBond(0, 1, 1.0, 2.0); force1.addBond(0, 1, 1.0, 2.0);
...@@ -60,6 +61,7 @@ void testSerialization() { ...@@ -60,6 +61,7 @@ void testSerialization() {
// Compare the two forces to see if they are identical. // Compare the two forces to see if they are identical.
AmoebaBondForce& force2 = *copy; AmoebaBondForce& force2 = *copy;
ASSERT_EQUAL(force1.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force1.getAmoebaGlobalBondCubic(), force2.getAmoebaGlobalBondCubic()); ASSERT_EQUAL(force1.getAmoebaGlobalBondCubic(), force2.getAmoebaGlobalBondCubic());
ASSERT_EQUAL(force1.getAmoebaGlobalBondQuartic(), force2.getAmoebaGlobalBondQuartic()); ASSERT_EQUAL(force1.getAmoebaGlobalBondQuartic(), force2.getAmoebaGlobalBondQuartic());
ASSERT_EQUAL(force1.getNumBonds(), force2.getNumBonds()); ASSERT_EQUAL(force1.getNumBonds(), force2.getNumBonds());
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -45,6 +45,7 @@ void testSerialization() { ...@@ -45,6 +45,7 @@ void testSerialization() {
// Create a Force. // Create a Force.
AmoebaGeneralizedKirkwoodForce force1; AmoebaGeneralizedKirkwoodForce force1;
force1.setForceGroup(3);
force1.setSolventDielectric( 80.0); force1.setSolventDielectric( 80.0);
force1.setSoluteDielectric( 1.0); force1.setSoluteDielectric( 1.0);
//force1.setDielectricOffset( 0.09); //force1.setDielectricOffset( 0.09);
...@@ -64,6 +65,7 @@ void testSerialization() { ...@@ -64,6 +65,7 @@ void testSerialization() {
// Compare the two forces to see if they are identical. // Compare the two forces to see if they are identical.
AmoebaGeneralizedKirkwoodForce& force2 = *copy; AmoebaGeneralizedKirkwoodForce& force2 = *copy;
ASSERT_EQUAL(force1.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force1.getSolventDielectric(), force2.getSolventDielectric()); ASSERT_EQUAL(force1.getSolventDielectric(), force2.getSolventDielectric());
ASSERT_EQUAL(force1.getSoluteDielectric(), force2.getSoluteDielectric()); ASSERT_EQUAL(force1.getSoluteDielectric(), force2.getSoluteDielectric());
//ASSERT_EQUAL(force1.getDielectricOffset(), force2.getDielectricOffset()); //ASSERT_EQUAL(force1.getDielectricOffset(), force2.getDielectricOffset());
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -46,6 +46,7 @@ void testSerialization() { ...@@ -46,6 +46,7 @@ void testSerialization() {
AmoebaInPlaneAngleForce force1; AmoebaInPlaneAngleForce force1;
force1.setForceGroup(3);
force1.setAmoebaGlobalInPlaneAngleCubic(12.3); force1.setAmoebaGlobalInPlaneAngleCubic(12.3);
force1.setAmoebaGlobalInPlaneAngleQuartic(98.7); force1.setAmoebaGlobalInPlaneAngleQuartic(98.7);
force1.setAmoebaGlobalInPlaneAnglePentic(91.7); force1.setAmoebaGlobalInPlaneAnglePentic(91.7);
...@@ -65,6 +66,7 @@ void testSerialization() { ...@@ -65,6 +66,7 @@ void testSerialization() {
// Compare the two forces to see if they are identical. // Compare the two forces to see if they are identical.
AmoebaInPlaneAngleForce& force2 = *copy; AmoebaInPlaneAngleForce& force2 = *copy;
ASSERT_EQUAL(force1.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force1.getAmoebaGlobalInPlaneAngleCubic(), force2.getAmoebaGlobalInPlaneAngleCubic()); ASSERT_EQUAL(force1.getAmoebaGlobalInPlaneAngleCubic(), force2.getAmoebaGlobalInPlaneAngleCubic());
ASSERT_EQUAL(force1.getAmoebaGlobalInPlaneAngleQuartic(), force2.getAmoebaGlobalInPlaneAngleQuartic()); ASSERT_EQUAL(force1.getAmoebaGlobalInPlaneAngleQuartic(), force2.getAmoebaGlobalInPlaneAngleQuartic());
ASSERT_EQUAL(force1.getAmoebaGlobalInPlaneAnglePentic(), force2.getAmoebaGlobalInPlaneAnglePentic()); ASSERT_EQUAL(force1.getAmoebaGlobalInPlaneAnglePentic(), force2.getAmoebaGlobalInPlaneAnglePentic());
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -59,6 +59,7 @@ void testSerialization() { ...@@ -59,6 +59,7 @@ void testSerialization() {
// Create a Force. // Create a Force.
AmoebaMultipoleForce force1; AmoebaMultipoleForce force1;
force1.setForceGroup(3);
force1.setNonbondedMethod(AmoebaMultipoleForce::NoCutoff); force1.setNonbondedMethod(AmoebaMultipoleForce::NoCutoff);
force1.setCutoffDistance(0.9); force1.setCutoffDistance(0.9);
force1.setAEwald(0.544); force1.setAEwald(0.544);
...@@ -111,6 +112,7 @@ void testSerialization() { ...@@ -111,6 +112,7 @@ void testSerialization() {
// Compare the two forces to see if they are identical. // Compare the two forces to see if they are identical.
AmoebaMultipoleForce& force2 = *copy; AmoebaMultipoleForce& force2 = *copy;
ASSERT_EQUAL(force1.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force1.getCutoffDistance(), force2.getCutoffDistance()); ASSERT_EQUAL(force1.getCutoffDistance(), force2.getCutoffDistance());
ASSERT_EQUAL(force1.getNonbondedMethod(), force2.getNonbondedMethod()); ASSERT_EQUAL(force1.getNonbondedMethod(), force2.getNonbondedMethod());
ASSERT_EQUAL(force1.getAEwald(), force2.getAEwald()); ASSERT_EQUAL(force1.getAEwald(), force2.getAEwald());
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -46,6 +46,7 @@ void testSerialization() { ...@@ -46,6 +46,7 @@ void testSerialization() {
AmoebaOutOfPlaneBendForce force1; AmoebaOutOfPlaneBendForce force1;
force1.setForceGroup(3);
force1.setAmoebaGlobalOutOfPlaneBendCubic(12.3); force1.setAmoebaGlobalOutOfPlaneBendCubic(12.3);
force1.setAmoebaGlobalOutOfPlaneBendQuartic(98.7); force1.setAmoebaGlobalOutOfPlaneBendQuartic(98.7);
force1.setAmoebaGlobalOutOfPlaneBendPentic(91.7); force1.setAmoebaGlobalOutOfPlaneBendPentic(91.7);
...@@ -65,6 +66,7 @@ void testSerialization() { ...@@ -65,6 +66,7 @@ void testSerialization() {
// Compare the two forces to see if they are identical. // Compare the two forces to see if they are identical.
AmoebaOutOfPlaneBendForce& force2 = *copy; AmoebaOutOfPlaneBendForce& force2 = *copy;
ASSERT_EQUAL(force1.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force1.getAmoebaGlobalOutOfPlaneBendCubic(), force2.getAmoebaGlobalOutOfPlaneBendCubic()); ASSERT_EQUAL(force1.getAmoebaGlobalOutOfPlaneBendCubic(), force2.getAmoebaGlobalOutOfPlaneBendCubic());
ASSERT_EQUAL(force1.getAmoebaGlobalOutOfPlaneBendQuartic(), force2.getAmoebaGlobalOutOfPlaneBendQuartic()); ASSERT_EQUAL(force1.getAmoebaGlobalOutOfPlaneBendQuartic(), force2.getAmoebaGlobalOutOfPlaneBendQuartic());
ASSERT_EQUAL(force1.getAmoebaGlobalOutOfPlaneBendPentic(), force2.getAmoebaGlobalOutOfPlaneBendPentic()); ASSERT_EQUAL(force1.getAmoebaGlobalOutOfPlaneBendPentic(), force2.getAmoebaGlobalOutOfPlaneBendPentic());
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -45,6 +45,7 @@ void testSerialization() { ...@@ -45,6 +45,7 @@ void testSerialization() {
// Create a Force. // Create a Force.
AmoebaPiTorsionForce force1; AmoebaPiTorsionForce force1;
force1.setForceGroup(3);
force1.addPiTorsion(0, 1, 3, 4, 5, 6, 2.0); force1.addPiTorsion(0, 1, 3, 4, 5, 6, 2.0);
force1.addPiTorsion(0, 2, 3, 5, 12, 13, 2.1); force1.addPiTorsion(0, 2, 3, 5, 12, 13, 2.1);
force1.addPiTorsion(2, 3, 5, 6, 81, 91, 2.2); force1.addPiTorsion(2, 3, 5, 6, 81, 91, 2.2);
...@@ -58,6 +59,7 @@ void testSerialization() { ...@@ -58,6 +59,7 @@ void testSerialization() {
// Compare the two forces to see if they are identical. // Compare the two forces to see if they are identical.
AmoebaPiTorsionForce& force2 = *copy; AmoebaPiTorsionForce& force2 = *copy;
ASSERT_EQUAL(force1.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force1.getNumPiTorsions(), force2.getNumPiTorsions()); ASSERT_EQUAL(force1.getNumPiTorsions(), force2.getNumPiTorsions());
for (unsigned int ii = 0; ii < static_cast<unsigned int>(force1.getNumPiTorsions()); ii++) { for (unsigned int ii = 0; ii < static_cast<unsigned int>(force1.getNumPiTorsions()); ii++) {
int a1, a2, a3, a4, a5, a6, b1, b2, b3, b4, b5, b6; int a1, a2, a3, a4, a5, a6, b1, b2, b3, b4, b5, b6;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -45,6 +45,7 @@ void testSerialization() { ...@@ -45,6 +45,7 @@ void testSerialization() {
// Create a Force. // Create a Force.
AmoebaStretchBendForce force1; AmoebaStretchBendForce force1;
force1.setForceGroup(3);
force1.addStretchBend(0, 1, 3, 1.0, 1.2, 150.1, 83.2, 100.); force1.addStretchBend(0, 1, 3, 1.0, 1.2, 150.1, 83.2, 100.);
force1.addStretchBend(2, 4, 4, 1.1, 2.2, 180.1, 89.2, 100.); force1.addStretchBend(2, 4, 4, 1.1, 2.2, 180.1, 89.2, 100.);
force1.addStretchBend(5, 0, 1, 3.1, 8.2, 140.1, 98.2, 100.); force1.addStretchBend(5, 0, 1, 3.1, 8.2, 140.1, 98.2, 100.);
...@@ -57,6 +58,7 @@ void testSerialization() { ...@@ -57,6 +58,7 @@ void testSerialization() {
// Compare the two forces to see if they are identical. // Compare the two forces to see if they are identical.
AmoebaStretchBendForce& force2 = *copy; AmoebaStretchBendForce& force2 = *copy;
ASSERT_EQUAL(force1.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force1.getNumStretchBends(), force2.getNumStretchBends()); ASSERT_EQUAL(force1.getNumStretchBends(), force2.getNumStretchBends());
for (unsigned int ii = 0; ii < static_cast<unsigned int>(force1.getNumStretchBends()); ii++) { for (unsigned int ii = 0; ii < static_cast<unsigned int>(force1.getNumStretchBends()); ii++) {
int p11, p12, p13; int p11, p12, p13;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010 Stanford University and the Authors. * * Portions copyright (c) 2010-2016 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -81,6 +81,7 @@ void testSerialization() { ...@@ -81,6 +81,7 @@ void testSerialization() {
AmoebaTorsionTorsionForce force1; AmoebaTorsionTorsionForce force1;
force1.setForceGroup(3);
for (unsigned int ii = 0; ii < 5; ii++) { for (unsigned int ii = 0; ii < 5; ii++) {
std::vector< std::vector< std::vector<double> > > gridVector; std::vector< std::vector< std::vector<double> > > gridVector;
loadTorsionTorsionGrid(gridVector); loadTorsionTorsionGrid(gridVector);
...@@ -99,6 +100,7 @@ void testSerialization() { ...@@ -99,6 +100,7 @@ void testSerialization() {
// Compare the two force1s to see if they are identical. // Compare the two force1s to see if they are identical.
AmoebaTorsionTorsionForce & force2 = *copy; AmoebaTorsionTorsionForce & force2 = *copy;
ASSERT_EQUAL(force1.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force1.getNumTorsionTorsions(), force2.getNumTorsionTorsions()); ASSERT_EQUAL(force1.getNumTorsionTorsions(), force2.getNumTorsionTorsions());
for (unsigned int ii = 0; ii < static_cast<unsigned int>(force1.getNumTorsionTorsions()); ii++) { for (unsigned int ii = 0; ii < static_cast<unsigned int>(force1.getNumTorsionTorsions()); ii++) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment