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

Comparing trunk/src/brains/SimInfo.hpp (property svn:keywords):
Revision 413 by tim, Wed Mar 9 17:30:29 2005 UTC vs.
Revision 1983 by gezelter, Tue Apr 15 20:36:19 2014 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines