Commit 94a151b1 authored by Peter Eastman's avatar Peter Eastman
Browse files

Fixed a problem with numerical precision that sometimes prevented SHAKE clusters being recognized

parent 9e83ef09
...@@ -50,7 +50,7 @@ struct OpenCLIntegrationUtilities::ShakeCluster { ...@@ -50,7 +50,7 @@ struct OpenCLIntegrationUtilities::ShakeCluster {
ShakeCluster(int centralID, double invMass) : centralID(centralID), centralInvMass(invMass), size(0), valid(true) { ShakeCluster(int centralID, double invMass) : centralID(centralID), centralInvMass(invMass), size(0), valid(true) {
} }
void addAtom(int id, double dist, double invMass) { void addAtom(int id, double dist, double invMass) {
if (size == 3 || (size > 0 && dist != distance) || (size > 0 && invMass != peripheralInvMass)) if (size == 3 || (size > 0 && abs(dist-distance)/distance > 1e-8) || (size > 0 && abs(invMass-peripheralInvMass)/peripheralInvMass > 1e-8))
valid = false; valid = false;
else { else {
peripheralID[size++] = id; peripheralID[size++] = id;
......
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