--- trunk/src/selection/DistanceFinder.cpp 2010/04/14 14:41:33 1434 +++ trunk/src/selection/DistanceFinder.cpp 2012/10/01 18:21:15 1801 @@ -36,7 +36,8 @@ * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). - * [4] Vardeman & Gezelter, in progress (2009). + * [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). + * [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). */ #include "selection/DistanceFinder.hpp" @@ -56,18 +57,19 @@ namespace OpenMD { RigidBody* rb; - for (mol = info_->beginMolecule(mi); mol != NULL; mol = info_->nextMolecule(mi)) { + for (mol = info_->beginMolecule(mi); mol != NULL; + mol = info_->nextMolecule(mi)) { - for(atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) { + for(atom = mol->beginAtom(ai); atom != NULL; + atom = mol->nextAtom(ai)) { stuntdoubles_[atom->getGlobalIndex()] = atom; } - for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) { + for (rb = mol->beginRigidBody(rbIter); rb != NULL; + rb = mol->nextRigidBody(rbIter)) { stuntdoubles_[rb->getGlobalIndex()] = rb; } - - } - + } } OpenMDBitSet DistanceFinder::find(const OpenMDBitSet& bs, RealType distance) { @@ -77,17 +79,19 @@ namespace OpenMD { OpenMDBitSet bsResult(nStuntDoubles_); assert(bsResult.size() == bs.size()); - for (int j = 0; j < stuntdoubles_.size(); ++j) { + for (unsigned int j = 0; j < stuntdoubles_.size(); ++j) { if (stuntdoubles_[j]->isRigidBody()) { RigidBody* rb = static_cast(stuntdoubles_[j]); rb->updateAtoms(); } } + // This will fail in parallel because i might not be on this processor. + for (int i = bs.firstOnBit(); i != -1; i = bs.nextOnBit(i)) { center = stuntdoubles_[i]; centerPos = center->getPos(); - for (int j = 0; j < stuntdoubles_.size(); ++j) { + for (unsigned int j = 0; j < stuntdoubles_.size(); ++j) { Vector3d r =centerPos - stuntdoubles_[j]->getPos(); currSnapshot->wrapVector(r); if (r.length() <= distance) {