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 413 by tim, Wed Mar 9 17:30:29 2005 UTC vs.
branches/development/src/brains/SimInfo.hpp (file contents), Revision 1577 by gezelter, Wed Jun 8 20:26:56 2011 UTC

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

Comparing:
trunk/src/brains/SimInfo.hpp (property svn:keywords), Revision 413 by tim, Wed Mar 9 17:30:29 2005 UTC vs.
branches/development/src/brains/SimInfo.hpp (property svn:keywords), Revision 1577 by gezelter, Wed Jun 8 20:26:56 2011 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines