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, 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 |
|
*/ |
42 |
|
|
43 |
|
/** |
59 |
|
#include "primitives/Bond.hpp" |
60 |
|
#include "primitives/Bend.hpp" |
61 |
|
#include "primitives/Torsion.hpp" |
62 |
+ |
#include "primitives/Inversion.hpp" |
63 |
|
#include "primitives/CutoffGroup.hpp" |
64 |
+ |
#include "utils/PropertyMap.hpp" |
65 |
|
|
66 |
< |
namespace oopse{ |
66 |
> |
namespace OpenMD{ |
67 |
|
|
68 |
|
class Constraint; |
69 |
|
|
78 |
|
typedef std::vector<Bond*>::iterator BondIterator; |
79 |
|
typedef std::vector<Bend*>::iterator BendIterator; |
80 |
|
typedef std::vector<Torsion*>::iterator TorsionIterator; |
81 |
+ |
typedef std::vector<Inversion*>::iterator InversionIterator; |
82 |
|
typedef std::vector<RigidBody*>::iterator RigidBodyIterator; |
83 |
|
typedef std::vector<CutoffGroup*>::iterator CutoffGroupIterator; |
84 |
|
typedef std::vector<StuntDouble*>::iterator IntegrableObjectIterator; |
85 |
|
typedef std::vector<ConstraintPair*>::iterator ConstraintPairIterator; |
86 |
|
typedef std::vector<ConstraintElem*>::iterator ConstraintElemIterator; |
87 |
+ |
typedef std::vector<Atom*>::iterator FluctuatingChargeIterator; |
88 |
|
|
89 |
< |
|
85 |
< |
Molecule(int stampId, int globalIndex, const std::string& molName); |
89 |
> |
Molecule(int stampId, int globalIndex, const std::string& molName, int region); |
90 |
|
virtual ~Molecule(); |
91 |
< |
|
91 |
> |
|
92 |
|
/** |
93 |
|
* Returns the global index of this molecule. |
94 |
|
* @return the global index of this molecule |
107 |
|
int getStampId() { |
108 |
|
return stampId_; |
109 |
|
} |
110 |
+ |
int getRegion() { |
111 |
+ |
return region_; |
112 |
+ |
} |
113 |
|
|
114 |
|
/** Returns the name of the molecule */ |
115 |
|
std::string getType() { |
118 |
|
|
119 |
|
/** |
120 |
|
* Sets the global index of this molecule. |
121 |
< |
* @param new global index to be set |
121 |
> |
* @param index new global index to be set |
122 |
|
*/ |
123 |
|
void setGlobalIndex(int index) { |
124 |
|
globalIndex_ = index; |
125 |
|
} |
126 |
+ |
|
127 |
+ |
void setConstrainTotalCharge(bool ctc) { |
128 |
+ |
constrainTotalCharge_ = ctc; |
129 |
+ |
} |
130 |
|
|
131 |
< |
|
131 |
> |
bool constrainTotalCharge() { |
132 |
> |
return constrainTotalCharge_; |
133 |
> |
} |
134 |
> |
|
135 |
|
/** add an atom into this molecule */ |
136 |
|
void addAtom(Atom* atom); |
137 |
|
|
143 |
|
|
144 |
|
/** add a torsion into this molecule*/ |
145 |
|
void addTorsion(Torsion* torsion); |
146 |
+ |
|
147 |
+ |
/** add an improper torsion into this molecule*/ |
148 |
+ |
void addInversion(Inversion* inversion); |
149 |
|
|
150 |
|
/** add a rigidbody into this molecule */ |
151 |
|
void addRigidBody(RigidBody *rb); |
179 |
|
unsigned int getNTorsions() { |
180 |
|
return torsions_.size(); |
181 |
|
} |
182 |
+ |
|
183 |
+ |
/** Returns the total number of improper torsions in this molecule */ |
184 |
+ |
unsigned int getNInversions() { |
185 |
+ |
return inversions_.size(); |
186 |
+ |
} |
187 |
|
|
188 |
|
/** Returns the total number of rigid bodies in this molecule */ |
189 |
|
unsigned int getNRigidBodies() { |
204 |
|
unsigned int getNConstraintPairs() { |
205 |
|
return constraintPairs_.size(); |
206 |
|
} |
207 |
< |
|
207 |
> |
|
208 |
> |
/** Returns the total number of fluctuating charges in this molecule */ |
209 |
> |
unsigned int getNFluctuatingCharges() { |
210 |
> |
return fluctuatingCharges_.size(); |
211 |
> |
} |
212 |
> |
|
213 |
|
Atom* getAtomAt(unsigned int i) { |
214 |
|
assert(i < atoms_.size()); |
215 |
|
return atoms_[i]; |
259 |
|
Torsion* nextTorsion(std::vector<Torsion*>::iterator& i) { |
260 |
|
++i; |
261 |
|
return (i == torsions_.end()) ? NULL : *i; |
262 |
+ |
} |
263 |
+ |
|
264 |
+ |
Inversion* beginInversion(std::vector<Inversion*>::iterator& i) { |
265 |
+ |
i = inversions_.begin(); |
266 |
+ |
return (i == inversions_.end()) ? NULL : *i; |
267 |
+ |
} |
268 |
+ |
|
269 |
+ |
Inversion* nextInversion(std::vector<Inversion*>::iterator& i) { |
270 |
+ |
++i; |
271 |
+ |
return (i == inversions_.end()) ? NULL : *i; |
272 |
|
} |
273 |
|
|
274 |
|
RigidBody* beginRigidBody(std::vector<RigidBody*>::iterator& i) { |
320 |
|
++i; |
321 |
|
return (i == constraintElems_.end()) ? NULL : *i; |
322 |
|
} |
323 |
+ |
|
324 |
+ |
Atom* beginFluctuatingCharge(std::vector<Atom*>::iterator& i) { |
325 |
+ |
i = fluctuatingCharges_.begin(); |
326 |
+ |
return (i == fluctuatingCharges_.end()) ? NULL : *i; |
327 |
+ |
} |
328 |
|
|
329 |
+ |
Atom* nextFluctuatingCharge(std::vector<Atom*>::iterator& i) { |
330 |
+ |
++i; |
331 |
+ |
return (i == fluctuatingCharges_.end()) ? NULL : *i; |
332 |
+ |
} |
333 |
+ |
|
334 |
+ |
|
335 |
|
/** |
336 |
|
* Returns the total potential energy of short range interaction |
337 |
|
* of this molecule |
355 |
|
} |
356 |
|
|
357 |
|
friend std::ostream& operator <<(std::ostream& o, Molecule& mol); |
358 |
+ |
|
359 |
+ |
//below functions are just forward functions |
360 |
+ |
/** |
361 |
+ |
* Adds property into property map |
362 |
+ |
* @param genData GenericData to be added into PropertyMap |
363 |
+ |
*/ |
364 |
+ |
void addProperty(GenericData* genData); |
365 |
+ |
|
366 |
+ |
/** |
367 |
+ |
* Removes property from PropertyMap by name |
368 |
+ |
* @param propName the name of property to be removed |
369 |
+ |
*/ |
370 |
+ |
void removeProperty(const std::string& propName); |
371 |
+ |
|
372 |
+ |
/** |
373 |
+ |
* clear all of the properties |
374 |
+ |
*/ |
375 |
+ |
void clearProperties(); |
376 |
+ |
|
377 |
+ |
/** |
378 |
+ |
* Returns all names of properties |
379 |
+ |
* @return all names of properties |
380 |
+ |
*/ |
381 |
+ |
std::vector<std::string> getPropertyNames(); |
382 |
+ |
|
383 |
+ |
/** |
384 |
+ |
* Returns all of the properties in PropertyMap |
385 |
+ |
* @return all of the properties in PropertyMap |
386 |
+ |
*/ |
387 |
+ |
std::vector<GenericData*> getProperties(); |
388 |
+ |
|
389 |
+ |
/** |
390 |
+ |
* Returns property |
391 |
+ |
* @param propName name of property |
392 |
+ |
* @return a pointer point to property with propName. If no property named propName |
393 |
+ |
* exists, return NULL |
394 |
+ |
*/ |
395 |
+ |
GenericData* getPropertyByName(const std::string& propName); |
396 |
|
|
397 |
|
private: |
398 |
|
|
402 |
|
std::vector<Bond*> bonds_; |
403 |
|
std::vector<Bend*> bends_; |
404 |
|
std::vector<Torsion*> torsions_; |
405 |
+ |
std::vector<Inversion*> inversions_; |
406 |
|
std::vector<RigidBody*> rigidBodies_; |
407 |
|
std::vector<StuntDouble*> integrableObjects_; |
408 |
|
std::vector<CutoffGroup*> cutoffGroups_; |
409 |
|
std::vector<ConstraintPair*> constraintPairs_; |
410 |
|
std::vector<ConstraintElem*> constraintElems_; |
411 |
+ |
std::vector<Atom*> fluctuatingCharges_; |
412 |
|
int stampId_; |
413 |
+ |
int region_; |
414 |
|
std::string moleculeName_; |
415 |
+ |
PropertyMap properties_; |
416 |
+ |
bool constrainTotalCharge_; |
417 |
+ |
|
418 |
|
}; |
419 |
|
|
420 |
< |
} //namespace oopse |
420 |
> |
} //namespace OpenMD |
421 |
|
#endif // |