ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/primitives/Molecule.hpp
(Generate patch)

Comparing trunk/src/primitives/Molecule.hpp (file contents):
Revision 963 by tim, Wed May 17 21:51:42 2006 UTC vs.
Revision 1908 by gezelter, Fri Jul 19 21:25:45 2013 UTC

# Line 6 | Line 6
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.
# Line 37 | Line 28
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   /**
# Line 58 | Line 59
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  
# Line 75 | Line 78 | namespace oopse{
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;        
84 >    typedef std::vector<StuntDouble*>::iterator IntegrableObjectIterator;
85      typedef std::vector<ConstraintPair*>::iterator ConstraintPairIterator;
86      typedef std::vector<ConstraintElem*>::iterator ConstraintElemIterator;
87 <        
88 <
89 <    Molecule(int stampId, int globalIndex, const std::string& molName);
87 >    typedef std::vector<Atom*>::iterator FluctuatingChargeIterator;
88 >    
89 >    Molecule(int stampId, int globalIndex, const std::string& molName, int region);
90      virtual ~Molecule();
91  
92      /**
# Line 92 | Line 96 | namespace oopse{
96      int getGlobalIndex() {
97        return globalIndex_;
98      }
99 <
99 >    
100      /**
101       * Returns the stamp id of this molecule
102 <     * @note Ideally, every molecule should keep a pointer of its molecule stamp instead of its
103 <     * stamp id. However, the pointer will become invalid, if the molecule migrate to other processor.
102 >     * @note Ideally, every molecule should keep a pointer of its
103 >     * molecule stamp instead of its stamp id. However, the pointer
104 >     * will become invalid, if the molecule migrate to other
105 >     * processor.
106       */
107      int getStampId() {
108        return stampId_;
109      }
110 <
110 >    int getRegion() {
111 >      return region_;
112 >    }
113 >    
114      /** Returns the name of the molecule */
115      std::string getType() {
116        return moleculeName_;
117      }
118 <        
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 <        
127 >    void setConstrainTotalCharge(bool ctc) {
128 >      constrainTotalCharge_ = ctc;
129 >    }
130 >    
131 >    bool constrainTotalCharge() {
132 >      return constrainTotalCharge_;
133 >    }
134 >
135      /** add an atom into this molecule */
136      void addAtom(Atom* atom);
137 <
137 >    
138      /** add a bond into this molecule */
139      void addBond(Bond* bond);
140 <
140 >    
141      /** add a bend into this molecule */
142      void addBend(Bend* bend);
143 <
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);
152 <
152 >    
153      /** add a cutoff group into this molecule */
154      void addCutoffGroup(CutoffGroup* cp);    
155 <
155 >    
156      void addConstraintPair(ConstraintPair* consPair);
157 <        
157 >    
158      void addConstraintElem(ConstraintElem* consElem);
159 <
159 >    
160      /** */
161      void complete();
162 <
162 >    
163      /** Returns the total number of atoms in this molecule */
164      unsigned int getNAtoms() {
165        return atoms_.size();
166      }
167 <
167 >    
168      /** Returns the total number of bonds in this molecule */        
169      unsigned int getNBonds(){
170        return bonds_.size();
171      }
172 <
172 >    
173      /** Returns the total number of bends in this molecule */        
174      unsigned int getNBends() {
175        return bends_.size();
176      }
177 <
177 >    
178      /** Returns the total number of torsions in this molecule */        
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() {
190        return rigidBodies_.size();
191      }
192 <
192 >    
193      /** Returns the total number of integrable objects in this molecule */
194      unsigned int getNIntegrableObjects() {
195        return integrableObjects_.size();
196      }
197 <
197 >    
198      /** Returns the total number of cutoff groups in this molecule */
199      unsigned int getNCutoffGroups() {
200        return cutoffGroups_.size();
201      }
202 <
202 >    
203      /** Returns the total number of constraints in this molecule */
204      unsigned int getNConstraintPairs() {
205        return constraintPairs_.size();
206      }
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];
216      }
217 <
217 >    
218      RigidBody* getRigidBodyAt(unsigned int i) {
219        assert(i < rigidBodies_.size());
220        return rigidBodies_[i];
221      }
222 <        
222 >    
223      Atom* beginAtom(std::vector<Atom*>::iterator& i) {
224        i = atoms_.begin();
225        return (i == atoms_.end()) ? NULL : *i;
226      }
227 <
227 >    
228      Atom* nextAtom(std::vector<Atom*>::iterator& i) {
229        ++i;
230        return (i == atoms_.end()) ? NULL : *i;    
231      }
232 <
232 >    
233      Bond* beginBond(std::vector<Bond*>::iterator& i) {
234        i = bonds_.begin();
235        return (i == bonds_.end()) ? NULL : *i;
236      }
237 <
237 >    
238      Bond* nextBond(std::vector<Bond*>::iterator& i) {
239        ++i;
240        return (i == bonds_.end()) ? NULL : *i;    
241 <
241 >      
242      }
243 <
243 >    
244      Bend* beginBend(std::vector<Bend*>::iterator& i) {
245        i = bends_.begin();
246        return (i == bends_.end()) ? NULL : *i;
247      }
248 <
248 >    
249      Bend* nextBend(std::vector<Bend*>::iterator& i) {
250        ++i;
251        return (i == bends_.end()) ? NULL : *i;    
252      }
253 <
253 >    
254      Torsion* beginTorsion(std::vector<Torsion*>::iterator& i) {
255        i = torsions_.begin();
256        return (i == torsions_.end()) ? NULL : *i;
257      }
258 <
258 >    
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) {
275        i = rigidBodies_.begin();
276        return (i == rigidBodies_.end()) ? NULL : *i;
277      }
278 <
278 >    
279      RigidBody* nextRigidBody(std::vector<RigidBody*>::iterator& i) {
280        ++i;
281        return (i == rigidBodies_.end()) ? NULL : *i;    
282      }
283 <
283 >    
284      StuntDouble* beginIntegrableObject(std::vector<StuntDouble*>::iterator& i) {
285        i = integrableObjects_.begin();
286        return (i == integrableObjects_.end()) ? NULL : *i;
287      }
288 <
288 >    
289      StuntDouble* nextIntegrableObject(std::vector<StuntDouble*>::iterator& i) {
290        ++i;
291        return (i == integrableObjects_.end()) ? NULL : *i;    
292      }    
293 <
293 >    
294      CutoffGroup* beginCutoffGroup(std::vector<CutoffGroup*>::iterator& i) {
295        i = cutoffGroups_.begin();
296        return (i == cutoffGroups_.end()) ? NULL : *i;
297      }
298  
299 <    CutoffGroup* nextCutoffGroup(std::vector<CutoffGroup*>::iterator& i) {            
299 >    CutoffGroup* nextCutoffGroup(std::vector<CutoffGroup*>::iterator& i) {
300        ++i;
301        return (i == cutoffGroups_.end()) ? NULL : *i;    
302      }
303 <
303 >    
304      ConstraintPair* beginConstraintPair(std::vector<ConstraintPair*>::iterator& i) {
305        i = constraintPairs_.begin();
306        return (i == constraintPairs_.end()) ? NULL : *i;
307      }
308 <
308 >    
309      ConstraintPair* nextConstraintPair(std::vector<ConstraintPair*>::iterator& i) {            
310        ++i;
311        return (i == constraintPairs_.end()) ? NULL : *i;    
312      }        
313 <
313 >    
314      ConstraintElem* beginConstraintElem(std::vector<ConstraintElem*>::iterator& i) {
315        i = constraintElems_.begin();
316        return (i == constraintElems_.end()) ? NULL : *i;
317      }
318 <
318 >    
319      ConstraintElem* nextConstraintElem(std::vector<ConstraintElem*>::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 <    /** return the total potential energy of short range interaction of this molecule */
335 >    /**
336 >     * Returns the total potential energy of short range interaction
337 >     * of this molecule
338 >     */    
339      RealType getPotential();
340 <
340 >    
341      /** get total mass of this molecule */        
342      RealType getMass();
343 <
343 >    
344      /** return the center of mass of this molecule */
345      Vector3d getCom();
346 <
346 >    
347      /** Moves the center of this molecule */
348      void moveCom(const Vector3d& delta);
349 <
349 >    
350      /** Returns the velocity of center of mass of this molecule */
351      Vector3d getComVel();
352  
# Line 302 | Line 355 | namespace oopse{
355      }
356          
357      friend std::ostream& operator <<(std::ostream& o, Molecule& mol);
358 <        
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 <        
398 >    
399      int globalIndex_;
400 <
400 >    
401      std::vector<Atom*> atoms_;
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 //

Comparing trunk/src/primitives/Molecule.hpp (property svn:keywords):
Revision 963 by tim, Wed May 17 21:51:42 2006 UTC vs.
Revision 1908 by gezelter, Fri Jul 19 21:25:45 2013 UTC

# Line 0 | Line 1
1 + Author Id Revision Date

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines