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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines