35 |
|
* |
36 |
|
* [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). |
37 |
|
* [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). |
38 |
< |
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). |
38 |
> |
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008). |
39 |
|
* [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). |
40 |
|
* [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). |
41 |
|
*/ |
54 |
|
children.clear(); |
55 |
|
} |
56 |
|
|
57 |
– |
|
57 |
|
NameFinder::NameFinder(SimInfo* info) : info_(info), root_(NULL){ |
58 |
|
nStuntDouble_ = info_->getNGlobalAtoms() + info_->getNGlobalRigidBodies(); |
59 |
|
loadNames(); |
60 |
|
} |
61 |
|
|
63 |
– |
|
62 |
|
NameFinder::~NameFinder(){ |
63 |
|
delete root_; |
64 |
|
} |
65 |
|
|
66 |
|
void NameFinder::loadNames() { |
67 |
|
|
70 |
– |
std::map<std::string, TreeNode*>::iterator foundIter; |
68 |
|
SimInfo::MoleculeIterator mi; |
69 |
|
Molecule* mol; |
70 |
|
Molecule::AtomIterator ai; |
76 |
|
root_->bs.resize(nStuntDouble_); |
77 |
|
root_->bs.setAll(); // |
78 |
|
|
79 |
< |
for (mol = info_->beginMolecule(mi); mol != NULL; mol = info_->nextMolecule(mi)) { |
79 |
> |
for (mol = info_->beginMolecule(mi); mol != NULL; |
80 |
> |
mol = info_->nextMolecule(mi)) { |
81 |
|
|
82 |
|
std::string molName = mol->getMoleculeName(); |
83 |
|
TreeNode* currentMolNode = createNode(root_, molName); |
90 |
|
currentAtomNode->bs.setBitOn(atom->getGlobalIndex()); |
91 |
|
} |
92 |
|
|
93 |
< |
for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) { |
93 |
> |
for (rb = mol->beginRigidBody(rbIter); rb != NULL; |
94 |
> |
rb = mol->nextRigidBody(rbIter)) { |
95 |
|
std::string rbName = rb->getType(); |
96 |
|
TreeNode* currentRbNode = createNode(currentMolNode, rbName); |
97 |
|
|
105 |
|
|
106 |
|
currentRbAtomNode->bs.setBitOn(atom->getGlobalIndex()); |
107 |
|
} |
109 |
– |
|
108 |
|
} |
109 |
< |
|
112 |
< |
} |
113 |
< |
|
109 |
> |
} |
110 |
|
} |
111 |
|
|
112 |
|
TreeNode* NameFinder::createNode(TreeNode* parent, const std::string& name) { |
228 |
|
|
229 |
|
void NameFinder::matchInternalIndex(const std::string& name, int internalIndex, OpenMDBitSet& bs){ |
230 |
|
|
235 |
– |
std::map<std::string, TreeNode*>::iterator foundIter; |
231 |
|
SimInfo::MoleculeIterator mi; |
232 |
|
Molecule* mol; |
233 |
|
|
234 |
< |
for (mol = info_->beginMolecule(mi); mol != NULL; mol = info_->nextMolecule(mi)) { |
234 |
> |
for (mol = info_->beginMolecule(mi); mol != NULL; |
235 |
> |
mol = info_->nextMolecule(mi)) { |
236 |
|
|
237 |
|
if (isMatched(mol->getMoleculeName(), name) ) { |
238 |
|
int natoms = mol->getNAtoms(); |
246 |
|
bs.setBitOn(mol->getRigidBodyAt(internalIndex - natoms)->getGlobalIndex()); |
247 |
|
} |
248 |
|
} |
249 |
< |
|
254 |
< |
} |
255 |
< |
|
249 |
> |
} |
250 |
|
} |
251 |
|
|
252 |
< |
bool NameFinder::isInteger(const std::string str) { |
252 |
> |
bool NameFinder::isInteger(const std::string &str) { |
253 |
|
for(unsigned int i = 0; i < str.size(); ++i){ |
254 |
|
if (!std::isdigit(str[i])) { |
255 |
|
return false; |
256 |
|
} |
257 |
|
} |
264 |
– |
|
258 |
|
return true; |
259 |
|
} |
267 |
– |
|
260 |
|
} |