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). |
39 |
< |
* [4] Vardeman & Gezelter, in progress (2009). |
39 |
> |
* [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). |
40 |
> |
* [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). |
41 |
|
*/ |
42 |
|
|
43 |
|
/** |
70 |
|
MemoryUtils::deletePointers(cutoffGroups_); |
71 |
|
MemoryUtils::deletePointers(constraintPairs_); |
72 |
|
MemoryUtils::deletePointers(constraintElems_); |
73 |
+ |
|
74 |
|
// integrableObjects_ don't own the objects |
75 |
|
integrableObjects_.clear(); |
76 |
+ |
fluctuatingCharges_.clear(); |
77 |
|
|
78 |
|
} |
79 |
|
|
140 |
|
void Molecule::complete() { |
141 |
|
|
142 |
|
std::set<Atom*> rigidAtoms; |
143 |
+ |
Atom* atom; |
144 |
+ |
AtomIterator ai; |
145 |
|
RigidBody* rb; |
146 |
< |
std::vector<RigidBody*>::iterator rbIter; |
146 |
> |
RigidBodyIterator rbIter; |
147 |
|
|
148 |
< |
|
148 |
> |
// Get list of all the atoms that are part of rigid bodies |
149 |
> |
|
150 |
|
for (rb = beginRigidBody(rbIter); rb != NULL; rb = nextRigidBody(rbIter)) { |
151 |
|
rigidAtoms.insert(rb->getBeginAtomIter(), rb->getEndAtomIter()); |
152 |
|
} |
153 |
|
|
154 |
< |
Atom* atom; |
155 |
< |
AtomIterator ai; |
154 |
> |
// add any atom that wasn't part of a rigid body to the list of integrableObjects |
155 |
> |
|
156 |
|
for (atom = beginAtom(ai); atom != NULL; atom = nextAtom(ai)) { |
157 |
|
|
158 |
< |
if (rigidAtoms.find(*ai) == rigidAtoms.end()) { |
158 |
> |
if (rigidAtoms.find(atom) == rigidAtoms.end()) { |
159 |
|
|
160 |
|
// If an atom does not belong to a rigid body, it is an |
161 |
|
// integrable object |
162 |
|
|
163 |
< |
integrableObjects_.push_back(*ai); |
163 |
> |
integrableObjects_.push_back(atom); |
164 |
|
} |
165 |
|
} |
166 |
|
|
167 |
< |
//find all free atoms (which do not belong to rigid bodies) |
162 |
< |
// performs the "difference" operation from set theory, the output |
163 |
< |
// range contains a copy of every element that is contained in |
164 |
< |
// [allAtoms.begin(), allAtoms.end()) and not contained in |
165 |
< |
// [rigidAtoms.begin(), rigidAtoms.end()). |
166 |
< |
//std::set_difference(allAtoms.begin(), allAtoms.end(), rigidAtoms.begin(), rigidAtoms.end(), |
167 |
< |
// std::back_inserter(integrableObjects_)); |
167 |
> |
// then add the rigid bodies themselves to the integrableObjects |
168 |
|
|
169 |
– |
//if (integrableObjects_.size() != allAtoms.size() - rigidAtoms.size()) { |
170 |
– |
// //Some atoms in rigidAtoms are not in allAtoms, something must be wrong |
171 |
– |
// sprintf(painCave.errMsg, "Atoms in rigidbody are not in the atom list of the same molecule"); |
172 |
– |
// |
173 |
– |
// painCave.isFatal = 1; |
174 |
– |
// simError(); |
175 |
– |
//} |
169 |
|
for (rb = beginRigidBody(rbIter); rb != NULL; rb = nextRigidBody(rbIter)) { |
170 |
|
integrableObjects_.push_back(rb); |
171 |
|
} |
172 |
< |
//integrableObjects_.insert(integrableObjects_.end(), rigidBodies_.begin(), rigidBodies_.end()); |
172 |
> |
|
173 |
> |
// find the atoms that are fluctuating charges and add them to the |
174 |
> |
// fluctuatingCharges_ vector |
175 |
> |
|
176 |
> |
for (atom = beginAtom(ai); atom != NULL; atom = nextAtom(ai)) { |
177 |
> |
if ( atom->isFluctuatingCharge() ) |
178 |
> |
fluctuatingCharges_.push_back( atom ); |
179 |
> |
} |
180 |
> |
|
181 |
|
} |
182 |
|
|
183 |
|
RealType Molecule::getMass() { |
300 |
|
return properties_.getPropertyByName(propName); |
301 |
|
} |
302 |
|
|
302 |
– |
|
303 |
– |
|
304 |
– |
|
303 |
|
std::ostream& operator <<(std::ostream& o, Molecule& mol) { |
304 |
|
o << std::endl; |
305 |
|
o << "Molecule " << mol.getGlobalIndex() << "has: " << std::endl; |
309 |
|
o << mol.getNTorsions() << " torsions" << std::endl; |
310 |
|
o << mol.getNInversions() << " inversions" << std::endl; |
311 |
|
o << mol.getNRigidBodies() << " rigid bodies" << std::endl; |
312 |
< |
o << mol.getNIntegrableObjects() << "integrable objects" << std::endl; |
313 |
< |
o << mol.getNCutoffGroups() << "cutoff groups" << std::endl; |
314 |
< |
o << mol.getNConstraintPairs() << "constraint pairs" << std::endl; |
312 |
> |
o << mol.getNIntegrableObjects() << " integrable objects" << std::endl; |
313 |
> |
o << mol.getNCutoffGroups() << " cutoff groups" << std::endl; |
314 |
> |
o << mol.getNConstraintPairs() << " constraint pairs" << std::endl; |
315 |
> |
o << mol.getNFluctuatingCharges() << " fluctuating charges" << std::endl; |
316 |
|
return o; |
317 |
|
} |
318 |
|
|