48#include "selection/IndexFinder.hpp"
58 IndexFinder::IndexFinder(
SimInfo* info) : info_(info) {
59 nObjects_.push_back(info_->getNGlobalAtoms() +
60 info_->getNGlobalRigidBodies());
61 nObjects_.push_back(info_->getNGlobalBonds());
62 nObjects_.push_back(info_->getNGlobalBends());
63 nObjects_.push_back(info_->getNGlobalTorsions());
64 nObjects_.push_back(info_->getNGlobalInversions());
65 nObjects_.push_back(info_->getNGlobalMolecules());
67 selectionSets_.resize(info_->getNGlobalMolecules());
71 void IndexFinder::init() {
72 SimInfo::MoleculeIterator mi;
73 Molecule::AtomIterator ai;
74 Molecule::RigidBodyIterator rbIter;
75 Molecule::BondIterator bondIter;
76 Molecule::BendIterator bendIter;
77 Molecule::TorsionIterator torsionIter;
78 Molecule::InversionIterator inversionIter;
88 for (mol = info_->beginMolecule(mi); mol != NULL;
89 mol = info_->nextMolecule(mi)) {
90 SelectionSet ss(nObjects_);
92 ss.bitsets_[
MOLECULE].setBitOn(mol->getGlobalIndex());
94 for (atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) {
95 ss.bitsets_[
STUNTDOUBLE].setBitOn(atom->getGlobalIndex());
97 for (rb = mol->beginRigidBody(rbIter); rb != NULL;
98 rb = mol->nextRigidBody(rbIter)) {
99 ss.bitsets_[
STUNTDOUBLE].setBitOn(rb->getGlobalIndex());
101 for (bond = mol->beginBond(bondIter); bond != NULL;
102 bond = mol->nextBond(bondIter)) {
103 ss.bitsets_[
BOND].setBitOn(bond->getGlobalIndex());
105 for (bend = mol->beginBend(bendIter); bend != NULL;
106 bend = mol->nextBend(bendIter)) {
107 ss.bitsets_[
BEND].setBitOn(bend->getGlobalIndex());
109 for (torsion = mol->beginTorsion(torsionIter); torsion != NULL;
110 torsion = mol->nextTorsion(torsionIter)) {
111 ss.bitsets_[
TORSION].setBitOn(torsion->getGlobalIndex());
113 for (inversion = mol->beginInversion(inversionIter); inversion != NULL;
114 inversion = mol->nextInversion(inversionIter)) {
115 ss.bitsets_[
INVERSION].setBitOn(inversion->getGlobalIndex());
118 selectionSets_[mol->getGlobalIndex()] = ss;
122 SelectionSet IndexFinder::find(
int molIndex) {
126 MPI_Comm_rank(MPI_COMM_WORLD, &worldRank);
127 proc = info_->getMolToProc(molIndex);
129 if (proc == worldRank) {
131 return selectionSets_[molIndex];
134 return SelectionSet(nObjects_);
139 SelectionSet IndexFinder::find(
int begMolIndex,
int endMolIndex) {
140 SelectionSet ss(nObjects_);
145 MPI_Comm_rank(MPI_COMM_WORLD, &worldRank);
148 for (
int i = begMolIndex; i < endMolIndex; ++i) {
150 proc = info_->getMolToProc(i);
152 if (proc == worldRank) {
154 ss |= selectionSets_[i];
One of the heavy-weight classes of OpenMD, SimInfo maintains objects and variables relating to the cu...
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
@ STUNTDOUBLE
StuntDoubles (Atoms & RigidBodies).