ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/brains/SimInfo.hpp
(Generate patch)

Comparing:
trunk/src/brains/SimInfo.hpp (file contents), Revision 417 by chrisfen, Thu Mar 10 15:10:24 2005 UTC vs.
branches/development/src/brains/SimInfo.hpp (file contents), Revision 1528 by gezelter, Fri Dec 17 20:11:05 2010 UTC

# Line 1 | Line 1
1 < /*
1 > /*
2   * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved.
3   *
4   * The University of Notre Dame grants you ("Licensee") a
# 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, 24107 (2008).          
39 + * [4]  Vardeman & Gezelter, in progress (2009).                        
40   */
41  
42   /**
# Line 54 | Line 54
54   #include <utility>
55   #include <vector>
56  
57 < #include "brains/Exclude.hpp"
57 > #include "brains/PairList.hpp"
58   #include "io/Globals.hpp"
59   #include "math/Vector3.hpp"
60 + #include "math/SquareMatrix3.hpp"
61   #include "types/MoleculeStamp.hpp"
62   #include "UseTheForce/ForceField.hpp"
63   #include "utils/PropertyMap.hpp"
64   #include "utils/LocalIndexManager.hpp"
65  
66   //another nonsense macro declaration
67 < #define __C
67 > #define __OPENMD_C
68   #include "brains/fSimulation.h"
69  
70 < namespace oopse{
70 > using namespace std;
71 > namespace OpenMD{
72  
73 < //forward decalration
74 < class SnapshotManager;
75 < class Molecule;
76 < class SelectionManager;
77 < /**
78 < * @class SimInfo SimInfo.hpp "brains/SimInfo.hpp"
77 < * @brief As one of the heavy weight class of OOPSE, SimInfo
78 < * One of the major changes in SimInfo class is the data struct. It only maintains a list of molecules.
79 < * And the Molecule class will maintain all of the concrete objects (atoms, bond, bend, torsions, rigid bodies,
80 < * cutoff groups, constrains).
81 < * Another major change is the index. No matter single version or parallel version,  atoms and
82 < * rigid bodies have both global index and local index. Local index is not important to molecule as well as
83 < * cutoff group.
84 < */
85 < class SimInfo {
86 <    public:
87 <        typedef std::map<int, Molecule*>::iterator  MoleculeIterator;
73 >  enum CutoffMethod {
74 >    HARD,
75 >    SWITCHING_FUNCTION,
76 >    SHIFTED_POTENTIAL,
77 >    SHIFTED_FORCE
78 >  };
79  
80 <        /**
81 <         * Constructor of SimInfo
82 <         * @param molStampPairs MoleculeStamp Array. The first element of the pair is molecule stamp, the
83 <         * second element is the total number of molecules with the same molecule stamp in the system
84 <         * @param ff pointer of a concrete ForceField instance
94 <         * @param simParams
95 <         * @note
96 <         */
97 <        SimInfo(std::vector<std::pair<MoleculeStamp*, int> >& molStampPairs, ForceField* ff, Globals* simParams);
98 <        virtual ~SimInfo();
80 >  //forward decalration
81 >  class SnapshotManager;
82 >  class Molecule;
83 >  class SelectionManager;
84 >  class StuntDouble;
85  
86 <        /**
87 <         * Adds a molecule
88 <         * @return return true if adding successfully, return false if the molecule is already in SimInfo
89 <         * @param mol molecule to be added
90 <         */
91 <        bool addMolecule(Molecule* mol);
86 >  /**
87 >   * @class SimInfo SimInfo.hpp "brains/SimInfo.hpp"
88 >   *
89 >   * @brief One of the heavy-weight classes of OpenMD, SimInfo
90 >   * maintains objects and variables relating to the current
91 >   * simulation.  This includes the master list of Molecules.  The
92 >   * Molecule class maintains all of the concrete objects (Atoms,
93 >   * Bond, Bend, Torsions, Inversions, RigidBodies, CutoffGroups,
94 >   * Constraints). In both the single and parallel versions, Atoms and
95 >   * RigidBodies have both global and local indices.
96 >   */
97 >  class SimInfo {
98 >  public:
99 >    typedef map<int, Molecule*>::iterator  MoleculeIterator;
100 >    
101 >    /**
102 >     * Constructor of SimInfo
103 >     *
104 >     * @param molStampPairs MoleculeStamp Array. The first element of
105 >     * the pair is molecule stamp, the second element is the total
106 >     * number of molecules with the same molecule stamp in the system
107 >     *
108 >     * @param ff pointer of a concrete ForceField instance
109 >     *
110 >     * @param simParams
111 >     */
112 >    SimInfo(ForceField* ff, Globals* simParams);
113 >    virtual ~SimInfo();
114  
115 <        /**
116 <         * Removes a molecule from SimInfo
117 <         * @return true if removing successfully, return false if molecule is not in this SimInfo
118 <         */
119 <        bool removeMolecule(Molecule* mol);
115 >    /**
116 >     * Adds a molecule
117 >     *
118 >     * @return return true if adding successfully, return false if the
119 >     * molecule is already in SimInfo
120 >     *
121 >     * @param mol molecule to be added
122 >     */
123 >    bool addMolecule(Molecule* mol);
124  
125 <        /** Returns the total number of molecules in the system. */
126 <        int getNGlobalMolecules() {
127 <            return nGlobalMols_;
128 <        }
125 >    /**
126 >     * Removes a molecule from SimInfo
127 >     *
128 >     * @return true if removing successfully, return false if molecule
129 >     * is not in this SimInfo
130 >     */
131 >    bool removeMolecule(Molecule* mol);
132  
133 <        /** Returns the total number of atoms in the system. */
134 <        int getNGlobalAtoms() {
135 <            return nGlobalAtoms_;
136 <        }
133 >    /** Returns the total number of molecules in the system. */
134 >    int getNGlobalMolecules() {
135 >      return nGlobalMols_;
136 >    }
137  
138 <        /** Returns the total number of cutoff groups in the system. */
139 <        int getNGlobalCutoffGroups() {
140 <            return nGlobalCutoffGroups_;
141 <        }
138 >    /** Returns the total number of atoms in the system. */
139 >    int getNGlobalAtoms() {
140 >      return nGlobalAtoms_;
141 >    }
142  
143 <        /**
144 <         * Returns the total number of integrable objects (total number of rigid bodies plus the total number
145 <         * of atoms which do not belong to the rigid bodies) in the system
146 <         */
132 <        int getNGlobalIntegrableObjects() {
133 <            return nGlobalIntegrableObjects_;
134 <        }
143 >    /** Returns the total number of cutoff groups in the system. */
144 >    int getNGlobalCutoffGroups() {
145 >      return nGlobalCutoffGroups_;
146 >    }
147  
148 <        /**
149 <         * Returns the total number of integrable objects (total number of rigid bodies plus the total number
150 <         * of atoms which do not belong to the rigid bodies) in the system
151 <         */
152 <        int getNGlobalRigidBodies() {
153 <            return nGlobalRigidBodies_;
154 <        }
148 >    /**
149 >     * Returns the total number of integrable objects (total number of
150 >     * rigid bodies plus the total number of atoms which do not belong
151 >     * to the rigid bodies) in the system
152 >     */
153 >    int getNGlobalIntegrableObjects() {
154 >      return nGlobalIntegrableObjects_;
155 >    }
156  
157 <        int getNGlobalConstraints();
158 <        /**
159 <         * Returns the number of local molecules.
160 <         * @return the number of local molecules
161 <         */
162 <        int getNMolecules() {
163 <            return molecules_.size();
164 <        }
157 >    /**
158 >     * Returns the total number of integrable objects (total number of
159 >     * rigid bodies plus the total number of atoms which do not belong
160 >     * to the rigid bodies) in the system
161 >     */
162 >    int getNGlobalRigidBodies() {
163 >      return nGlobalRigidBodies_;
164 >    }
165  
166 <        /** Returns the number of local atoms */
167 <        unsigned int getNAtoms() {
168 <            return nAtoms_;
169 <        }
166 >    int getNGlobalConstraints();
167 >    /**
168 >     * Returns the number of local molecules.
169 >     * @return the number of local molecules
170 >     */
171 >    int getNMolecules() {
172 >      return molecules_.size();
173 >    }
174  
175 <        /** Returns the number of local bonds */        
176 <        unsigned int getNBonds(){
177 <            return nBonds_;
178 <        }
175 >    /** Returns the number of local atoms */
176 >    unsigned int getNAtoms() {
177 >      return nAtoms_;
178 >    }
179  
180 <        /** Returns the number of local bends */        
181 <        unsigned int getNBends() {
182 <            return nBends_;
183 <        }
180 >    /** Returns the number of local bonds */        
181 >    unsigned int getNBonds(){
182 >      return nBonds_;
183 >    }
184  
185 <        /** Returns the number of local torsions */        
186 <        unsigned int getNTorsions() {
187 <            return nTorsions_;
188 <        }
185 >    /** Returns the number of local bends */        
186 >    unsigned int getNBends() {
187 >      return nBends_;
188 >    }
189  
190 <        /** Returns the number of local rigid bodies */        
191 <        unsigned int getNRigidBodies() {
192 <            return nRigidBodies_;
193 <        }
190 >    /** Returns the number of local torsions */        
191 >    unsigned int getNTorsions() {
192 >      return nTorsions_;
193 >    }
194  
195 <        /** Returns the number of local integrable objects */
196 <        unsigned int getNIntegrableObjects() {
197 <            return nIntegrableObjects_;
198 <        }
195 >    /** Returns the number of local torsions */        
196 >    unsigned int getNInversions() {
197 >      return nInversions_;
198 >    }
199 >    /** Returns the number of local rigid bodies */        
200 >    unsigned int getNRigidBodies() {
201 >      return nRigidBodies_;
202 >    }
203  
204 <        /** Returns the number of local cutoff groups */
205 <        unsigned int getNCutoffGroups() {
206 <            return nCutoffGroups_;
207 <        }
204 >    /** Returns the number of local integrable objects */
205 >    unsigned int getNIntegrableObjects() {
206 >      return nIntegrableObjects_;
207 >    }
208  
209 <        /** Returns the total number of constraints in this SimInfo */
210 <        unsigned int getNConstraints() {
211 <            return nConstraints_;
212 <        }
209 >    /** Returns the number of local cutoff groups */
210 >    unsigned int getNCutoffGroups() {
211 >      return nCutoffGroups_;
212 >    }
213 >
214 >    /** Returns the total number of constraints in this SimInfo */
215 >    unsigned int getNConstraints() {
216 >      return nConstraints_;
217 >    }
218          
219 <        /**
220 <         * Returns the first molecule in this SimInfo and intialize the iterator.
221 <         * @return the first molecule, return NULL if there is not molecule in this SimInfo
222 <         * @param i the iterator of molecule array (user shouldn't change it)
223 <         */
224 <        Molecule* beginMolecule(MoleculeIterator& i);
219 >    /**
220 >     * Returns the first molecule in this SimInfo and intialize the iterator.
221 >     * @return the first molecule, return NULL if there is not molecule in this SimInfo
222 >     * @param i the iterator of molecule array (user shouldn't change it)
223 >     */
224 >    Molecule* beginMolecule(MoleculeIterator& i);
225  
226 <        /**
227 <          * Returns the next avaliable Molecule based on the iterator.
228 <          * @return the next avaliable molecule, return NULL if reaching the end of the array
229 <          * @param i the iterator of molecule array
230 <          */
231 <        Molecule* nextMolecule(MoleculeIterator& i);
226 >    /**
227 >     * Returns the next avaliable Molecule based on the iterator.
228 >     * @return the next avaliable molecule, return NULL if reaching the end of the array
229 >     * @param i the iterator of molecule array
230 >     */
231 >    Molecule* nextMolecule(MoleculeIterator& i);
232  
233 <        /** Returns the number of degrees of freedom */
234 <        int getNdf() {
235 <            return ndf_;
236 <        }
233 >    /** Returns the number of degrees of freedom */
234 >    int getNdf() {
235 >      return ndf_ - getFdf();
236 >    }
237  
238 <        /** Returns the number of raw degrees of freedom */
239 <        int getNdfRaw() {
240 <            return ndfRaw_;
241 <        }
238 >    /** Returns the number of raw degrees of freedom */
239 >    int getNdfRaw() {
240 >      return ndfRaw_;
241 >    }
242  
243 <        /** Returns the number of translational degrees of freedom */
244 <        int getNdfTrans() {
245 <            return ndfTrans_;
246 <        }
243 >    /** Returns the number of translational degrees of freedom */
244 >    int getNdfTrans() {
245 >      return ndfTrans_;
246 >    }
247  
248 <        //getNZconstraint and setNZconstraint ruin the coherent of SimInfo class, need refactorying
248 >    /** sets the current number of frozen degrees of freedom */
249 >    void setFdf(int fdf) {
250 >      fdf_local = fdf;
251 >    }
252 >
253 >    int getFdf();
254 >    
255 >    //getNZconstraint and setNZconstraint ruin the coherence of
256 >    //SimInfo class, need refactoring
257          
258 <        /** Returns the total number of z-constraint molecules in the system */
259 <        int getNZconstraint() {
260 <            return nZconstraint_;
261 <        }
258 >    /** Returns the total number of z-constraint molecules in the system */
259 >    int getNZconstraint() {
260 >      return nZconstraint_;
261 >    }
262  
263 <        /**
264 <         * Sets the number of z-constraint molecules in the system.
265 <         */
266 <        void setNZconstraint(int nZconstraint) {
267 <            nZconstraint_ = nZconstraint;
268 <        }
263 >    /**
264 >     * Sets the number of z-constraint molecules in the system.
265 >     */
266 >    void setNZconstraint(int nZconstraint) {
267 >      nZconstraint_ = nZconstraint;
268 >    }
269          
270 <        /** Returns the snapshot manager. */
271 <        SnapshotManager* getSnapshotManager() {
272 <            return sman_;
273 <        }
270 >    /** Returns the snapshot manager. */
271 >    SnapshotManager* getSnapshotManager() {
272 >      return sman_;
273 >    }
274  
275 <        /** Sets the snapshot manager. */
276 <        void setSnapshotManager(SnapshotManager* sman);
275 >    /** Sets the snapshot manager. */
276 >    void setSnapshotManager(SnapshotManager* sman);
277          
278 <        /** Returns the force field */
279 <        ForceField* getForceField() {
280 <            return forceField_;
281 <        }
278 >    /** Returns the force field */
279 >    ForceField* getForceField() {
280 >      return forceField_;
281 >    }
282  
283 <        Globals* getSimParams() {
284 <            return simParams_;
285 <        }
283 >    Globals* getSimParams() {
284 >      return simParams_;
285 >    }
286  
287 <        /** Returns the velocity of center of mass of the whole system.*/
288 <        Vector3d getComVel();
287 >    /** Returns the velocity of center of mass of the whole system.*/
288 >    Vector3d getComVel();
289  
290 <        /** Returns the center of the mass of the whole system.*/
291 <        Vector3d getCom();
290 >    /** Returns the center of the mass of the whole system.*/
291 >    Vector3d getCom();
292 >    /** Returns the center of the mass and Center of Mass velocity of
293 >        the whole system.*/
294 >    void getComAll(Vector3d& com,Vector3d& comVel);
295  
296 <        /** main driver function to interact with fortran during the initialization and molecule migration */
297 <        void update();
296 >    /** Returns intertia tensor for the entire system and system
297 >        Angular Momentum.*/
298 >    void getInertiaTensor(Mat3x3d &intertiaTensor,Vector3d &angularMomentum);
299 >    
300 >    /** Returns system angular momentum */
301 >    Vector3d getAngularMomentum();
302  
303 <        /** Returns the local index manager */
304 <        LocalIndexManager* getLocalIndexManager() {
305 <            return &localIndexMan_;
306 <        }
303 >    /** Returns volume of system as estimated by an ellipsoid defined
304 >        by the radii of gyration*/
305 >    void getGyrationalVolume(RealType &vol);
306 >    /** Overloaded version of gyrational volume that also returns
307 >        det(I) so dV/dr can be calculated*/
308 >    void getGyrationalVolume(RealType &vol, RealType &detI);
309 >    /** main driver function to interact with fortran during the
310 >        initialization and molecule migration */
311 >    void update();
312  
313 <        int getMoleculeStampId(int globalIndex) {
314 <            //assert(globalIndex < molStampIds_.size())
315 <            return molStampIds_[globalIndex];
316 <        }
313 >    /** Returns the local index manager */
314 >    LocalIndexManager* getLocalIndexManager() {
315 >      return &localIndexMan_;
316 >    }
317  
318 <        /** Returns the molecule stamp */
319 <        MoleculeStamp* getMoleculeStamp(int id) {
320 <            return moleculeStamps_[id];
321 <        }
318 >    int getMoleculeStampId(int globalIndex) {
319 >      //assert(globalIndex < molStampIds_.size())
320 >      return molStampIds_[globalIndex];
321 >    }
322  
323 <        /** Return the total number of the molecule stamps */
324 <        int getNMoleculeStamp() {
325 <            return moleculeStamps_.size();
326 <        }
281 <        /**
282 <         * Finds a molecule with a specified global index
283 <         * @return a pointer point to found molecule
284 <         * @param index
285 <         */
286 <        Molecule* getMoleculeByGlobalIndex(int index) {
287 <            MoleculeIterator i;
288 <            i = molecules_.find(index);
323 >    /** Returns the molecule stamp */
324 >    MoleculeStamp* getMoleculeStamp(int id) {
325 >      return moleculeStamps_[id];
326 >    }
327  
328 <            return i != molecules_.end() ? i->second : NULL;
329 <        }
328 >    /** Return the total number of the molecule stamps */
329 >    int getNMoleculeStamp() {
330 >      return moleculeStamps_.size();
331 >    }
332 >    /**
333 >     * Finds a molecule with a specified global index
334 >     * @return a pointer point to found molecule
335 >     * @param index
336 >     */
337 >    Molecule* getMoleculeByGlobalIndex(int index) {
338 >      MoleculeIterator i;
339 >      i = molecules_.find(index);
340  
341 <        /** Calculate the maximum cutoff radius based on the atom types */
342 <        double calcMaxCutoffRadius();
341 >      return i != molecules_.end() ? i->second : NULL;
342 >    }
343  
344 <        double getRcut() {
345 <            return rcut_;
346 <        }
344 >    int getGlobalMolMembership(int id){
345 >      return globalMolMembership_[id];
346 >    }
347  
348 <        double getRsw() {
349 <            return rsw_;
350 <        }
303 <        
304 <        std::string getFinalConfigFileName() {
305 <            return finalConfigFileName_;
306 <        }
307 <        
308 <        void setFinalConfigFileName(const std::string& fileName) {
309 <            finalConfigFileName_ = fileName;
310 <        }
348 >    RealType getCutoffRadius() {
349 >      return cutoffRadius_;
350 >    }
351  
352 <        std::string getDumpFileName() {
353 <            return dumpFileName_;
354 <        }
352 >    RealType getSwitchingRadius() {
353 >      return switchingRadius_;
354 >    }
355 >
356 >    RealType getListRadius() {
357 >      return listRadius_;
358 >    }
359          
360 <        void setDumpFileName(const std::string& fileName) {
361 <            dumpFileName_ = fileName;
362 <        }
360 >    string getFinalConfigFileName() {
361 >      return finalConfigFileName_;
362 >    }
363  
364 <        std::string getStatFileName() {
365 <            return statFileName_;
366 <        }
364 >    void setFinalConfigFileName(const string& fileName) {
365 >      finalConfigFileName_ = fileName;
366 >    }
367 >
368 >    string getRawMetaData() {
369 >      return rawMetaData_;
370 >    }
371 >    void setRawMetaData(const string& rawMetaData) {
372 >      rawMetaData_ = rawMetaData;
373 >    }
374          
375 <        void setStatFileName(const std::string& fileName) {
376 <            statFileName_ = fileName;
377 <        }
375 >    string getDumpFileName() {
376 >      return dumpFileName_;
377 >    }
378          
379 <        std::string getRestFileName() {
380 <          return restFileName_;
381 <        }
331 <        
332 <        void setRestFileName(const std::string& fileName) {
333 <          restFileName_ = fileName;
334 <        }
379 >    void setDumpFileName(const string& fileName) {
380 >      dumpFileName_ = fileName;
381 >    }
382  
383 <        /**
384 <         * Sets GlobalGroupMembership
385 <         * @see #SimCreator::setGlobalIndex
386 <         */  
387 <        void setGlobalGroupMembership(const std::vector<int>& globalGroupMembership) {
388 <            assert(globalGroupMembership.size() == nGlobalAtoms_);
389 <            globalGroupMembership_ = globalGroupMembership;
390 <        }
383 >    string getStatFileName() {
384 >      return statFileName_;
385 >    }
386 >        
387 >    void setStatFileName(const string& fileName) {
388 >      statFileName_ = fileName;
389 >    }
390 >        
391 >    string getRestFileName() {
392 >      return restFileName_;
393 >    }
394 >        
395 >    void setRestFileName(const string& fileName) {
396 >      restFileName_ = fileName;
397 >    }
398  
399 <        /**
400 <         * Sets GlobalMolMembership
401 <         * @see #SimCreator::setGlobalIndex
402 <         */        
403 <        void setGlobalMolMembership(const std::vector<int>& globalMolMembership) {
404 <            assert(globalMolMembership.size() == nGlobalAtoms_);
405 <            globalMolMembership_ = globalMolMembership;
406 <        }
399 >    /**
400 >     * Sets GlobalGroupMembership
401 >     * @see #SimCreator::setGlobalIndex
402 >     */  
403 >    void setGlobalGroupMembership(const vector<int>& globalGroupMembership) {
404 >      assert(globalGroupMembership.size() == static_cast<size_t>(nGlobalAtoms_));
405 >      globalGroupMembership_ = globalGroupMembership;
406 >    }
407  
408 +    /**
409 +     * Sets GlobalMolMembership
410 +     * @see #SimCreator::setGlobalIndex
411 +     */        
412 +    void setGlobalMolMembership(const vector<int>& globalMolMembership) {
413 +      assert(globalMolMembership.size() == static_cast<size_t>(nGlobalAtoms_));
414 +      globalMolMembership_ = globalMolMembership;
415 +    }
416  
417 <        bool isFortranInitialized() {
418 <            return fortranInitialized_;
419 <        }
417 >
418 >    bool isFortranInitialized() {
419 >      return fortranInitialized_;
420 >    }
421          
422 <        //below functions are just forward functions
423 <        //To compose or to inherit is always a hot debate. In general, is-a relation need subclassing, in the
424 <        //the other hand, has-a relation need composing.
362 <        /**
363 <         * Adds property into property map
364 <         * @param genData GenericData to be added into PropertyMap
365 <         */
366 <        void addProperty(GenericData* genData);
422 >    bool getCalcBoxDipole() {
423 >      return calcBoxDipole_;
424 >    }
425  
426 <        /**
427 <         * Removes property from PropertyMap by name
428 <         * @param propName the name of property to be removed
371 <         */
372 <        void removeProperty(const std::string& propName);
426 >    bool getUseAtomicVirial() {
427 >      return useAtomicVirial_;
428 >    }
429  
430 <        /**
431 <         * clear all of the properties
432 <         */
433 <        void clearProperties();
430 >    /**
431 >     * Adds property into property map
432 >     * @param genData GenericData to be added into PropertyMap
433 >     */
434 >    void addProperty(GenericData* genData);
435  
436 <        /**
437 <         * Returns all names of properties
438 <         * @return all names of properties
439 <         */
440 <        std::vector<std::string> getPropertyNames();
436 >    /**
437 >     * Removes property from PropertyMap by name
438 >     * @param propName the name of property to be removed
439 >     */
440 >    void removeProperty(const string& propName);
441  
442 <        /**
443 <         * Returns all of the properties in PropertyMap
444 <         * @return all of the properties in PropertyMap
445 <         */      
389 <        std::vector<GenericData*> getProperties();
442 >    /**
443 >     * clear all of the properties
444 >     */
445 >    void clearProperties();
446  
447 <        /**
448 <         * Returns property
449 <         * @param propName name of property
450 <         * @return a pointer point to property with propName. If no property named propName
451 <         * exists, return NULL
396 <         */      
397 <        GenericData* getPropertyByName(const std::string& propName);
447 >    /**
448 >     * Returns all names of properties
449 >     * @return all names of properties
450 >     */
451 >    vector<string> getPropertyNames();
452  
453 <        /**
454 <         * add all exclude pairs of a molecule into exclude list.
455 <         */
456 <        void addExcludePairs(Molecule* mol);
453 >    /**
454 >     * Returns all of the properties in PropertyMap
455 >     * @return all of the properties in PropertyMap
456 >     */      
457 >    vector<GenericData*> getProperties();
458  
459 <        /**
460 <         * remove all exclude pairs which belong to a molecule from exclude list
461 <         */
459 >    /**
460 >     * Returns property
461 >     * @param propName name of property
462 >     * @return a pointer point to property with propName. If no property named propName
463 >     * exists, return NULL
464 >     */      
465 >    GenericData* getPropertyByName(const string& propName);
466  
467 <        void removeExcludePairs(Molecule* mol);
467 >    /**
468 >     * add all special interaction pairs (including excluded
469 >     * interactions) in a molecule into the appropriate lists.
470 >     */
471 >    void addInteractionPairs(Molecule* mol);
472  
473 +    /**
474 +     * remove all special interaction pairs which belong to a molecule
475 +     * from the appropriate lists.
476 +     */
477 +    void removeInteractionPairs(Molecule* mol);
478  
479 <        /** Returns the unique atom types of local processor in an array */
480 <        std::set<AtomType*> getUniqueAtomTypes();
479 >
480 >    /** Returns the unique atom types of local processor in an array */
481 >    set<AtomType*> getUniqueAtomTypes();
482 >
483 >    /** Returns the set of atom types present in this simulation */
484 >    set<AtomType*> getSimulatedAtomTypes();
485          
486 <        friend std::ostream& operator <<(std::ostream& o, SimInfo& info);
486 >    friend ostream& operator <<(ostream& o, SimInfo& info);
487  
488 <        void getCutoff(double& rcut, double& rsw);
488 >    void getCutoff(RealType& rcut, RealType& rsw);
489          
490 <    private:
490 >  private:
491  
492 <        /** fill up the simtype struct*/
493 <        void setupSimType();
492 >    /** fill up the simtype struct*/
493 >    void setupSimType();
494  
495 <        /**
496 <         * Setup Fortran Simulation
497 <         * @see #setupFortranParallel
498 <         */
499 <        void setupFortranSim();
495 >    /**
496 >     * Setup Fortran Simulation
497 >     * @see #setupFortranParallel
498 >     */
499 >    void setupFortranSim();
500  
501 <        /** Figure out the radius of cutoff, radius of switching function and pass them to fortran */
502 <        void setupCutoff();
501 >    /** Figure out the cutoff radius */
502 >    void setupCutoffRadius();
503 >    /** Figure out the cutoff method */
504 >    void setupCutoffMethod();
505 >    /** Figure out the switching radius */
506 >    void setupSwitchingRadius();
507 >    /** Figure out the neighbor list skin thickness */
508 >    void setupSkinThickness();
509 >    /** Figure out which polynomial type to use for the switching function */
510 >    void setupSwitchingFunction();
511  
512 <        /** Calculates the number of degress of freedom in the whole system */
513 <        void calcNdf();
434 <        void calcNdfRaw();
435 <        void calcNdfTrans();
512 >    /** Determine if we need to accumulate the simulation box dipole */
513 >    void setupAccumulateBoxDipole();
514  
515 <        /**
516 <         * Adds molecule stamp and the total number of the molecule with same molecule stamp in the whole
517 <         * system.
518 <         */
441 <        void addMoleculeStamp(MoleculeStamp* molStamp, int nmol);
515 >    /** Calculates the number of degress of freedom in the whole system */
516 >    void calcNdf();
517 >    void calcNdfRaw();
518 >    void calcNdfTrans();
519  
520 <        ForceField* forceField_;      
521 <        Globals* simParams_;
520 >    /**
521 >     * Adds molecule stamp and the total number of the molecule with
522 >     * same molecule stamp in the whole system.
523 >     */
524 >    void addMoleculeStamp(MoleculeStamp* molStamp, int nmol);
525  
526 <        std::map<int, Molecule*>  molecules_; /**< Molecule array */
527 <        
528 <        //degress of freedom
449 <        int ndf_;           /**< number of degress of freedom (excludes constraints),  ndf_ is local */
450 <        int ndfRaw_;    /**< number of degress of freedom (includes constraints),  ndfRaw_ is local */
451 <        int ndfTrans_; /**< number of translation degress of freedom, ndfTrans_ is local */
452 <        int nZconstraint_; /** number of  z-constraint molecules, nZconstraint_ is global */
453 <        
454 <        //number of global objects
455 <        int nGlobalMols_;       /**< number of molecules in the system */
456 <        int nGlobalAtoms_;   /**< number of atoms in the system */
457 <        int nGlobalCutoffGroups_; /**< number of cutoff groups in this system */
458 <        int nGlobalIntegrableObjects_; /**< number of integrable objects in this system */
459 <        int nGlobalRigidBodies_; /**< number of rigid bodies in this system */
460 <        /**
461 <         * the size of globalGroupMembership_  is nGlobalAtoms. Its index is  global index of an atom, and the
462 <         * corresponding content is the global index of cutoff group this atom belong to.
463 <         * It is filled by SimCreator once and only once, since it never changed during the simulation.
464 <         */
465 <        std::vector<int> globalGroupMembership_;
466 <
467 <        /**
468 <         * the size of globalGroupMembership_  is nGlobalAtoms. Its index is  global index of an atom, and the
469 <         * corresponding content is the global index of molecule this atom belong to.
470 <         * It is filled by SimCreator once and only once, since it is never changed during the simulation.
471 <         */
472 <        std::vector<int> globalMolMembership_;        
526 >    // Other classes holdingn important information
527 >    ForceField* forceField_; /**< provides access to defined atom types, bond types, etc. */
528 >    Globals* simParams_;     /**< provides access to simulation parameters set by user */
529  
530 +    ///  Counts of local objects
531 +    int nAtoms_;              /**< number of atoms in local processor */
532 +    int nBonds_;              /**< number of bonds in local processor */
533 +    int nBends_;              /**< number of bends in local processor */
534 +    int nTorsions_;           /**< number of torsions in local processor */
535 +    int nInversions_;         /**< number of inversions in local processor */
536 +    int nRigidBodies_;        /**< number of rigid bodies in local processor */
537 +    int nIntegrableObjects_;  /**< number of integrable objects in local processor */
538 +    int nCutoffGroups_;       /**< number of cutoff groups in local processor */
539 +    int nConstraints_;        /**< number of constraints in local processors */
540          
541 <        std::vector<int> molStampIds_;                                /**< stamp id array of all molecules in the system */
542 <        std::vector<MoleculeStamp*> moleculeStamps_;      /**< molecule stamps array */        
543 <        
544 <        //number of local objects
545 <        int nAtoms_;                        /**< number of atoms in local processor */
546 <        int nBonds_;                        /**< number of bonds in local processor */
547 <        int nBends_;                        /**< number of bends in local processor */
548 <        int nTorsions_;                    /**< number of torsions in local processor */
549 <        int nRigidBodies_;              /**< number of rigid bodies in local processor */
550 <        int nIntegrableObjects_;    /**< number of integrable objects in local processor */
551 <        int nCutoffGroups_;             /**< number of cutoff groups in local processor */
552 <        int nConstraints_;              /**< number of constraints in local processors */
541 >    /// Counts of global objects
542 >    int nGlobalMols_;              /**< number of molecules in the system (GLOBAL) */
543 >    int nGlobalAtoms_;             /**< number of atoms in the system (GLOBAL) */
544 >    int nGlobalCutoffGroups_;      /**< number of cutoff groups in this system (GLOBAL) */
545 >    int nGlobalIntegrableObjects_; /**< number of integrable objects in this system */
546 >    int nGlobalRigidBodies_;       /**< number of rigid bodies in this system (GLOBAL) */
547 >      
548 >    /// Degress of freedom
549 >    int ndf_;          /**< number of degress of freedom (excludes constraints) (LOCAL) */
550 >    int fdf_local;     /**< number of frozen degrees of freedom (LOCAL) */
551 >    int fdf_;          /**< number of frozen degrees of freedom (GLOBAL) */
552 >    int ndfRaw_;       /**< number of degress of freedom (includes constraints),  (LOCAL) */
553 >    int ndfTrans_;     /**< number of translation degress of freedom, (LOCAL) */
554 >    int nZconstraint_; /**< number of  z-constraint molecules (GLOBAL) */
555  
556 <        simtype fInfo_; /**< A dual struct shared by c++/fortran which indicates the atom types in simulation*/
557 <        Exclude exclude_;      
558 <        PropertyMap properties_;                  /**< Generic Property */
559 <        SnapshotManager* sman_;               /**< SnapshotManager */
556 >    /// logicals
557 >    bool usesPeriodicBoundaries_; /**< use periodic boundary conditions? */
558 >    bool usesDirectionalAtoms_;   /**< are there atoms with position AND orientation? */
559 >    bool usesMetallicAtoms_;      /**< are there transition metal atoms? */
560 >    bool usesElectrostaticAtoms_; /**< are there electrostatic atoms? */
561 >    bool usesAtomicVirial_;       /**< are we computing atomic virials? */
562 >    bool requiresPrepair_;        /**< does this simulation require a pre-pair loop? */
563 >    bool requiresSkipCorrection_; /**< does this simulation require a skip-correction? */
564 >    bool requiresSelfCorrection_; /**< does this simulation require a self-correction? */
565  
566 <        /**
567 <         * The reason to have a local index manager is that when molecule is migrating to other processors,
568 <         * the atoms and the rigid-bodies will release their local indices to LocalIndexManager. Combining the
569 <         * information of molecule migrating to current processor, Migrator class can query  the LocalIndexManager
570 <         * to make a efficient data moving plan.
571 <         */        
572 <        LocalIndexManager localIndexMan_;
566 >    /// Data structures holding primary simulation objects
567 >    map<int, Molecule*>  molecules_;  /**< map holding pointers to LOCAL molecules */
568 >    simtype fInfo_;                   /**< A dual struct shared by C++
569 >                                         and Fortran to pass
570 >                                         information about what types
571 >                                         of calculation are
572 >                                         required */
573 >    
574 >    /// Stamps are templates for objects that are then used to create
575 >    /// groups of objects.  For example, a molecule stamp contains
576 >    /// information on how to build that molecule (i.e. the topology,
577 >    /// the atoms, the bonds, etc.)  Once the system is built, the
578 >    /// stamps are no longer useful.
579 >    vector<int> molStampIds_;                /**< stamp id for molecules in the system */
580 >    vector<MoleculeStamp*> moleculeStamps_;  /**< molecule stamps array */        
581  
582 <        //file names
583 <        std::string finalConfigFileName_;
584 <        std::string dumpFileName_;
585 <        std::string statFileName_;
586 <        std::string restFileName_;
587 <        
588 <        double rcut_;       /**< cutoff radius*/
508 <        double rsw_;        /**< radius of switching function*/
582 >    /**
583 >     * A vector that maps between the global index of an atom, and the
584 >     * global index of cutoff group the atom belong to.  It is filled
585 >     * by SimCreator once and only once, since it never changed during
586 >     * the simulation.  It should be nGlobalAtoms_ in size.
587 >     */
588 >    vector<int> globalGroupMembership_;
589  
590 <        bool fortranInitialized_; /**< flag indicate whether fortran side is initialized */
590 >    /**
591 >     * A vector that maps between the global index of an atom and the
592 >     * global index of the molecule the atom belongs to.  It is filled
593 >     * by SimCreator once and only once, since it is never changed
594 >     * during the simulation. It shoudl be nGlobalAtoms_ in size.
595 >     */
596 >    vector<int> globalMolMembership_;        
597 >              
598 >    /// lists to handle atoms needing special treatment in the non-bonded interactions
599 >    PairList excludedInteractions_;  /**< atoms excluded from interacting with each other */
600 >    PairList oneTwoInteractions_;    /**< atoms that are directly Bonded */
601 >    PairList oneThreeInteractions_;  /**< atoms sharing a Bend */    
602 >    PairList oneFourInteractions_;   /**< atoms sharing a Torsion */
603  
604 < #ifdef IS_MPI
605 <    //in Parallel version, we need MolToProc
514 <    public:
515 <                
516 <        /**
517 <         * Finds the processor where a molecule resides
518 <         * @return the id of the processor which contains the molecule
519 <         * @param globalIndex global Index of the molecule
520 <         */
521 <        int getMolToProc(int globalIndex) {
522 <            //assert(globalIndex < molToProcMap_.size());
523 <            return molToProcMap_[globalIndex];
524 <        }
604 >    PropertyMap properties_;       /**< Generic Properties can be added */
605 >    SnapshotManager* sman_;        /**< SnapshotManager (handles particle positions, etc.) */
606  
607 <        /**
608 <         * Set MolToProcMap array
609 <         * @see #SimCreator::divideMolecules
610 <         */
611 <        void setMolToProcMap(const std::vector<int>& molToProcMap) {
612 <            molToProcMap_ = molToProcMap;
613 <        }
607 >    /**
608 >     * The reason to have a local index manager is that when molecule
609 >     * is migrating to other processors, the atoms and the
610 >     * rigid-bodies will release their local indices to
611 >     * LocalIndexManager. Combining the information of molecule
612 >     * migrating to current processor, Migrator class can query the
613 >     * LocalIndexManager to make a efficient data moving plan.
614 >     */        
615 >    LocalIndexManager localIndexMan_;
616 >
617 >    // unparsed MetaData block for storing in Dump and EOR files:
618 >    string rawMetaData_;
619 >
620 >    // file names
621 >    string finalConfigFileName_;
622 >    string dumpFileName_;
623 >    string statFileName_;
624 >    string restFileName_;
625          
626 <    private:
626 >    RealType cutoffRadius_;         /**< cutoff radius for non-bonded interactions */
627 >    RealType switchingRadius_;      /**< inner radius of switching function */
628 >    RealType listRadius_;           /**< Verlet neighbor list radius */
629 >    RealType skinThickness_;        /**< Verlet neighbor list skin thickness */    
630 >    CutoffMethod cutoffMethod_;     /**< Cutoff Method for most non-bonded interactions */
631  
632 <        void setupFortranParallel();
632 >    bool fortranInitialized_; /** flag to indicate whether the fortran side is initialized */
633 >    
634 >    bool calcBoxDipole_; /**< flag to indicate whether or not we calculate
635 >                            the simulation box dipole moment */
636 >    
637 >    bool useAtomicVirial_; /**< flag to indicate whether or not we use
638 >                              Atomic Virials to calculate the pressure */
639 >    
640 >  public:
641 >    /**
642 >     * return an integral objects by its global index. In MPI
643 >     * version, if the StuntDouble with specified global index does
644 >      * not belong to local processor, a NULL will be return.
645 >      */
646 >    StuntDouble* getIOIndexToIntegrableObject(int index);
647 >    void setIOIndexToIntegrableObject(const vector<StuntDouble*>& v);
648 >    
649 >  private:
650 >    vector<StuntDouble*> IOIndexToIntegrableObject;
651 >    
652 >  public:
653 >                
654 >    /**
655 >     * Finds the processor where a molecule resides
656 >     * @return the id of the processor which contains the molecule
657 >     * @param globalIndex global Index of the molecule
658 >     */
659 >    int getMolToProc(int globalIndex) {
660 >      //assert(globalIndex < molToProcMap_.size());
661 >      return molToProcMap_[globalIndex];
662 >    }
663 >    
664 >    /**
665 >     * Set MolToProcMap array
666 >     * @see #SimCreator::divideMolecules
667 >     */
668 >    void setMolToProcMap(const vector<int>& molToProcMap) {
669 >      molToProcMap_ = molToProcMap;
670 >    }
671          
672 <        /**
539 <         * The size of molToProcMap_ is equal to total number of molecules in the system.
540 <         *  It maps a molecule to the processor on which it resides. it is filled by SimCreator once and only
541 <         * once.
542 <         */        
543 <        std::vector<int> molToProcMap_;
672 >  private:
673  
674 < #endif
674 >    void setupFortranParallel();
675 >        
676 >    /**
677 >     * The size of molToProcMap_ is equal to total number of molecules
678 >     * in the system.  It maps a molecule to the processor on which it
679 >     * resides. it is filled by SimCreator once and only once.
680 >     */        
681 >    vector<int> molToProcMap_;
682  
683 < };
683 >  };
684  
685 < } //namespace oopse
685 > } //namespace OpenMD
686   #endif //BRAINS_SIMMODEL_HPP
687  

Comparing:
trunk/src/brains/SimInfo.hpp (property svn:keywords), Revision 417 by chrisfen, Thu Mar 10 15:10:24 2005 UTC vs.
branches/development/src/brains/SimInfo.hpp (property svn:keywords), Revision 1528 by gezelter, Fri Dec 17 20:11:05 2010 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines