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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines