--- trunk/src/selection/SelectionEvaluator.cpp 2010/10/19 18:40:54 1513 +++ trunk/src/selection/SelectionEvaluator.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 @@ -45,7 +46,7 @@ #include "primitives/DirectionalAtom.hpp" #include "primitives/RigidBody.hpp" #include "primitives/Molecule.hpp" -#include "io/basic_ifstrstream.hpp" +#include "io/ifstrstream.hpp" namespace OpenMD { @@ -149,7 +150,7 @@ namespace OpenMD { OpenMDBitSet bs; std::stack stack; - for (int pc = pcStart; pc < code.size(); ++pc) { + for (unsigned int pc = pcStart; pc < code.size(); ++pc) { Token instruction = code[pc]; switch (instruction.tok) { @@ -158,8 +159,7 @@ namespace OpenMD { case Token::expressionEnd: break; case Token::all: - bs = OpenMDBitSet(nStuntDouble); - bs.setAll(); + bs = allInstruction(); stack.push(bs); break; case Token::none: @@ -221,7 +221,6 @@ namespace OpenMD { int comparator = instruction.tok; int property = instruction.intValue; float comparisonValue = boost::any_cast(instruction.value); - float propertyValue; OpenMDBitSet bs(nStuntDouble); bs.clearAll(); @@ -446,8 +445,35 @@ namespace OpenMD { return bs; } + + OpenMDBitSet SelectionEvaluator::allInstruction() { + OpenMDBitSet bs(nStuntDouble); + + SimInfo::MoleculeIterator mi; + Molecule* mol; + Molecule::AtomIterator ai; + Atom* atom; + Molecule::RigidBodyIterator rbIter; + RigidBody* rb; + // Doing the loop insures that we're actually on this processor. + for (mol = info->beginMolecule(mi); mol != NULL; + mol = info->nextMolecule(mi)) { + + for(atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) { + bs.setBitOn(atom->getGlobalIndex()); + } + + for (rb = mol->beginRigidBody(rbIter); rb != NULL; + rb = mol->nextRigidBody(rbIter)) { + bs.setBitOn(rb->getGlobalIndex()); + } + } + + return bs; + } + OpenMDBitSet SelectionEvaluator::hull() { OpenMDBitSet bs(nStuntDouble); @@ -456,8 +482,6 @@ namespace OpenMD { return bs; } - - RealType SelectionEvaluator::getCharge(Atom* atom) { RealType charge =0.0; AtomType* atomType = atom->getAtomType();