"src/extras/vscode:/vscode.git/clone" did not exist on "7087bd0f27b641731a09cbbd3f3bc0f0b978f2fc"
Unverified Commit 4c6cf680 authored by Peter Eastman's avatar Peter Eastman Committed by GitHub
Browse files

Added name property to Forces (#3049)

parent 7c2e5991
...@@ -45,6 +45,7 @@ void RMSDForceProxy::serialize(const void* object, SerializationNode& node) cons ...@@ -45,6 +45,7 @@ void RMSDForceProxy::serialize(const void* object, SerializationNode& node) cons
node.setIntProperty("version", 0); node.setIntProperty("version", 0);
const RMSDForce& force = *reinterpret_cast<const RMSDForce*>(object); const RMSDForce& force = *reinterpret_cast<const RMSDForce*>(object);
node.setIntProperty("forceGroup", force.getForceGroup()); node.setIntProperty("forceGroup", force.getForceGroup());
node.setStringProperty("name", force.getName());
SerializationNode& positionsNode = node.createChildNode("ReferencePositions"); SerializationNode& positionsNode = node.createChildNode("ReferencePositions");
for (const Vec3& pos : force.getReferencePositions()) for (const Vec3& pos : force.getReferencePositions())
positionsNode.createChildNode("Position").setDoubleProperty("x", pos[0]).setDoubleProperty("y", pos[1]).setDoubleProperty("z", pos[2]); positionsNode.createChildNode("Position").setDoubleProperty("x", pos[0]).setDoubleProperty("y", pos[1]).setDoubleProperty("z", pos[2]);
...@@ -67,6 +68,7 @@ void* RMSDForceProxy::deserialize(const SerializationNode& node) const { ...@@ -67,6 +68,7 @@ void* RMSDForceProxy::deserialize(const SerializationNode& node) const {
particles.push_back(particle.getIntProperty("index")); particles.push_back(particle.getIntProperty("index"));
force = new RMSDForce(positions, particles); force = new RMSDForce(positions, particles);
force->setForceGroup(node.getIntProperty("forceGroup", 0)); force->setForceGroup(node.getIntProperty("forceGroup", 0));
force->setName(node.getStringProperty("name", force->getName()));
return force; return force;
} }
catch (...) { catch (...) {
......
...@@ -43,6 +43,7 @@ void testSerialization() { ...@@ -43,6 +43,7 @@ void testSerialization() {
AndersenThermostat force(250.0, 0.2); AndersenThermostat force(250.0, 0.2);
force.setForceGroup(3); force.setForceGroup(3);
force.setName("custom name");
force.setRandomNumberSeed(3); force.setRandomNumberSeed(3);
// Serialize and then deserialize it. // Serialize and then deserialize it.
...@@ -55,6 +56,7 @@ void testSerialization() { ...@@ -55,6 +56,7 @@ void testSerialization() {
AndersenThermostat& force2 = *copy; AndersenThermostat& force2 = *copy;
ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup()); ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force.getName(), force2.getName());
ASSERT_EQUAL(force.getDefaultTemperature(), force2.getDefaultTemperature()); ASSERT_EQUAL(force.getDefaultTemperature(), force2.getDefaultTemperature());
ASSERT_EQUAL(force.getDefaultCollisionFrequency(), force2.getDefaultCollisionFrequency()); ASSERT_EQUAL(force.getDefaultCollisionFrequency(), force2.getDefaultCollisionFrequency());
ASSERT_EQUAL(force.getRandomNumberSeed(), force2.getRandomNumberSeed()); ASSERT_EQUAL(force.getRandomNumberSeed(), force2.getRandomNumberSeed());
......
...@@ -43,6 +43,7 @@ void testSerialization() { ...@@ -43,6 +43,7 @@ void testSerialization() {
CMAPTorsionForce force; CMAPTorsionForce force;
force.setForceGroup(3); force.setForceGroup(3);
force.setName("custom name");
vector<double> map1(9); vector<double> map1(9);
for (int i = 0; i < 9; i++) for (int i = 0; i < 9; i++)
map1[i] = 0.1*i; map1[i] = 0.1*i;
...@@ -67,6 +68,7 @@ void testSerialization() { ...@@ -67,6 +68,7 @@ void testSerialization() {
CMAPTorsionForce& force2 = *copy; CMAPTorsionForce& force2 = *copy;
ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup()); ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force.getName(), force2.getName());
ASSERT_EQUAL(force.usesPeriodicBoundaryConditions(), force2.usesPeriodicBoundaryConditions()); ASSERT_EQUAL(force.usesPeriodicBoundaryConditions(), force2.usesPeriodicBoundaryConditions());
ASSERT_EQUAL(force.getNumMaps(), force2.getNumMaps()); ASSERT_EQUAL(force.getNumMaps(), force2.getNumMaps());
for (int i = 0; i < force.getNumMaps(); i++) { for (int i = 0; i < force.getNumMaps(); i++) {
......
...@@ -43,6 +43,7 @@ void testSerialization() { ...@@ -43,6 +43,7 @@ void testSerialization() {
CMMotionRemover force(5); CMMotionRemover force(5);
force.setForceGroup(3); force.setForceGroup(3);
force.setName("custom name");
// Serialize and then deserialize it. // Serialize and then deserialize it.
...@@ -54,6 +55,7 @@ void testSerialization() { ...@@ -54,6 +55,7 @@ void testSerialization() {
CMMotionRemover& force2 = *copy; CMMotionRemover& force2 = *copy;
ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup()); ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force.getName(), force2.getName());
ASSERT_EQUAL(force.getFrequency(), force2.getFrequency()); ASSERT_EQUAL(force.getFrequency(), force2.getFrequency());
} }
......
...@@ -43,6 +43,7 @@ void testSerialization() { ...@@ -43,6 +43,7 @@ void testSerialization() {
CustomAngleForce force("5*sin(x)^2+y*z"); CustomAngleForce force("5*sin(x)^2+y*z");
force.setForceGroup(3); force.setForceGroup(3);
force.setName("custom name");
force.addGlobalParameter("x", 1.3); force.addGlobalParameter("x", 1.3);
force.addGlobalParameter("y", 2.221); force.addGlobalParameter("y", 2.221);
force.addPerAngleParameter("z"); force.addPerAngleParameter("z");
...@@ -66,6 +67,7 @@ void testSerialization() { ...@@ -66,6 +67,7 @@ void testSerialization() {
CustomAngleForce& force2 = *copy; CustomAngleForce& force2 = *copy;
ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup()); ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force.getName(), force2.getName());
ASSERT_EQUAL(force.getEnergyFunction(), force2.getEnergyFunction()); ASSERT_EQUAL(force.getEnergyFunction(), force2.getEnergyFunction());
ASSERT_EQUAL(force.getNumPerAngleParameters(), force2.getNumPerAngleParameters()); ASSERT_EQUAL(force.getNumPerAngleParameters(), force2.getNumPerAngleParameters());
for (int i = 0; i < force.getNumPerAngleParameters(); i++) for (int i = 0; i < force.getNumPerAngleParameters(); i++)
......
...@@ -43,6 +43,7 @@ void testSerialization() { ...@@ -43,6 +43,7 @@ void testSerialization() {
CustomBondForce force("5*sin(x)^2+y*z"); CustomBondForce force("5*sin(x)^2+y*z");
force.setForceGroup(3); force.setForceGroup(3);
force.setName("custom name");
force.addGlobalParameter("x", 1.3); force.addGlobalParameter("x", 1.3);
force.addGlobalParameter("y", 2.221); force.addGlobalParameter("y", 2.221);
force.addPerBondParameter("z"); force.addPerBondParameter("z");
...@@ -66,6 +67,7 @@ void testSerialization() { ...@@ -66,6 +67,7 @@ void testSerialization() {
CustomBondForce& force2 = *copy; CustomBondForce& force2 = *copy;
ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup()); ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force.getName(), force2.getName());
ASSERT_EQUAL(force.getEnergyFunction(), force2.getEnergyFunction()); ASSERT_EQUAL(force.getEnergyFunction(), force2.getEnergyFunction());
ASSERT_EQUAL(force.getNumPerBondParameters(), force2.getNumPerBondParameters()); ASSERT_EQUAL(force.getNumPerBondParameters(), force2.getNumPerBondParameters());
for (int i = 0; i < force.getNumPerBondParameters(); i++) for (int i = 0; i < force.getNumPerBondParameters(); i++)
......
...@@ -45,6 +45,7 @@ void testSerialization() { ...@@ -45,6 +45,7 @@ void testSerialization() {
CustomCVForce force("2*v1+v2"); CustomCVForce force("2*v1+v2");
force.setForceGroup(3); force.setForceGroup(3);
force.setName("custom name");
force.addGlobalParameter("x", 1.3); force.addGlobalParameter("x", 1.3);
force.addGlobalParameter("y", 2.221); force.addGlobalParameter("y", 2.221);
force.addEnergyParameterDerivative("y"); force.addEnergyParameterDerivative("y");
...@@ -69,6 +70,7 @@ void testSerialization() { ...@@ -69,6 +70,7 @@ void testSerialization() {
CustomCVForce& force2 = *copy; CustomCVForce& force2 = *copy;
ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup()); ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force.getName(), force2.getName());
ASSERT_EQUAL(force.getEnergyFunction(), force2.getEnergyFunction()); ASSERT_EQUAL(force.getEnergyFunction(), force2.getEnergyFunction());
ASSERT_EQUAL(force.getNumGlobalParameters(), force2.getNumGlobalParameters()); ASSERT_EQUAL(force.getNumGlobalParameters(), force2.getNumGlobalParameters());
for (int i = 0; i < force.getNumGlobalParameters(); i++) { for (int i = 0; i < force.getNumGlobalParameters(); i++) {
......
...@@ -43,6 +43,7 @@ void testSerialization() { ...@@ -43,6 +43,7 @@ void testSerialization() {
CustomCentroidBondForce force(3, "5*sin(distance(g1,g2))^2+y*z"); CustomCentroidBondForce force(3, "5*sin(distance(g1,g2))^2+y*z");
force.setForceGroup(3); force.setForceGroup(3);
force.setName("custom name");
force.addGlobalParameter("x", 1.3); force.addGlobalParameter("x", 1.3);
force.addGlobalParameter("y", 2.221); force.addGlobalParameter("y", 2.221);
force.addPerBondParameter("z"); force.addPerBondParameter("z");
...@@ -90,6 +91,7 @@ void testSerialization() { ...@@ -90,6 +91,7 @@ void testSerialization() {
CustomCentroidBondForce& force2 = *copy; CustomCentroidBondForce& force2 = *copy;
ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup()); ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force.getName(), force2.getName());
ASSERT_EQUAL(force.getNumGroupsPerBond(), force2.getNumGroupsPerBond()); ASSERT_EQUAL(force.getNumGroupsPerBond(), force2.getNumGroupsPerBond());
ASSERT_EQUAL(force.getEnergyFunction(), force2.getEnergyFunction()); ASSERT_EQUAL(force.getEnergyFunction(), force2.getEnergyFunction());
ASSERT_EQUAL(force.getNumPerBondParameters(), force2.getNumPerBondParameters()); ASSERT_EQUAL(force.getNumPerBondParameters(), force2.getNumPerBondParameters());
......
...@@ -43,6 +43,7 @@ void testSerialization() { ...@@ -43,6 +43,7 @@ void testSerialization() {
CustomCompoundBondForce force(3, "5*sin(distance(p1,p2))^2+y*z"); CustomCompoundBondForce force(3, "5*sin(distance(p1,p2))^2+y*z");
force.setForceGroup(3); force.setForceGroup(3);
force.setName("custom name");
force.addGlobalParameter("x", 1.3); force.addGlobalParameter("x", 1.3);
force.addGlobalParameter("y", 2.221); force.addGlobalParameter("y", 2.221);
force.addPerBondParameter("z"); force.addPerBondParameter("z");
...@@ -80,6 +81,7 @@ void testSerialization() { ...@@ -80,6 +81,7 @@ void testSerialization() {
CustomCompoundBondForce& force2 = *copy; CustomCompoundBondForce& force2 = *copy;
ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup()); ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force.getName(), force2.getName());
ASSERT_EQUAL(force.getNumParticlesPerBond(), force2.getNumParticlesPerBond()); ASSERT_EQUAL(force.getNumParticlesPerBond(), force2.getNumParticlesPerBond());
ASSERT_EQUAL(force.getEnergyFunction(), force2.getEnergyFunction()); ASSERT_EQUAL(force.getEnergyFunction(), force2.getEnergyFunction());
ASSERT_EQUAL(force.getNumPerBondParameters(), force2.getNumPerBondParameters()); ASSERT_EQUAL(force.getNumPerBondParameters(), force2.getNumPerBondParameters());
......
...@@ -43,6 +43,7 @@ void testSerialization() { ...@@ -43,6 +43,7 @@ void testSerialization() {
CustomExternalForce force("5*sin(x)^2+y*z"); CustomExternalForce force("5*sin(x)^2+y*z");
force.setForceGroup(3); force.setForceGroup(3);
force.setName("custom name");
force.addGlobalParameter("x", 1.3); force.addGlobalParameter("x", 1.3);
force.addGlobalParameter("y", 2.221); force.addGlobalParameter("y", 2.221);
force.addPerParticleParameter("z"); force.addPerParticleParameter("z");
...@@ -64,6 +65,7 @@ void testSerialization() { ...@@ -64,6 +65,7 @@ void testSerialization() {
CustomExternalForce& force2 = *copy; CustomExternalForce& force2 = *copy;
ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup()); ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force.getName(), force2.getName());
ASSERT_EQUAL(force.getEnergyFunction(), force2.getEnergyFunction()); ASSERT_EQUAL(force.getEnergyFunction(), force2.getEnergyFunction());
ASSERT_EQUAL(force.getNumPerParticleParameters(), force2.getNumPerParticleParameters()); ASSERT_EQUAL(force.getNumPerParticleParameters(), force2.getNumPerParticleParameters());
for (int i = 0; i < force.getNumPerParticleParameters(); i++) for (int i = 0; i < force.getNumPerParticleParameters(); i++)
......
...@@ -43,6 +43,7 @@ void testSerialization() { ...@@ -43,6 +43,7 @@ void testSerialization() {
CustomGBForce force; CustomGBForce force;
force.setForceGroup(3); force.setForceGroup(3);
force.setName("custom name");
force.setNonbondedMethod(CustomGBForce::CutoffPeriodic); force.setNonbondedMethod(CustomGBForce::CutoffPeriodic);
force.setCutoffDistance(2.1); force.setCutoffDistance(2.1);
force.addGlobalParameter("x", 1.3); force.addGlobalParameter("x", 1.3);
...@@ -77,6 +78,7 @@ void testSerialization() { ...@@ -77,6 +78,7 @@ void testSerialization() {
CustomGBForce& force2 = *copy; CustomGBForce& force2 = *copy;
ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup()); ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force.getName(), force2.getName());
ASSERT_EQUAL(force.getNonbondedMethod(), force2.getNonbondedMethod()); ASSERT_EQUAL(force.getNonbondedMethod(), force2.getNonbondedMethod());
ASSERT_EQUAL(force.getCutoffDistance(), force2.getCutoffDistance()); ASSERT_EQUAL(force.getCutoffDistance(), force2.getCutoffDistance());
ASSERT_EQUAL(force.getNumPerParticleParameters(), force2.getNumPerParticleParameters()); ASSERT_EQUAL(force.getNumPerParticleParameters(), force2.getNumPerParticleParameters());
......
...@@ -43,6 +43,7 @@ void testSerialization() { ...@@ -43,6 +43,7 @@ void testSerialization() {
CustomHbondForce force("5*sin(x)^2+y*z"); CustomHbondForce force("5*sin(x)^2+y*z");
force.setForceGroup(3); force.setForceGroup(3);
force.setName("custom name");
force.setNonbondedMethod(CustomHbondForce::CutoffPeriodic); force.setNonbondedMethod(CustomHbondForce::CutoffPeriodic);
force.setCutoffDistance(2.1); force.setCutoffDistance(2.1);
force.addGlobalParameter("x", 1.3); force.addGlobalParameter("x", 1.3);
...@@ -79,6 +80,7 @@ void testSerialization() { ...@@ -79,6 +80,7 @@ void testSerialization() {
CustomHbondForce& force2 = *copy; CustomHbondForce& force2 = *copy;
ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup()); ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force.getName(), force2.getName());
ASSERT_EQUAL(force.getEnergyFunction(), force2.getEnergyFunction()); ASSERT_EQUAL(force.getEnergyFunction(), force2.getEnergyFunction());
ASSERT_EQUAL(force.getNonbondedMethod(), force2.getNonbondedMethod()); ASSERT_EQUAL(force.getNonbondedMethod(), force2.getNonbondedMethod());
ASSERT_EQUAL(force.getCutoffDistance(), force2.getCutoffDistance()); ASSERT_EQUAL(force.getCutoffDistance(), force2.getCutoffDistance());
......
...@@ -43,6 +43,7 @@ void testSerialization() { ...@@ -43,6 +43,7 @@ void testSerialization() {
CustomManyParticleForce force(3, "C*(a1+a2+a3)*(distance(p1,p2)+distance(p1,p3))"); CustomManyParticleForce force(3, "C*(a1+a2+a3)*(distance(p1,p2)+distance(p1,p3))");
force.setForceGroup(3); force.setForceGroup(3);
force.setName("custom name");
force.setNonbondedMethod(CustomManyParticleForce::CutoffPeriodic); force.setNonbondedMethod(CustomManyParticleForce::CutoffPeriodic);
force.setPermutationMode(CustomManyParticleForce::UniqueCentralParticle); force.setPermutationMode(CustomManyParticleForce::UniqueCentralParticle);
force.setCutoffDistance(2.1); force.setCutoffDistance(2.1);
...@@ -78,6 +79,7 @@ void testSerialization() { ...@@ -78,6 +79,7 @@ void testSerialization() {
CustomManyParticleForce& force2 = *copy; CustomManyParticleForce& force2 = *copy;
ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup()); ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force.getName(), force2.getName());
ASSERT_EQUAL(force.getNumParticlesPerSet(), force2.getNumParticlesPerSet()); ASSERT_EQUAL(force.getNumParticlesPerSet(), force2.getNumParticlesPerSet());
ASSERT_EQUAL(force.getEnergyFunction(), force2.getEnergyFunction()); ASSERT_EQUAL(force.getEnergyFunction(), force2.getEnergyFunction());
ASSERT_EQUAL(force.getNonbondedMethod(), force2.getNonbondedMethod()); ASSERT_EQUAL(force.getNonbondedMethod(), force2.getNonbondedMethod());
......
...@@ -43,6 +43,7 @@ void testSerialization() { ...@@ -43,6 +43,7 @@ void testSerialization() {
CustomNonbondedForce force("5*sin(x)^2+y*z"); CustomNonbondedForce force("5*sin(x)^2+y*z");
force.setForceGroup(3); force.setForceGroup(3);
force.setName("custom name");
force.setNonbondedMethod(CustomNonbondedForce::CutoffPeriodic); force.setNonbondedMethod(CustomNonbondedForce::CutoffPeriodic);
force.setUseSwitchingFunction(true); force.setUseSwitchingFunction(true);
force.setUseLongRangeCorrection(true); force.setUseLongRangeCorrection(true);
...@@ -81,6 +82,7 @@ void testSerialization() { ...@@ -81,6 +82,7 @@ void testSerialization() {
CustomNonbondedForce& force2 = *copy; CustomNonbondedForce& force2 = *copy;
ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup()); ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force.getName(), force2.getName());
ASSERT_EQUAL(force.getEnergyFunction(), force2.getEnergyFunction()); ASSERT_EQUAL(force.getEnergyFunction(), force2.getEnergyFunction());
ASSERT_EQUAL(force.getNonbondedMethod(), force2.getNonbondedMethod()); ASSERT_EQUAL(force.getNonbondedMethod(), force2.getNonbondedMethod());
ASSERT_EQUAL(force.getCutoffDistance(), force2.getCutoffDistance()); ASSERT_EQUAL(force.getCutoffDistance(), force2.getCutoffDistance());
......
...@@ -43,6 +43,7 @@ void testSerialization() { ...@@ -43,6 +43,7 @@ void testSerialization() {
CustomTorsionForce force("5*sin(x)^2+y*z"); CustomTorsionForce force("5*sin(x)^2+y*z");
force.setForceGroup(3); force.setForceGroup(3);
force.setName("custom name");
force.addGlobalParameter("x", 1.3); force.addGlobalParameter("x", 1.3);
force.addGlobalParameter("y", 2.221); force.addGlobalParameter("y", 2.221);
force.addPerTorsionParameter("z"); force.addPerTorsionParameter("z");
...@@ -66,6 +67,7 @@ void testSerialization() { ...@@ -66,6 +67,7 @@ void testSerialization() {
CustomTorsionForce& force2 = *copy; CustomTorsionForce& force2 = *copy;
ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup()); ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force.getName(), force2.getName());
ASSERT_EQUAL(force.getEnergyFunction(), force2.getEnergyFunction()); ASSERT_EQUAL(force.getEnergyFunction(), force2.getEnergyFunction());
ASSERT_EQUAL(force.getNumPerTorsionParameters(), force2.getNumPerTorsionParameters()); ASSERT_EQUAL(force.getNumPerTorsionParameters(), force2.getNumPerTorsionParameters());
for (int i = 0; i < force.getNumPerTorsionParameters(); i++) for (int i = 0; i < force.getNumPerTorsionParameters(); i++)
......
...@@ -43,6 +43,7 @@ void testSerialization() { ...@@ -43,6 +43,7 @@ void testSerialization() {
GBSAOBCForce force; GBSAOBCForce force;
force.setForceGroup(3); force.setForceGroup(3);
force.setName("custom name");
force.setNonbondedMethod(GBSAOBCForce::CutoffPeriodic); force.setNonbondedMethod(GBSAOBCForce::CutoffPeriodic);
force.setCutoffDistance(2.0); force.setCutoffDistance(2.0);
force.setSoluteDielectric(5.1); force.setSoluteDielectric(5.1);
...@@ -62,6 +63,7 @@ void testSerialization() { ...@@ -62,6 +63,7 @@ void testSerialization() {
GBSAOBCForce& force2 = *copy; GBSAOBCForce& force2 = *copy;
ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup()); ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force.getName(), force2.getName());
ASSERT_EQUAL(force.getNonbondedMethod(), force2.getNonbondedMethod()); ASSERT_EQUAL(force.getNonbondedMethod(), force2.getNonbondedMethod());
ASSERT_EQUAL(force.getCutoffDistance(), force2.getCutoffDistance()); ASSERT_EQUAL(force.getCutoffDistance(), force2.getCutoffDistance());
ASSERT_EQUAL(force.getSoluteDielectric(), force2.getSoluteDielectric()); ASSERT_EQUAL(force.getSoluteDielectric(), force2.getSoluteDielectric());
......
...@@ -43,6 +43,7 @@ void testSerialization() { ...@@ -43,6 +43,7 @@ void testSerialization() {
GayBerneForce force; GayBerneForce force;
force.setForceGroup(3); force.setForceGroup(3);
force.setName("custom name");
force.setNonbondedMethod(GayBerneForce::CutoffPeriodic); force.setNonbondedMethod(GayBerneForce::CutoffPeriodic);
force.setSwitchingDistance(1.5); force.setSwitchingDistance(1.5);
force.setUseSwitchingFunction(true); force.setUseSwitchingFunction(true);
...@@ -63,6 +64,7 @@ void testSerialization() { ...@@ -63,6 +64,7 @@ void testSerialization() {
GayBerneForce& force2 = *copy; GayBerneForce& force2 = *copy;
ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup()); ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force.getName(), force2.getName());
ASSERT_EQUAL(force.getNonbondedMethod(), force2.getNonbondedMethod()); ASSERT_EQUAL(force.getNonbondedMethod(), force2.getNonbondedMethod());
ASSERT_EQUAL(force.getSwitchingDistance(), force2.getSwitchingDistance()); ASSERT_EQUAL(force.getSwitchingDistance(), force2.getSwitchingDistance());
ASSERT_EQUAL(force.getUseSwitchingFunction(), force2.getUseSwitchingFunction()); ASSERT_EQUAL(force.getUseSwitchingFunction(), force2.getUseSwitchingFunction());
......
...@@ -43,6 +43,7 @@ void testSerialization() { ...@@ -43,6 +43,7 @@ void testSerialization() {
HarmonicAngleForce force; HarmonicAngleForce force;
force.setForceGroup(3); force.setForceGroup(3);
force.setName("custom name");
force.addAngle(0, 1, 2, 1.0, 2.0); force.addAngle(0, 1, 2, 1.0, 2.0);
force.addAngle(0, 2, 3, 2.0, 2.1); force.addAngle(0, 2, 3, 2.0, 2.1);
force.addAngle(2, 3, 4, 3.0, 2.2); force.addAngle(2, 3, 4, 3.0, 2.2);
...@@ -59,6 +60,7 @@ void testSerialization() { ...@@ -59,6 +60,7 @@ void testSerialization() {
HarmonicAngleForce& force2 = *copy; HarmonicAngleForce& force2 = *copy;
ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup()); ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force.getName(), force2.getName());
ASSERT_EQUAL(force.usesPeriodicBoundaryConditions(), force2.usesPeriodicBoundaryConditions()); ASSERT_EQUAL(force.usesPeriodicBoundaryConditions(), force2.usesPeriodicBoundaryConditions());
ASSERT_EQUAL(force.getNumAngles(), force2.getNumAngles()); ASSERT_EQUAL(force.getNumAngles(), force2.getNumAngles());
for (int i = 0; i < force.getNumAngles(); i++) { for (int i = 0; i < force.getNumAngles(); i++) {
......
...@@ -43,6 +43,7 @@ void testSerialization() { ...@@ -43,6 +43,7 @@ void testSerialization() {
HarmonicBondForce force; HarmonicBondForce force;
force.setForceGroup(3); force.setForceGroup(3);
force.setName("custom name");
force.addBond(0, 1, 1.0, 2.0); force.addBond(0, 1, 1.0, 2.0);
force.addBond(0, 2, 2.0, 2.1); force.addBond(0, 2, 2.0, 2.1);
force.addBond(2, 3, 3.0, 2.2); force.addBond(2, 3, 3.0, 2.2);
...@@ -59,6 +60,7 @@ void testSerialization() { ...@@ -59,6 +60,7 @@ void testSerialization() {
HarmonicBondForce& force2 = *copy; HarmonicBondForce& force2 = *copy;
ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup()); ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force.getName(), force2.getName());
ASSERT_EQUAL(force.usesPeriodicBoundaryConditions(), force2.usesPeriodicBoundaryConditions()); ASSERT_EQUAL(force.usesPeriodicBoundaryConditions(), force2.usesPeriodicBoundaryConditions());
ASSERT_EQUAL(force.getNumBonds(), force2.getNumBonds()); ASSERT_EQUAL(force.getNumBonds(), force2.getNumBonds());
for (int i = 0; i < force.getNumBonds(); i++) { for (int i = 0; i < force.getNumBonds(); i++) {
......
...@@ -43,6 +43,7 @@ void testSerialization() { ...@@ -43,6 +43,7 @@ void testSerialization() {
MonteCarloAnisotropicBarostat force(Vec3(15.1, 18.2, 19.3), 250.0, true, false, true, 14); MonteCarloAnisotropicBarostat force(Vec3(15.1, 18.2, 19.3), 250.0, true, false, true, 14);
force.setForceGroup(3); force.setForceGroup(3);
force.setName("custom name");
force.setRandomNumberSeed(3); force.setRandomNumberSeed(3);
// Serialize and then deserialize it. // Serialize and then deserialize it.
...@@ -55,6 +56,7 @@ void testSerialization() { ...@@ -55,6 +56,7 @@ void testSerialization() {
MonteCarloAnisotropicBarostat& force2 = *copy; MonteCarloAnisotropicBarostat& force2 = *copy;
ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup()); ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force.getName(), force2.getName());
ASSERT_EQUAL_VEC(force.getDefaultPressure(), force2.getDefaultPressure(), 0.0); ASSERT_EQUAL_VEC(force.getDefaultPressure(), force2.getDefaultPressure(), 0.0);
ASSERT_EQUAL(force.getDefaultTemperature(), force2.getDefaultTemperature()); ASSERT_EQUAL(force.getDefaultTemperature(), force2.getDefaultTemperature());
ASSERT_EQUAL(force.getScaleX(), force2.getScaleX()); ASSERT_EQUAL(force.getScaleX(), force2.getScaleX());
......
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