Commit 6ed5bc4e authored by Rafal Wiewiora's avatar Rafal Wiewiora Committed by GitHub
Browse files

Merge branch 'master' into master

parents 656d0e3b fbf193fe
...@@ -67,17 +67,13 @@ void* DrudeForceProxy::deserialize(const SerializationNode& node) const { ...@@ -67,17 +67,13 @@ void* DrudeForceProxy::deserialize(const SerializationNode& node) const {
DrudeForce* force = new DrudeForce(); DrudeForce* force = new DrudeForce();
try { try {
const SerializationNode& particles = node.getChildNode("Particles"); const SerializationNode& particles = node.getChildNode("Particles");
for (int i = 0; i < (int) particles.getChildren().size(); i++) { for (auto& particle : particles.getChildren())
const SerializationNode& particle = particles.getChildren()[i];
force->addParticle(particle.getIntProperty("p"), particle.getIntProperty("p1"), particle.getIntProperty("p2"), particle.getIntProperty("p3"), particle.getIntProperty("p4"), force->addParticle(particle.getIntProperty("p"), particle.getIntProperty("p1"), particle.getIntProperty("p2"), particle.getIntProperty("p3"), particle.getIntProperty("p4"),
particle.getDoubleProperty("charge"), particle.getDoubleProperty("polarizability"), particle.getDoubleProperty("a12"), particle.getDoubleProperty("a34")); particle.getDoubleProperty("charge"), particle.getDoubleProperty("polarizability"), particle.getDoubleProperty("a12"), particle.getDoubleProperty("a34"));
}
const SerializationNode& pairs = node.getChildNode("ScreenedPairs"); const SerializationNode& pairs = node.getChildNode("ScreenedPairs");
for (int i = 0; i < (int) pairs.getChildren().size(); i++) { for (auto& pair : pairs.getChildren())
const SerializationNode& pair = pairs.getChildren()[i];
force->addScreenedPair(pair.getIntProperty("p1"), pair.getIntProperty("p2"), pair.getDoubleProperty("thole")); force->addScreenedPair(pair.getIntProperty("p1"), pair.getIntProperty("p2"), pair.getDoubleProperty("thole"));
} }
}
catch (...) { catch (...) {
delete force; delete force;
throw; throw;
......
This diff is collapsed.
...@@ -85,26 +85,19 @@ void* CustomAngleForceProxy::deserialize(const SerializationNode& node) const { ...@@ -85,26 +85,19 @@ void* CustomAngleForceProxy::deserialize(const SerializationNode& node) const {
if (version > 1) if (version > 1)
force->setUsesPeriodicBoundaryConditions(node.getBoolProperty("usesPeriodic")); force->setUsesPeriodicBoundaryConditions(node.getBoolProperty("usesPeriodic"));
const SerializationNode& perAngleParams = node.getChildNode("PerAngleParameters"); const SerializationNode& perAngleParams = node.getChildNode("PerAngleParameters");
for (int i = 0; i < (int) perAngleParams.getChildren().size(); i++) { for (auto& parameter : perAngleParams.getChildren())
const SerializationNode& parameter = perAngleParams.getChildren()[i];
force->addPerAngleParameter(parameter.getStringProperty("name")); force->addPerAngleParameter(parameter.getStringProperty("name"));
}
const SerializationNode& globalParams = node.getChildNode("GlobalParameters"); const SerializationNode& globalParams = node.getChildNode("GlobalParameters");
for (int i = 0; i < (int) globalParams.getChildren().size(); i++) { for (auto& parameter : globalParams.getChildren())
const SerializationNode& parameter = globalParams.getChildren()[i];
force->addGlobalParameter(parameter.getStringProperty("name"), parameter.getDoubleProperty("default")); force->addGlobalParameter(parameter.getStringProperty("name"), parameter.getDoubleProperty("default"));
}
if (version > 2) { if (version > 2) {
const SerializationNode& energyDerivs = node.getChildNode("EnergyParameterDerivatives"); const SerializationNode& energyDerivs = node.getChildNode("EnergyParameterDerivatives");
for (int i = 0; i < (int) energyDerivs.getChildren().size(); i++) { for (auto& parameter : energyDerivs.getChildren())
const SerializationNode& parameter = energyDerivs.getChildren()[i];
force->addEnergyParameterDerivative(parameter.getStringProperty("name")); force->addEnergyParameterDerivative(parameter.getStringProperty("name"));
} }
}
const SerializationNode& angles = node.getChildNode("Angles"); const SerializationNode& angles = node.getChildNode("Angles");
vector<double> params(force->getNumPerAngleParameters()); vector<double> params(force->getNumPerAngleParameters());
for (int i = 0; i < (int) angles.getChildren().size(); i++) { for (auto& angle : angles.getChildren()) {
const SerializationNode& angle = angles.getChildren()[i];
for (int j = 0; j < (int) params.size(); j++) { for (int j = 0; j < (int) params.size(); j++) {
stringstream key; stringstream key;
key << "param"; key << "param";
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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