6 |
|
* redistribute this software in source and binary code form, provided |
7 |
|
* that the following conditions are met: |
8 |
|
* |
9 |
< |
* 1. Acknowledgement of the program authors must be made in any |
10 |
< |
* publication of scientific results based in part on use of the |
11 |
< |
* program. An acceptable form of acknowledgement is citation of |
12 |
< |
* the article in which the program was described (Matthew |
13 |
< |
* A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher |
14 |
< |
* J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented |
15 |
< |
* Parallel Simulation Engine for Molecular Dynamics," |
16 |
< |
* J. Comput. Chem. 26, pp. 252-271 (2005)) |
17 |
< |
* |
18 |
< |
* 2. Redistributions of source code must retain the above copyright |
9 |
> |
* 1. Redistributions of source code must retain the above copyright |
10 |
|
* notice, this list of conditions and the following disclaimer. |
11 |
|
* |
12 |
< |
* 3. Redistributions in binary form must reproduce the above copyright |
12 |
> |
* 2. Redistributions in binary form must reproduce the above copyright |
13 |
|
* notice, this list of conditions and the following disclaimer in the |
14 |
|
* documentation and/or other materials provided with the |
15 |
|
* distribution. |
28 |
|
* arising out of the use of or inability to use software, even if the |
29 |
|
* University of Notre Dame has been advised of the possibility of |
30 |
|
* such damages. |
31 |
+ |
* |
32 |
+ |
* SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your |
33 |
+ |
* research, please cite the appropriate papers when you publish your |
34 |
+ |
* work. Good starting points are: |
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). |
39 |
+ |
* [4] Vardeman & Gezelter, in progress (2009). |
40 |
|
*/ |
41 |
|
|
42 |
|
/** |
53 |
|
#include "utils/MemoryUtils.hpp" |
54 |
|
#include "utils/simError.h" |
55 |
|
|
56 |
< |
namespace oopse { |
56 |
> |
namespace OpenMD { |
57 |
|
Molecule::Molecule(int stampId, int globalIndex, const std::string& molName) |
58 |
|
: stampId_(stampId), globalIndex_(globalIndex), moleculeName_(molName) { |
59 |
|
} |
64 |
|
MemoryUtils::deletePointers(bonds_); |
65 |
|
MemoryUtils::deletePointers(bends_); |
66 |
|
MemoryUtils::deletePointers(torsions_); |
67 |
+ |
MemoryUtils::deletePointers(inversions_); |
68 |
|
MemoryUtils::deletePointers(rigidBodies_); |
69 |
|
MemoryUtils::deletePointers(cutoffGroups_); |
70 |
|
MemoryUtils::deletePointers(constraintPairs_); |
98 |
|
torsions_.push_back(torsion); |
99 |
|
} |
100 |
|
} |
101 |
+ |
|
102 |
+ |
void Molecule::addInversion(Inversion* inversion) { |
103 |
+ |
if (std::find(inversions_.begin(), inversions_.end(), inversion) == |
104 |
+ |
inversions_.end()) { |
105 |
+ |
inversions_.push_back(inversion); |
106 |
+ |
} |
107 |
+ |
} |
108 |
|
|
109 |
|
void Molecule::addRigidBody(RigidBody *rb) { |
110 |
|
if (std::find(rigidBodies_.begin(), rigidBodies_.end(), rb) == |
245 |
|
Bond* bond; |
246 |
|
Bend* bend; |
247 |
|
Torsion* torsion; |
248 |
+ |
Inversion* inversion; |
249 |
|
Molecule::BondIterator bondIter;; |
250 |
|
Molecule::BendIterator bendIter; |
251 |
|
Molecule::TorsionIterator torsionIter; |
252 |
+ |
Molecule::InversionIterator inversionIter; |
253 |
|
|
254 |
|
RealType potential = 0.0; |
255 |
|
|
266 |
|
potential += torsion->getPotential(); |
267 |
|
} |
268 |
|
|
269 |
+ |
for (inversion = beginInversion(inversionIter); torsion != NULL; |
270 |
+ |
inversion = nextInversion(inversionIter)) { |
271 |
+ |
potential += inversion->getPotential(); |
272 |
+ |
} |
273 |
+ |
|
274 |
|
return potential; |
275 |
|
|
276 |
|
} |
277 |
|
|
278 |
+ |
void Molecule::addProperty(GenericData* genData) { |
279 |
+ |
properties_.addProperty(genData); |
280 |
+ |
} |
281 |
+ |
|
282 |
+ |
void Molecule::removeProperty(const std::string& propName) { |
283 |
+ |
properties_.removeProperty(propName); |
284 |
+ |
} |
285 |
+ |
|
286 |
+ |
void Molecule::clearProperties() { |
287 |
+ |
properties_.clearProperties(); |
288 |
+ |
} |
289 |
+ |
|
290 |
+ |
std::vector<std::string> Molecule::getPropertyNames() { |
291 |
+ |
return properties_.getPropertyNames(); |
292 |
+ |
} |
293 |
+ |
|
294 |
+ |
std::vector<GenericData*> Molecule::getProperties() { |
295 |
+ |
return properties_.getProperties(); |
296 |
+ |
} |
297 |
+ |
|
298 |
+ |
GenericData* Molecule::getPropertyByName(const std::string& propName) { |
299 |
+ |
return properties_.getPropertyByName(propName); |
300 |
+ |
} |
301 |
+ |
|
302 |
+ |
|
303 |
+ |
|
304 |
+ |
|
305 |
|
std::ostream& operator <<(std::ostream& o, Molecule& mol) { |
306 |
|
o << std::endl; |
307 |
|
o << "Molecule " << mol.getGlobalIndex() << "has: " << std::endl; |
309 |
|
o << mol.getNBonds() << " bonds" << std::endl; |
310 |
|
o << mol.getNBends() << " bends" << std::endl; |
311 |
|
o << mol.getNTorsions() << " torsions" << std::endl; |
312 |
+ |
o << mol.getNInversions() << " inversions" << std::endl; |
313 |
|
o << mol.getNRigidBodies() << " rigid bodies" << std::endl; |
314 |
|
o << mol.getNIntegrableObjects() << "integrable objects" << std::endl; |
315 |
|
o << mol.getNCutoffGroups() << "cutoff groups" << std::endl; |
317 |
|
return o; |
318 |
|
} |
319 |
|
|
320 |
< |
}//end namespace oopse |
320 |
> |
}//end namespace OpenMD |