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 1024 by tim, Wed Aug 30 18:42:29 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"
# 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, 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 <         * 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 rigid bodies */        
175 >    unsigned int getNRigidBodies() {
176 >      return nRigidBodies_;
177 >    }
178  
179 <        /** Returns the number of local integrable objects */
180 <        unsigned int getNIntegrableObjects() {
181 <            return nIntegrableObjects_;
182 <        }
179 >    /** Returns the number of local integrable objects */
180 >    unsigned int getNIntegrableObjects() {
181 >      return nIntegrableObjects_;
182 >    }
183  
184 <        /** Returns the number of local cutoff groups */
185 <        unsigned int getNCutoffGroups() {
186 <            return nCutoffGroups_;
187 <        }
184 >    /** Returns the number of local cutoff groups */
185 >    unsigned int getNCutoffGroups() {
186 >      return nCutoffGroups_;
187 >    }
188  
189 <        /** Returns the total number of constraints in this SimInfo */
190 <        unsigned int getNConstraints() {
191 <            return nConstraints_;
192 <        }
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 <        }
217 <
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
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 >    }
222 >
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 <        /** main driver function to interact with fortran during the initialization and molecule migration */
270 <        void update();
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 <        /** Returns the local index manager */
276 <        LocalIndexManager* getLocalIndexManager() {
264 <            return &localIndexMan_;
265 <        }
275 >    /** main driver function to interact with fortran during the initialization and molecule migration */
276 >    void update();
277  
278 <        int getMoleculeStampId(int globalIndex) {
279 <            //assert(globalIndex < molStampIds_.size())
280 <            return molStampIds_[globalIndex];
281 <        }
278 >    /** Returns the local index manager */
279 >    LocalIndexManager* getLocalIndexManager() {
280 >      return &localIndexMan_;
281 >    }
282  
283 <        /** Returns the molecule stamp */
284 <        MoleculeStamp* getMoleculeStamp(int id) {
285 <            return moleculeStamps_[id];
286 <        }
283 >    int getMoleculeStampId(int globalIndex) {
284 >      //assert(globalIndex < molStampIds_.size())
285 >      return molStampIds_[globalIndex];
286 >    }
287  
288 <        /** Return the total number of the molecule stamps */
289 <        int getNMoleculeStamp() {
290 <            return moleculeStamps_.size();
291 <        }
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);
288 >    /** Returns the molecule stamp */
289 >    MoleculeStamp* getMoleculeStamp(int id) {
290 >      return moleculeStamps_[id];
291 >    }
292  
293 <            return i != molecules_.end() ? i->second : NULL;
294 <        }
293 >    /** Return the total number of the molecule stamps */
294 >    int getNMoleculeStamp() {
295 >      return moleculeStamps_.size();
296 >    }
297 >    /**
298 >     * Finds a molecule with a specified global index
299 >     * @return a pointer point to found molecule
300 >     * @param index
301 >     */
302 >    Molecule* getMoleculeByGlobalIndex(int index) {
303 >      MoleculeIterator i;
304 >      i = molecules_.find(index);
305  
306 <        /** Calculate the maximum cutoff radius based on the atom types */
307 <        double calcMaxCutoffRadius();
306 >      return i != molecules_.end() ? i->second : NULL;
307 >    }
308  
309 <        double getRcut() {
310 <            return rcut_;
311 <        }
309 >    RealType getRcut() {
310 >      return rcut_;
311 >    }
312  
313 <        double getRsw() {
314 <            return rsw_;
315 <        }
313 >    RealType getRsw() {
314 >      return rsw_;
315 >    }
316 >
317 >    RealType getList() {
318 >      return rlist_;
319 >    }
320          
321 <        std::string getFinalConfigFileName() {
322 <            return finalConfigFileName_;
323 <        }
307 <        
308 <        void setFinalConfigFileName(const std::string& fileName) {
309 <            finalConfigFileName_ = fileName;
310 <        }
321 >    std::string getFinalConfigFileName() {
322 >      return finalConfigFileName_;
323 >    }
324  
325 <        std::string getDumpFileName() {
326 <            return dumpFileName_;
327 <        }
325 >    void setFinalConfigFileName(const std::string& fileName) {
326 >      finalConfigFileName_ = fileName;
327 >    }
328 >
329 >    std::string getRawMetaData() {
330 >      return rawMetaData_;
331 >    }
332 >    void setRawMetaData(const std::string& rawMetaData) {
333 >      rawMetaData_ = rawMetaData;
334 >    }
335          
336 <        void setDumpFileName(const std::string& fileName) {
337 <            dumpFileName_ = fileName;
338 <        }
336 >    std::string getDumpFileName() {
337 >      return dumpFileName_;
338 >    }
339 >        
340 >    void setDumpFileName(const std::string& fileName) {
341 >      dumpFileName_ = fileName;
342 >    }
343  
344 <        std::string getStatFileName() {
345 <            return statFileName_;
346 <        }
344 >    std::string getStatFileName() {
345 >      return statFileName_;
346 >    }
347          
348 <        void setStatFileName(const std::string& fileName) {
349 <            statFileName_ = fileName;
350 <        }
348 >    void setStatFileName(const std::string& fileName) {
349 >      statFileName_ = fileName;
350 >    }
351          
352 <        std::string getRestFileName() {
353 <          return restFileName_;
354 <        }
352 >    std::string getRestFileName() {
353 >      return restFileName_;
354 >    }
355          
356 <        void setRestFileName(const std::string& fileName) {
357 <          restFileName_ = fileName;
358 <        }
356 >    void setRestFileName(const std::string& fileName) {
357 >      restFileName_ = fileName;
358 >    }
359 >
360 >    /**
361 >     * Sets GlobalGroupMembership
362 >     * @see #SimCreator::setGlobalIndex
363 >     */  
364 >    void setGlobalGroupMembership(const std::vector<int>& globalGroupMembership) {
365 >      assert(globalGroupMembership.size() == nGlobalAtoms_);
366 >      globalGroupMembership_ = globalGroupMembership;
367 >    }
368  
369 <        /**
370 <         * Sets GlobalGroupMembership
371 <         * @see #SimCreator::setGlobalIndex
372 <         */  
373 <        void setGlobalGroupMembership(const std::vector<int>& globalGroupMembership) {
374 <            assert(globalGroupMembership.size() == nGlobalAtoms_);
375 <            globalGroupMembership_ = globalGroupMembership;
376 <        }
369 >    /**
370 >     * Sets GlobalMolMembership
371 >     * @see #SimCreator::setGlobalIndex
372 >     */        
373 >    void setGlobalMolMembership(const std::vector<int>& globalMolMembership) {
374 >      assert(globalMolMembership.size() == nGlobalAtoms_);
375 >      globalMolMembership_ = globalMolMembership;
376 >    }
377  
345        /**
346         * Sets GlobalMolMembership
347         * @see #SimCreator::setGlobalIndex
348         */        
349        void setGlobalMolMembership(const std::vector<int>& globalMolMembership) {
350            assert(globalMolMembership.size() == nGlobalAtoms_);
351            globalMolMembership_ = globalMolMembership;
352        }
378  
379 <
380 <        bool isFortranInitialized() {
381 <            return fortranInitialized_;
357 <        }
379 >    bool isFortranInitialized() {
380 >      return fortranInitialized_;
381 >    }
382          
383 <        //below functions are just forward functions
384 <        //To compose or to inherit is always a hot debate. In general, is-a relation need subclassing, in the
385 <        //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);
383 >    bool getCalcBoxDipole() {
384 >      return calcBoxDipole_;
385 >    }
386  
387 <        /**
388 <         * Removes property from PropertyMap by name
389 <         * @param propName the name of property to be removed
390 <         */
391 <        void removeProperty(const std::string& propName);
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.
390 >    /**
391 >     * Adds property into property map
392 >     * @param genData GenericData to be added into PropertyMap
393 >     */
394 >    void addProperty(GenericData* genData);
395  
396 <        /**
397 <         * clear all of the properties
398 <         */
399 <        void clearProperties();
396 >    /**
397 >     * Removes property from PropertyMap by name
398 >     * @param propName the name of property to be removed
399 >     */
400 >    void removeProperty(const std::string& propName);
401  
402 <        /**
403 <         * Returns all names of properties
404 <         * @return all names of properties
405 <         */
383 <        std::vector<std::string> getPropertyNames();
402 >    /**
403 >     * clear all of the properties
404 >     */
405 >    void clearProperties();
406  
407 <        /**
408 <         * Returns all of the properties in PropertyMap
409 <         * @return all of the properties in PropertyMap
410 <         */      
411 <        std::vector<GenericData*> getProperties();
407 >    /**
408 >     * Returns all names of properties
409 >     * @return all names of properties
410 >     */
411 >    std::vector<std::string> getPropertyNames();
412  
413 <        /**
414 <         * Returns property
415 <         * @param propName name of property
416 <         * @return a pointer point to property with propName. If no property named propName
417 <         * exists, return NULL
396 <         */      
397 <        GenericData* getPropertyByName(const std::string& propName);
413 >    /**
414 >     * Returns all of the properties in PropertyMap
415 >     * @return all of the properties in PropertyMap
416 >     */      
417 >    std::vector<GenericData*> getProperties();
418  
419 <        /**
420 <         * add all exclude pairs of a molecule into exclude list.
421 <         */
422 <        void addExcludePairs(Molecule* mol);
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
424 >     */      
425 >    GenericData* getPropertyByName(const std::string& propName);
426  
427 <        /**
428 <         * remove all exclude pairs which belong to a molecule from exclude list
429 <         */
427 >    /**
428 >     * add all exclude pairs of a molecule into exclude list.
429 >     */
430 >    void addExcludePairs(Molecule* mol);
431  
432 <        void removeExcludePairs(Molecule* mol);
432 >    /**
433 >     * remove all exclude pairs which belong to a molecule from exclude list
434 >     */
435  
436 +    void removeExcludePairs(Molecule* mol);
437  
438 <        /** Returns the unique atom types of local processor in an array */
439 <        std::set<AtomType*> getUniqueAtomTypes();
438 >
439 >    /** Returns the unique atom types of local processor in an array */
440 >    std::set<AtomType*> getUniqueAtomTypes();
441          
442 <        friend std::ostream& operator <<(std::ostream& o, SimInfo& info);
442 >    friend std::ostream& operator <<(std::ostream& o, SimInfo& info);
443  
444 <        void getCutoff(double& rcut, double& rsw);
444 >    void getCutoff(RealType& rcut, RealType& rsw);
445          
446 <    private:
446 >  private:
447  
448 <        /** fill up the simtype struct*/
449 <        void setupSimType();
448 >    /** fill up the simtype struct*/
449 >    void setupSimType();
450  
451 <        /**
452 <         * Setup Fortran Simulation
453 <         * @see #setupFortranParallel
454 <         */
455 <        void setupFortranSim();
451 >    /**
452 >     * Setup Fortran Simulation
453 >     * @see #setupFortranParallel
454 >     */
455 >    void setupFortranSim();
456  
457 <        /** Figure out the radius of cutoff, radius of switching function and pass them to fortran */
458 <        void setupCutoff();
457 >    /** Figure out the radius of cutoff, radius of switching function and pass them to fortran */
458 >    void setupCutoff();
459  
460 <        /** Calculates the number of degress of freedom in the whole system */
461 <        void calcNdf();
434 <        void calcNdfRaw();
435 <        void calcNdfTrans();
460 >    /** Figure out which coulombic correction method to use and pass to fortran */
461 >    void setupElectrostaticSummationMethod( int isError );
462  
463 <        /**
464 <         * 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);
463 >    /** Figure out which polynomial type to use for the switching function */
464 >    void setupSwitchingFunction();
465  
466 <        ForceField* forceField_;      
467 <        Globals* simParams_;
466 >    /** Determine if we need to accumulate the simulation box dipole */
467 >    void setupAccumulateBoxDipole();
468  
469 <        std::map<int, Molecule*>  molecules_; /**< Molecule array */
469 >    /** Calculates the number of degress of freedom in the whole system */
470 >    void calcNdf();
471 >    void calcNdfRaw();
472 >    void calcNdfTrans();
473 >
474 >    ForceField* forceField_;      
475 >    Globals* simParams_;
476 >
477 >    std::map<int, Molecule*>  molecules_; /**< Molecule array */
478 >
479 >    /**
480 >     * Adds molecule stamp and the total number of the molecule with same molecule stamp in the whole
481 >     * system.
482 >     */
483 >    void addMoleculeStamp(MoleculeStamp* molStamp, int nmol);
484          
485 <        //degress of freedom
486 <        int ndf_;           /**< number of degress of freedom (excludes constraints),  ndf_ is local */
487 <        int ndfRaw_;    /**< number of degress of freedom (includes constraints),  ndfRaw_ is local */
488 <        int ndfTrans_; /**< number of translation degress of freedom, ndfTrans_ is local */
489 <        int nZconstraint_; /** number of  z-constraint molecules, nZconstraint_ is global */
485 >    //degress of freedom
486 >    int ndf_;           /**< number of degress of freedom (excludes constraints),  ndf_ is local */
487 >    int fdf_local;       /**< number of frozen degrees of freedom */
488 >    int fdf_;            /**< number of frozen degrees of freedom */
489 >    int ndfRaw_;    /**< number of degress of freedom (includes constraints),  ndfRaw_ is local */
490 >    int ndfTrans_; /**< number of translation degress of freedom, ndfTrans_ is local */
491 >    int nZconstraint_; /** number of  z-constraint molecules, nZconstraint_ is global */
492          
493 <        //number of global objects
494 <        int nGlobalMols_;       /**< number of molecules in the system */
495 <        int nGlobalAtoms_;   /**< number of atoms in the system */
496 <        int nGlobalCutoffGroups_; /**< number of cutoff groups in this system */
497 <        int nGlobalIntegrableObjects_; /**< number of integrable objects in this system */
498 <        int nGlobalRigidBodies_; /**< number of rigid bodies in this system */
499 <        /**
500 <         * the size of globalGroupMembership_  is nGlobalAtoms. Its index is  global index of an atom, and the
501 <         * corresponding content is the global index of cutoff group this atom belong to.
502 <         * It is filled by SimCreator once and only once, since it never changed during the simulation.
503 <         */
504 <        std::vector<int> globalGroupMembership_;
493 >    //number of global objects
494 >    int nGlobalMols_;       /**< number of molecules in the system */
495 >    int nGlobalAtoms_;   /**< number of atoms in the system */
496 >    int nGlobalCutoffGroups_; /**< number of cutoff groups in this system */
497 >    int nGlobalIntegrableObjects_; /**< number of integrable objects in this system */
498 >    int nGlobalRigidBodies_; /**< number of rigid bodies in this system */
499 >    /**
500 >     * the size of globalGroupMembership_  is nGlobalAtoms. Its index is  global index of an atom, and the
501 >     * corresponding content is the global index of cutoff group this atom belong to.
502 >     * It is filled by SimCreator once and only once, since it never changed during the simulation.
503 >     */
504 >    std::vector<int> globalGroupMembership_;
505  
506 <        /**
507 <         * the size of globalGroupMembership_  is nGlobalAtoms. Its index is  global index of an atom, and the
508 <         * corresponding content is the global index of molecule this atom belong to.
509 <         * It is filled by SimCreator once and only once, since it is never changed during the simulation.
510 <         */
511 <        std::vector<int> globalMolMembership_;        
506 >    /**
507 >     * the size of globalGroupMembership_  is nGlobalAtoms. Its index is  global index of an atom, and the
508 >     * corresponding content is the global index of molecule this atom belong to.
509 >     * It is filled by SimCreator once and only once, since it is never changed during the simulation.
510 >     */
511 >    std::vector<int> globalMolMembership_;        
512  
513          
514 <        std::vector<int> molStampIds_;                                /**< stamp id array of all molecules in the system */
515 <        std::vector<MoleculeStamp*> moleculeStamps_;      /**< molecule stamps array */        
514 >    std::vector<int> molStampIds_;                                /**< stamp id array of all molecules in the system */
515 >    std::vector<MoleculeStamp*> moleculeStamps_;      /**< molecule stamps array */        
516          
517 <        //number of local objects
518 <        int nAtoms_;                        /**< number of atoms in local processor */
519 <        int nBonds_;                        /**< number of bonds in local processor */
520 <        int nBends_;                        /**< number of bends in local processor */
521 <        int nTorsions_;                    /**< number of torsions in local processor */
522 <        int nRigidBodies_;              /**< number of rigid bodies in local processor */
523 <        int nIntegrableObjects_;    /**< number of integrable objects in local processor */
524 <        int nCutoffGroups_;             /**< number of cutoff groups in local processor */
525 <        int nConstraints_;              /**< number of constraints in local processors */
517 >    //number of local objects
518 >    int nAtoms_;                        /**< number of atoms in local processor */
519 >    int nBonds_;                        /**< number of bonds in local processor */
520 >    int nBends_;                        /**< number of bends in local processor */
521 >    int nTorsions_;                    /**< number of torsions in local processor */
522 >    int nRigidBodies_;              /**< number of rigid bodies in local processor */
523 >    int nIntegrableObjects_;    /**< number of integrable objects in local processor */
524 >    int nCutoffGroups_;             /**< number of cutoff groups in local processor */
525 >    int nConstraints_;              /**< number of constraints in local processors */
526  
527 <        simtype fInfo_; /**< A dual struct shared by c++/fortran which indicates the atom types in simulation*/
528 <        Exclude exclude_;      
529 <        PropertyMap properties_;                  /**< Generic Property */
530 <        SnapshotManager* sman_;               /**< SnapshotManager */
527 >    simtype fInfo_; /**< A dual struct shared by c++/fortran which indicates the atom types in simulation*/
528 >    Exclude exclude_;      
529 >    PropertyMap properties_;                  /**< Generic Property */
530 >    SnapshotManager* sman_;               /**< SnapshotManager */
531  
532 <        /**
533 <         * The reason to have a local index manager is that when molecule is migrating to other processors,
534 <         * the atoms and the rigid-bodies will release their local indices to LocalIndexManager. Combining the
535 <         * information of molecule migrating to current processor, Migrator class can query  the LocalIndexManager
536 <         * to make a efficient data moving plan.
537 <         */        
538 <        LocalIndexManager localIndexMan_;
532 >    /**
533 >     * The reason to have a local index manager is that when molecule is migrating to other processors,
534 >     * the atoms and the rigid-bodies will release their local indices to LocalIndexManager. Combining the
535 >     * information of molecule migrating to current processor, Migrator class can query  the LocalIndexManager
536 >     * to make a efficient data moving plan.
537 >     */        
538 >    LocalIndexManager localIndexMan_;
539  
540 <        //file names
541 <        std::string finalConfigFileName_;
542 <        std::string dumpFileName_;
543 <        std::string statFileName_;
544 <        std::string restFileName_;
540 >    // unparsed MetaData block for storing in Dump and EOR files:
541 >    std::string rawMetaData_;
542 >
543 >    //file names
544 >    std::string finalConfigFileName_;
545 >    std::string dumpFileName_;
546 >    std::string statFileName_;
547 >    std::string restFileName_;
548          
549 <        double rcut_;       /**< cutoff radius*/
550 <        double rsw_;        /**< radius of switching function*/
549 >    RealType rcut_;       /**< cutoff radius*/
550 >    RealType rsw_;        /**< radius of switching function*/
551 >    RealType rlist_;      /**< neighbor list radius */
552  
553 <        bool fortranInitialized_; /**< flag indicate whether fortran side is initialized */
553 >    bool fortranInitialized_; /**< flag indicate whether fortran side is initialized */
554  
555 +    bool calcBoxDipole_; /**< flag to indicate whether or not we calculate the simulation box dipole moment */
556 +
557 +    public:
558 +     /**
559 +      * return an integral objects by its global index. In MPI version, if the StuntDouble with specified
560 +      * global index does not belong to local processor, a NULL will be return.
561 +      */
562 +      StuntDouble* getIOIndexToIntegrableObject(int index);
563 +      void setIOIndexToIntegrableObject(const std::vector<StuntDouble*>& v);
564 +    private:
565 +      std::vector<StuntDouble*> IOIndexToIntegrableObject;
566 +  //public:
567 +    //void setStuntDoubleFromGlobalIndex(std::vector<StuntDouble*> v);
568 +    /**
569 +     * return a StuntDouble by its global index. In MPI version, if the StuntDouble with specified
570 +     * global index does not belong to local processor, a NULL will be return.
571 +     */
572 +    //StuntDouble* getStuntDoubleFromGlobalIndex(int index);
573 +  //private:
574 +    //std::vector<StuntDouble*> sdByGlobalIndex_;
575 +    
576   #ifdef IS_MPI
577      //in Parallel version, we need MolToProc
578 <    public:
578 >  public:
579                  
580 <        /**
581 <         * Finds the processor where a molecule resides
582 <         * @return the id of the processor which contains the molecule
583 <         * @param globalIndex global Index of the molecule
584 <         */
585 <        int getMolToProc(int globalIndex) {
586 <            //assert(globalIndex < molToProcMap_.size());
587 <            return molToProcMap_[globalIndex];
588 <        }
580 >    /**
581 >     * Finds the processor where a molecule resides
582 >     * @return the id of the processor which contains the molecule
583 >     * @param globalIndex global Index of the molecule
584 >     */
585 >    int getMolToProc(int globalIndex) {
586 >      //assert(globalIndex < molToProcMap_.size());
587 >      return molToProcMap_[globalIndex];
588 >    }
589  
590 <        /**
591 <         * Set MolToProcMap array
592 <         * @see #SimCreator::divideMolecules
593 <         */
594 <        void setMolToProcMap(const std::vector<int>& molToProcMap) {
595 <            molToProcMap_ = molToProcMap;
596 <        }
590 >    /**
591 >     * Set MolToProcMap array
592 >     * @see #SimCreator::divideMolecules
593 >     */
594 >    void setMolToProcMap(const std::vector<int>& molToProcMap) {
595 >      molToProcMap_ = molToProcMap;
596 >    }
597 >
598 >    
599          
600 <    private:
600 >  private:
601  
602 <        void setupFortranParallel();
602 >    void setupFortranParallel();
603          
604 <        /**
605 <         * The size of molToProcMap_ is equal to total number of molecules in the system.
606 <         *  It maps a molecule to the processor on which it resides. it is filled by SimCreator once and only
607 <         * once.
608 <         */        
609 <        std::vector<int> molToProcMap_;
604 >    /**
605 >     * The size of molToProcMap_ is equal to total number of molecules in the system.
606 >     *  It maps a molecule to the processor on which it resides. it is filled by SimCreator once and only
607 >     * once.
608 >     */        
609 >    std::vector<int> molToProcMap_;
610  
611   #endif
612  
613 < };
613 >  };
614  
615   } //namespace oopse
616   #endif //BRAINS_SIMMODEL_HPP

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines