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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines