Commit 0a2439ce authored by Rafal P. Wiewiora's avatar Rafal P. Wiewiora
Browse files

Merge branch 'master' of https://github.com/rafwiewiora/openmm

parents c29de611 6ed5bc4e
...@@ -67,16 +67,12 @@ void* DrudeForceProxy::deserialize(const SerializationNode& node) const { ...@@ -67,16 +67,12 @@ 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;
......
...@@ -116,9 +116,9 @@ void CudaIntegrateRPMDStepKernel::initialize(const System& system, const RPMDInt ...@@ -116,9 +116,9 @@ void CudaIntegrateRPMDStepKernel::initialize(const System& system, const RPMDInt
groupsNotContracted = -1; groupsNotContracted = -1;
const map<int, int>& contractions = integrator.getContractions(); const map<int, int>& contractions = integrator.getContractions();
int maxContractedCopies = 0; int maxContractedCopies = 0;
for (map<int, int>::const_iterator iter = contractions.begin(); iter != contractions.end(); ++iter) { for (auto& c : contractions) {
int group = iter->first; int group = c.first;
int copies = iter->second; int copies = c.second;
if (group < 0 || group > 31) if (group < 0 || group > 31)
throw OpenMMException("RPMDIntegrator: Force group must be between 0 and 31"); throw OpenMMException("RPMDIntegrator: Force group must be between 0 and 31");
if (copies < 0 || copies > numCopies) if (copies < 0 || copies > numCopies)
...@@ -166,8 +166,8 @@ void CudaIntegrateRPMDStepKernel::initialize(const System& system, const RPMDInt ...@@ -166,8 +166,8 @@ void CudaIntegrateRPMDStepKernel::initialize(const System& system, const RPMDInt
// Create kernels for doing contractions. // Create kernels for doing contractions.
for (map<int, int>::const_iterator iter = groupsByCopies.begin(); iter != groupsByCopies.end(); ++iter) { for (auto& g : groupsByCopies) {
int copies = iter->first; int copies = g.first;
replacements.clear(); replacements.clear();
replacements["NUM_CONTRACTED_COPIES"] = cu.intToString(copies); replacements["NUM_CONTRACTED_COPIES"] = cu.intToString(copies);
replacements["POS_SCALE"] = cu.doubleToString(1.0/numCopies); replacements["POS_SCALE"] = cu.doubleToString(1.0/numCopies);
...@@ -267,9 +267,9 @@ void CudaIntegrateRPMDStepKernel::computeForces(ContextImpl& context) { ...@@ -267,9 +267,9 @@ void CudaIntegrateRPMDStepKernel::computeForces(ContextImpl& context) {
// Now loop over contractions and compute forces from them. // Now loop over contractions and compute forces from them.
for (map<int, int>::const_iterator iter = groupsByCopies.begin(); iter != groupsByCopies.end(); ++iter) { for (auto& g : groupsByCopies) {
int copies = iter->first; int copies = g.first;
int groupFlags = iter->second; int groupFlags = g.second;
// Find the contracted positions. // Find the contracted positions.
......
This diff is collapsed.
This diff is collapsed.
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