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

Comparing:
trunk/src/brains/SimInfo.hpp (property svn:keywords), Revision 316 by tim, Fri Feb 11 22:41:02 2005 UTC vs.
branches/development/src/brains/SimInfo.hpp (property svn:keywords), Revision 1838 by gezelter, Tue Jan 22 16:20:11 2013 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines