Commit 44e668cb authored by peastman's avatar peastman Committed by GitHub
Browse files

Merge pull request #1881 from peastman/identical

Bug fix to finding identical molecules
parents 76519691 f5da3b69
...@@ -1083,9 +1083,16 @@ void CudaContext::findMoleculeGroups() { ...@@ -1083,9 +1083,16 @@ void CudaContext::findMoleculeGroups() {
for (int i = 0; i < (int) forces.size() && identical; i++) { for (int i = 0; i < (int) forces.size() && identical; i++) {
if (mol.groups[i].size() != mol2.groups[i].size()) if (mol.groups[i].size() != mol2.groups[i].size())
identical = false; identical = false;
for (int k = 0; k < (int) mol.groups[i].size() && identical; k++) for (int k = 0; k < (int) mol.groups[i].size() && identical; k++) {
if (!forces[i]->areGroupsIdentical(mol.groups[i][k], mol2.groups[i][k])) if (!forces[i]->areGroupsIdentical(mol.groups[i][k], mol2.groups[i][k]))
identical = false; identical = false;
vector<int> p1, p2;
forces[i]->getParticlesInGroup(mol.groups[i][k], p1);
forces[i]->getParticlesInGroup(mol2.groups[i][k], p2);
for (int m = 0; m < p1.size(); m++)
if (p1[m] != p2[m]-atomOffset)
identical = false;
}
} }
if (identical) { if (identical) {
moleculeInstances[j].push_back(molIndex); moleculeInstances[j].push_back(molIndex);
......
...@@ -978,9 +978,16 @@ void OpenCLContext::findMoleculeGroups() { ...@@ -978,9 +978,16 @@ void OpenCLContext::findMoleculeGroups() {
for (int i = 0; i < (int) forces.size() && identical; i++) { for (int i = 0; i < (int) forces.size() && identical; i++) {
if (mol.groups[i].size() != mol2.groups[i].size()) if (mol.groups[i].size() != mol2.groups[i].size())
identical = false; identical = false;
for (int k = 0; k < (int) mol.groups[i].size() && identical; k++) for (int k = 0; k < (int) mol.groups[i].size() && identical; k++) {
if (!forces[i]->areGroupsIdentical(mol.groups[i][k], mol2.groups[i][k])) if (!forces[i]->areGroupsIdentical(mol.groups[i][k], mol2.groups[i][k]))
identical = false; identical = false;
vector<int> p1, p2;
forces[i]->getParticlesInGroup(mol.groups[i][k], p1);
forces[i]->getParticlesInGroup(mol2.groups[i][k], p2);
for (int m = 0; m < p1.size(); m++)
if (p1[m] != p2[m]-atomOffset)
identical = false;
}
} }
if (identical) { if (identical) {
moleculeInstances[j].push_back(molIndex); moleculeInstances[j].push_back(molIndex);
......
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