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 2 by gezelter, Fri Sep 24 04:16:43 2004 UTC vs.
branches/development/src/brains/SimInfo.hpp (file contents), Revision 1848 by gezelter, Mon Feb 4 21:13:46 2013 UTC

# Line 1 | Line 1
1 < #ifndef __SIMINFO_H__
2 < #define __SIMINFO_H__
1 > /*
2 > * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved.
3 > *
4 > * The University of Notre Dame grants you ("Licensee") a
5 > * non-exclusive, royalty free, license to use, modify and
6 > * redistribute this software in source and binary code form, provided
7 > * that the following conditions are met:
8 > *
9 > * 1. Redistributions of source code must retain the above copyright
10 > *    notice, this list of conditions and the following disclaimer.
11 > *
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.
16 > *
17 > * This software is provided "AS IS," without a warranty of any
18 > * kind. All express or implied conditions, representations and
19 > * warranties, including any implied warranty of merchantability,
20 > * fitness for a particular purpose or non-infringement, are hereby
21 > * excluded.  The University of Notre Dame and its licensors shall not
22 > * be liable for any damages suffered by licensee as a result of
23 > * using, modifying or distributing the software or its
24 > * derivatives. In no event will the University of Notre Dame or its
25 > * licensors be liable for any lost revenue, profit or data, or for
26 > * direct, indirect, special, consequential, incidental or punitive
27 > * damages, however caused and regardless of the theory of liability,
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 > /**
44 > * @file SimInfo.hpp
45 > * @author    tlin
46 > * @date  11/02/2004
47 > * @version 1.0
48 > */
49  
50 < #include <map>
51 < #include <string>
50 > #ifndef BRAINS_SIMMODEL_HPP
51 > #define BRAINS_SIMMODEL_HPP
52 >
53 > #include <iostream>
54 > #include <set>
55 > #include <utility>
56   #include <vector>
57  
58 < #include "Atom.hpp"
59 < #include "RigidBody.hpp"
60 < #include "Molecule.hpp"
61 < #include "Exclude.hpp"
62 < #include "SkipList.hpp"
63 < #include "AbstractClasses.hpp"
64 < #include "MakeStamps.hpp"
65 < #include "SimState.hpp"
66 < #include "Restraints.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 "brains/ForceField.hpp"
64 > #include "utils/PropertyMap.hpp"
65 > #include "utils/LocalIndexManager.hpp"
66 > #include "nonbonded/SwitchingFunction.hpp"
67  
68 < #define __C
69 < #include "fSimulation.h"
70 < #include "fortranWrapDefines.hpp"
71 < #include "GenericData.hpp"
68 > using namespace std;
69 > namespace OpenMD{
70 >  //forward declaration
71 >  class SnapshotManager;
72 >  class Molecule;
73 >  class SelectionManager;
74 >  class StuntDouble;
75  
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 < //#include "Minimizer.hpp"
102 < //#include "OOPSEMinimizer.hpp"
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 +     * 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 < double roundMe( double x );
120 < class OOPSEMinimizer;
121 < class SimInfo{
119 >    /** Returns the total number of molecules in the system. */
120 >    int getNGlobalMolecules() {
121 >      return nGlobalMols_;
122 >    }
123  
124 < public:
124 >    /** Returns the total number of atoms in the system. */
125 >    int getNGlobalAtoms() {
126 >      return nGlobalAtoms_;
127 >    }
128  
129 <  SimInfo();
130 <  ~SimInfo();
129 >    /** Returns the total number of cutoff groups in the system. */
130 >    int getNGlobalCutoffGroups() {
131 >      return nGlobalCutoffGroups_;
132 >    }
133  
134 <  int n_atoms; // the number of atoms
135 <  Atom **atoms; // the array of atom objects
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 <  vector<RigidBody*> rigidBodies;  // A vector of rigid bodies
144 <  vector<StuntDouble*> integrableObjects;
145 <  
146 <  double tau[9]; // the stress tensor
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 <  int n_bonds;    // number of bends
153 <  int n_bends;    // number of bends
154 <  int n_torsions; // number of torsions
155 <  int n_oriented; // number of of atoms with orientation
156 <  int ndf;        // number of actual degrees of freedom
157 <  int ndfRaw;     // number of settable degrees of freedom
158 <  int ndfTrans;   // number of translational degrees of freedom
159 <  int nZconstraints; // the number of zConstraints
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 <  int setTemp;   // boolean to set the temperature at each sampleTime
162 <  int resetIntegrator; // boolean to reset the integrator
161 >    /** Returns the number of local atoms */
162 >    unsigned int getNAtoms() {
163 >      return nAtoms_;
164 >    }
165  
166 <  int n_dipoles; // number of dipoles
166 >    /** Returns the number of effective cutoff groups on local processor */
167 >    unsigned int getNLocalCutoffGroups();
168  
169 <  int n_exclude;
170 <  Exclude* excludes;  // the exclude list for ignoring pairs in fortran
171 <  int nGlobalExcludes;
172 <  int* globalExcludes; // same as above, but these guys participate in
63 <                       // no long range forces.
169 >    /** Returns the number of local bonds */        
170 >    unsigned int getNBonds(){
171 >      return nBonds_;
172 >    }
173  
174 <  int* identArray;     // array of unique identifiers for the atoms
175 <  int* molMembershipArray;  // map of atom numbers onto molecule numbers
174 >    /** Returns the number of local bends */        
175 >    unsigned int getNBends() {
176 >      return nBends_;
177 >    }
178  
179 <  int n_constraints; // the number of constraints on the system
179 >    /** Returns the number of local torsions */        
180 >    unsigned int getNTorsions() {
181 >      return nTorsions_;
182 >    }
183  
184 <  int n_SRI;   // the number of short range interactions
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 <  double lrPot; // the potential energy from the long range calculations.
193 >    /** Returns the number of local integrable objects */
194 >    unsigned int getNIntegrableObjects() {
195 >      return nIntegrableObjects_;
196 >    }
197  
198 <  double Hmat[3][3];  // the periodic boundry conditions. The Hmat is the
199 <                      // column vectors of the x, y, and z box vectors.
200 <                      //   h1  h2  h3
201 <                      // [ Xx  Yx  Zx ]
78 <                      // [ Xy  Yy  Zy ]
79 <                      // [ Xz  Yz  Zz ]
80 <                      //  
81 <  double HmatInv[3][3];
198 >    /** Returns the number of local cutoff groups */
199 >    unsigned int getNCutoffGroups() {
200 >      return nCutoffGroups_;
201 >    }
202  
203 <  double boxL[3]; // The Lengths of the 3 column vectors of Hmat
204 <  double boxVol;
205 <  int orthoRhombic;
206 <  
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);
214  
215 <  double dielectric;      // the dielectric of the medium for reaction field
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 <  
223 <  int usePBC; // whether we use periodic boundry conditions.
224 <  int useLJ;
225 <  int useSticky;
94 <  int useCharges;
95 <  int useDipoles;
96 <  int useReactionField;
97 <  int useGB;
98 <  int useEAM;
99 <  bool haveCutoffGroups;
100 <  bool useInitXSstate;
101 <  double orthoTolerance;
222 >    /** Returns the total number of fluctuating charges that are present */
223 >    int getNFluctuatingCharges() {
224 >      return nGlobalFluctuatingCharges_;
225 >    }
226  
227 <  double dt, run_time;           // the time step and total time
228 <  double sampleTime, statusTime; // the position and energy dump frequencies
229 <  double target_temp;            // the target temperature of the system
230 <  double thermalTime;            // the temp kick interval
107 <  double currentTime;            // Used primarily for correlation Functions
108 <  double resetTime;              // Use to reset the integrator periodically
109 <  short int have_target_temp;
227 >    /** Returns the number of degrees of freedom */
228 >    int getNdf() {
229 >      return ndf_ - getFdf();
230 >    }
231  
232 <  int n_mol;           // n_molecules;
233 <  Molecule* molecules; // the array of molecules
234 <  
235 <  int nComponents;           // the number of components in the system
115 <  int* componentsNmol;       // the number of molecules of each component
116 <  MoleculeStamp** compStamps;// the stamps matching the components
117 <  LinkedMolStamp* headStamp; // list of stamps used in the simulation
118 <  
119 <  
120 <  char ensemble[100]; // the enesemble of the simulation (NVT, NVE, etc. )
121 <  char mixingRule[100]; // the mixing rules for Lennard jones/van der walls
122 <  BaseIntegrator *the_integrator; // the integrator of the simulation
232 >    /** Returns the number of degrees of freedom (LOCAL) */
233 >    int getNdfLocal() {
234 >      return ndfLocal_;
235 >    }
236  
237 <  OOPSEMinimizer* the_minimizer; // the energy minimizer
238 <  Restraints* restraint;
239 <  bool has_minimizer;
237 >    /** Returns the number of raw degrees of freedom */
238 >    int getNdfRaw() {
239 >      return ndfRaw_;
240 >    }
241  
242 <  string finalName;  // the name of the eor file to be written
243 <  string sampleName; // the name of the dump file to be written
244 <  string statusName; // the name of the stat file to be written
242 >    /** Returns the number of translational degrees of freedom */
243 >    int getNdfTrans() {
244 >      return ndfTrans_;
245 >    }
246  
247 <  int seed;                    //seed for random number generator
247 >    /** sets the current number of frozen degrees of freedom */
248 >    void setFdf(int fdf) {
249 >      fdf_local = fdf;
250 >    }
251  
252 <  int useSolidThermInt;  // is solid-state thermodynamic integration being used
253 <  int useLiquidThermInt; // is liquid thermodynamic integration being used
254 <  double thermIntLambda; // lambda for TI
255 <  double thermIntK;      // power of lambda for TI
256 <  double vRaw;           // unperturbed potential for TI
257 <  double vHarm;          // harmonic potential for TI
258 <  int i;                 // just an int
252 >    int getFdf();
253 >    
254 >    //getNZconstraint and setNZconstraint ruin the coherence of
255 >    //SimInfo class, need refactoring
256 >        
257 >    /** Returns the total number of z-constraint molecules in the system */
258 >    int getNZconstraint() {
259 >      return nZconstraint_;
260 >    }
261  
262 <  vector<double> mfact;
263 <  vector<int> FglobalGroupMembership;
264 <  int ngroup;
265 <  int* globalGroupMembership;
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 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 <  // refreshes the sim if things get changed (load balanceing, volume
291 <  // adjustment, etc.)
290 >    Globals* getSimParams() {
291 >      return simParams_;
292 >    }
293  
294 <  void refreshSim( void );
295 <  
294 >    void update();
295 >    /**
296 >     * Do final bookkeeping before Force managers need their data.
297 >     */
298 >    void prepareTopology();
299  
153  // sets the internal function pointer to fortran.
300  
301 <  void setInternal( setFortranSim_TD fSetup,
302 <                    setFortranBox_TD fBox,
303 <                    notifyFortranCutOff_TD fCut){
304 <    setFsimulation = fSetup;
159 <    setFortranBoxSize = fBox;
160 <    notifyFortranCutOffs = fCut;
161 <  }
301 >    /** Returns the local index manager */
302 >    LocalIndexManager* getLocalIndexManager() {
303 >      return &localIndexMan_;
304 >    }
305  
306 <  int getNDF();
307 <  int getNDFraw();
308 <  int getNDFtranslational();
309 <  int getTotIntegrableObjects();
167 <  void setBox( double newBox[3] );
168 <  void setBoxM( double newBox[3][3] );
169 <  void getBoxM( double theBox[3][3] );
170 <  void scaleBox( double scale );
171 <  
172 <  void setDefaultRcut( double theRcut );
173 <  void setDefaultRcut( double theRcut, double theRsw );
174 <  void checkCutOffs( void );
306 >    int getMoleculeStampId(int globalIndex) {
307 >      //assert(globalIndex < molStampIds_.size())
308 >      return molStampIds_[globalIndex];
309 >    }
310  
311 <  double getRcut( void )  { return rCut; }
312 <  double getRlist( void ) { return rList; }
313 <  double getRsw( void )   { return rSw; }
314 <  double getMaxCutoff( void ) { return maxCutoff; }
180 <  
181 <  void setTime( double theTime ) { currentTime = theTime; }
182 <  void incrTime( double the_dt ) { currentTime += the_dt; }
183 <  void decrTime( double the_dt ) { currentTime -= the_dt; }
184 <  double getTime( void ) { return currentTime; }
185 <
186 <  void wrapVector( double thePos[3] );
311 >    /** Returns the molecule stamp */
312 >    MoleculeStamp* getMoleculeStamp(int id) {
313 >      return moleculeStamps_[id];
314 >    }
315  
316 <  SimState* getConfiguration( void ) { return myConfiguration; }
317 <  
318 <  void addProperty(GenericData* prop);
319 <  GenericData* getProperty(const string& propName);
320 <  //vector<GenericData*>& getProperties()  {return properties;}    
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 getSeed(void) {  return seed; }
330 <  void setSeed(int theSeed) {  seed = theSeed;}
329 >      return i != molecules_.end() ? i->second : NULL;
330 >    }
331  
332 < private:
332 >    int getGlobalMolMembership(int id){
333 >      return globalMolMembership_[id];
334 >    }
335  
336 <  SimState* myConfiguration;
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 <  int boxIsInit, haveRcut, haveRsw;
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 <  double rList, rCut; // variables for the neighborlist
351 <  double rSw;         // the switching radius
350 >        
351 >    string getFinalConfigFileName() {
352 >      return finalConfigFileName_;
353 >    }
354  
355 <  double maxCutoff;
355 >    void setFinalConfigFileName(const string& fileName) {
356 >      finalConfigFileName_ = fileName;
357 >    }
358  
359 <  double distXY;
360 <  double distYZ;
361 <  double distZX;
362 <  
363 <  void calcHmatInv( void );
364 <  void calcBoxL();
365 <  double calcMaxCutOff();
359 >    string getRawMetaData() {
360 >      return rawMetaData_;
361 >    }
362 >    void setRawMetaData(const string& rawMetaData) {
363 >      rawMetaData_ = rawMetaData;
364 >    }
365 >        
366 >    string getDumpFileName() {
367 >      return dumpFileName_;
368 >    }
369 >        
370 >    void setDumpFileName(const string& fileName) {
371 >      dumpFileName_ = fileName;
372 >    }
373  
374 <  // private function to initialize the fortran side of the simulation
375 <  setFortranSim_TD setFsimulation;
374 >    string getStatFileName() {
375 >      return statFileName_;
376 >    }
377 >        
378 >    void setStatFileName(const string& fileName) {
379 >      statFileName_ = fileName;
380 >    }
381 >        
382 >    string getRestFileName() {
383 >      return restFileName_;
384 >    }
385 >        
386 >    void setRestFileName(const string& fileName) {
387 >      restFileName_ = fileName;
388 >    }
389  
390 <  setFortranBox_TD setFortranBoxSize;
391 <  
392 <  notifyFortranCutOff_TD notifyFortranCutOffs;
393 <  
394 <  //Addtional Properties of SimInfo
395 <  map<string, GenericData*> properties;
396 <  void getFortranGroupArrays(SimInfo* info,
226 <                             vector<int>& FglobalGroupMembership,
227 <                             vector<double>& mfact);
390 >    /**
391 >     * Sets GlobalGroupMembership
392 >     */  
393 >    void setGlobalGroupMembership(const vector<int>& ggm) {
394 >      assert(ggm.size() == static_cast<size_t>(nGlobalAtoms_));
395 >      globalGroupMembership_ = ggm;
396 >    }
397  
398 +    /**
399 +     * Sets GlobalMolMembership
400 +     */        
401 +    void setGlobalMolMembership(const vector<int>& gmm) {
402 +      assert(gmm.size() == (static_cast<size_t>(nGlobalAtoms_ +
403 +                                                nGlobalRigidBodies_)));
404 +      globalMolMembership_ = gmm;
405 +    }
406  
230 };
407  
408 +    bool isTopologyDone() {
409 +      return topologyDone_;
410 +    }
411 +        
412 +    bool getCalcBoxDipole() {
413 +      return calcBoxDipole_;
414 +    }
415  
416 < #endif
416 >    bool getUseAtomicVirial() {
417 >      return useAtomicVirial_;
418 >    }
419 >
420 >    /**
421 >     * Adds property into property map
422 >     * @param genData GenericData to be added into PropertyMap
423 >     */
424 >    void addProperty(GenericData* genData);
425 >
426 >    /**
427 >     * Removes property from PropertyMap by name
428 >     * @param propName the name of property to be removed
429 >     */
430 >    void removeProperty(const string& propName);
431 >
432 >    /**
433 >     * clear all of the properties
434 >     */
435 >    void clearProperties();
436 >
437 >    /**
438 >     * Returns all names of properties
439 >     * @return all names of properties
440 >     */
441 >    vector<string> getPropertyNames();
442 >
443 >    /**
444 >     * Returns all of the properties in PropertyMap
445 >     * @return all of the properties in PropertyMap
446 >     */      
447 >    vector<GenericData*> getProperties();
448 >
449 >    /**
450 >     * Returns property
451 >     * @param propName name of property
452 >     * @return a pointer point to property with propName. If no property named propName
453 >     * exists, return NULL
454 >     */      
455 >    GenericData* getPropertyByName(const string& propName);
456 >
457 >    /**
458 >     * add all special interaction pairs (including excluded
459 >     * interactions) in a molecule into the appropriate lists.
460 >     */
461 >    void addInteractionPairs(Molecule* mol);
462 >
463 >    /**
464 >     * remove all special interaction pairs which belong to a molecule
465 >     * from the appropriate lists.
466 >     */
467 >    void removeInteractionPairs(Molecule* mol);
468 >
469 >    /** Returns the set of atom types present in this simulation */
470 >    set<AtomType*> getSimulatedAtomTypes();
471 >        
472 >    friend ostream& operator <<(ostream& o, SimInfo& info);
473 >
474 >    void getCutoff(RealType& rcut, RealType& rsw);
475 >        
476 >  private:
477 >
478 >    /** fill up the simtype struct and other simulation-related variables */
479 >    void setupSimVariables();
480 >
481 >
482 >    /** Determine if we need to accumulate the simulation box dipole */
483 >    void setupAccumulateBoxDipole();
484 >
485 >    /** Calculates the number of degress of freedom in the whole system */
486 >    void calcNdf();
487 >    void calcNdfRaw();
488 >    void calcNdfTrans();
489 >
490 >    /**
491 >     * Adds molecule stamp and the total number of the molecule with
492 >     * same molecule stamp in the whole system.
493 >     */
494 >    void addMoleculeStamp(MoleculeStamp* molStamp, int nmol);
495 >
496 >    // Other classes holdingn important information
497 >    ForceField* forceField_; /**< provides access to defined atom types, bond types, etc. */
498 >    Globals* simParams_;     /**< provides access to simulation parameters set by user */
499 >
500 >    ///  Counts of local objects
501 >    int nAtoms_;              /**< number of atoms in local processor */
502 >    int nBonds_;              /**< number of bonds in local processor */
503 >    int nBends_;              /**< number of bends in local processor */
504 >    int nTorsions_;           /**< number of torsions in local processor */
505 >    int nInversions_;         /**< number of inversions in local processor */
506 >    int nRigidBodies_;        /**< number of rigid bodies in local processor */
507 >    int nIntegrableObjects_;  /**< number of integrable objects in local processor */
508 >    int nCutoffGroups_;       /**< number of cutoff groups in local processor */
509 >    int nConstraints_;        /**< number of constraints in local processors */
510 >    int nFluctuatingCharges_; /**< number of fluctuating charges in local processor */
511 >        
512 >    /// Counts of global objects
513 >    int nGlobalMols_;              /**< number of molecules in the system (GLOBAL) */
514 >    int nGlobalAtoms_;             /**< number of atoms in the system (GLOBAL) */
515 >    int nGlobalCutoffGroups_;      /**< number of cutoff groups in this system (GLOBAL) */
516 >    int nGlobalIntegrableObjects_; /**< number of integrable objects in this system */
517 >    int nGlobalRigidBodies_;       /**< number of rigid bodies in this system (GLOBAL) */
518 >    int nGlobalFluctuatingCharges_;/**< number of fluctuating charges in this system (GLOBAL) */
519 >    
520 >      
521 >    /// Degress of freedom
522 >    int ndf_;          /**< number of degress of freedom (excludes constraints) (LOCAL) */
523 >    int ndfLocal_;     /**< number of degrees of freedom (LOCAL, excludes constraints) */
524 >    int fdf_local;     /**< number of frozen degrees of freedom (LOCAL) */
525 >    int fdf_;          /**< number of frozen degrees of freedom (GLOBAL) */
526 >    int ndfRaw_;       /**< number of degress of freedom (includes constraints),  (LOCAL) */
527 >    int ndfTrans_;     /**< number of translation degress of freedom, (LOCAL) */
528 >    int nZconstraint_; /**< number of  z-constraint molecules (GLOBAL) */
529 >
530 >    /// logicals
531 >    bool usesPeriodicBoundaries_; /**< use periodic boundary conditions? */
532 >    bool usesDirectionalAtoms_;   /**< are there atoms with position AND orientation? */
533 >    bool usesMetallicAtoms_;      /**< are there transition metal atoms? */
534 >    bool usesElectrostaticAtoms_; /**< are there electrostatic atoms? */
535 >    bool usesFluctuatingCharges_; /**< are there fluctuating charges? */
536 >    bool usesAtomicVirial_;       /**< are we computing atomic virials? */
537 >    bool requiresPrepair_;        /**< does this simulation require a pre-pair loop? */
538 >    bool requiresSkipCorrection_; /**< does this simulation require a skip-correction? */
539 >    bool requiresSelfCorrection_; /**< does this simulation require a self-correction? */
540 >
541 >  public:
542 >    bool usesElectrostaticAtoms() { return usesElectrostaticAtoms_; }
543 >    bool usesDirectionalAtoms() { return usesDirectionalAtoms_; }
544 >    bool usesFluctuatingCharges() { return usesFluctuatingCharges_; }
545 >    bool usesAtomicVirial() { return usesAtomicVirial_; }
546 >    bool requiresPrepair() { return requiresPrepair_; }
547 >    bool requiresSkipCorrection() { return requiresSkipCorrection_;}
548 >    bool requiresSelfCorrection() { return requiresSelfCorrection_;}
549 >
550 >  private:
551 >    /// Data structures holding primary simulation objects
552 >    map<int, Molecule*>  molecules_;  /**< map holding pointers to LOCAL molecules */
553 >
554 >    /// Stamps are templates for objects that are then used to create
555 >    /// groups of objects.  For example, a molecule stamp contains
556 >    /// information on how to build that molecule (i.e. the topology,
557 >    /// the atoms, the bonds, etc.)  Once the system is built, the
558 >    /// stamps are no longer useful.
559 >    vector<int> molStampIds_;                /**< stamp id for molecules in the system */
560 >    vector<MoleculeStamp*> moleculeStamps_;  /**< molecule stamps array */        
561 >
562 >    /**
563 >     * A vector that maps between the global index of an atom, and the
564 >     * global index of cutoff group the atom belong to.  It is filled
565 >     * by SimCreator once and only once, since it never changed during
566 >     * the simulation.  It should be nGlobalAtoms_ in size.
567 >     */
568 >    vector<int> globalGroupMembership_;
569 >  public:
570 >    vector<int> getGlobalGroupMembership() { return globalGroupMembership_; }
571 >  private:
572 >
573 >    /**
574 >     * A vector that maps between the global index of an atom and the
575 >     * global index of the molecule the atom belongs to.  It is filled
576 >     * by SimCreator once and only once, since it is never changed
577 >     * during the simulation. It shoudl be nGlobalAtoms_ in size.
578 >     */
579 >    vector<int> globalMolMembership_;
580 >
581 >    /**
582 >     * A vector that maps between the local index of an atom and the
583 >     * index of the AtomType.
584 >     */
585 >    vector<int> identArray_;
586 >  public:
587 >    vector<int> getIdentArray() { return identArray_; }
588 >  private:
589 >    
590 >    /**
591 >     * A vector which contains the fractional contribution of an
592 >     * atom's mass to the total mass of the cutoffGroup that atom
593 >     * belongs to.  In the case of single atom cutoff groups, the mass
594 >     * factor for that atom is 1.  For massless atoms, the factor is
595 >     * also 1.
596 >     */
597 >    vector<RealType> massFactors_;
598 >  public:
599 >    vector<RealType> getMassFactors() { return massFactors_; }
600 >
601 >    PairList* getExcludedInteractions() { return &excludedInteractions_; }
602 >    PairList* getOneTwoInteractions() { return &oneTwoInteractions_; }
603 >    PairList* getOneThreeInteractions() { return &oneThreeInteractions_; }
604 >    PairList* getOneFourInteractions() { return &oneFourInteractions_; }
605 >
606 >  private:
607 >              
608 >    /// lists to handle atoms needing special treatment in the non-bonded interactions
609 >    PairList excludedInteractions_;  /**< atoms excluded from interacting with each other */
610 >    PairList oneTwoInteractions_;    /**< atoms that are directly Bonded */
611 >    PairList oneThreeInteractions_;  /**< atoms sharing a Bend */    
612 >    PairList oneFourInteractions_;   /**< atoms sharing a Torsion */
613 >
614 >    PropertyMap properties_;       /**< Generic Properties can be added */
615 >    SnapshotManager* sman_;        /**< SnapshotManager (handles particle positions, etc.) */
616 >    int storageLayout_;            /**< Bits to tell how much data to store on each object */
617 >
618 >    /**
619 >     * The reason to have a local index manager is that when molecule
620 >     * is migrating to other processors, the atoms and the
621 >     * rigid-bodies will release their local indices to
622 >     * LocalIndexManager. Combining the information of molecule
623 >     * migrating to current processor, Migrator class can query the
624 >     * LocalIndexManager to make a efficient data moving plan.
625 >     */        
626 >    LocalIndexManager localIndexMan_;
627 >
628 >    // unparsed MetaData block for storing in Dump and EOR files:
629 >    string rawMetaData_;
630 >
631 >    // file names
632 >    string finalConfigFileName_;
633 >    string dumpFileName_;
634 >    string statFileName_;
635 >    string restFileName_;
636 >
637 >    bool topologyDone_;  /** flag to indicate whether the topology has
638 >                             been scanned and all the relevant
639 >                             bookkeeping has been done*/
640 >    
641 >    bool calcBoxDipole_; /**< flag to indicate whether or not we calculate
642 >                            the simulation box dipole moment */
643 >    
644 >    bool useAtomicVirial_; /**< flag to indicate whether or not we use
645 >                              Atomic Virials to calculate the pressure */
646 >    
647 >  public:
648 >    /**
649 >     * return an integral objects by its global index. In MPI
650 >     * version, if the StuntDouble with specified global index does
651 >      * not belong to local processor, a NULL will be return.
652 >      */
653 >    StuntDouble* getIOIndexToIntegrableObject(int index);
654 >    void setIOIndexToIntegrableObject(const vector<StuntDouble*>& v);
655 >    
656 >  private:
657 >    vector<StuntDouble*> IOIndexToIntegrableObject;
658 >    
659 >  public:
660 >                
661 >    /**
662 >     * Finds the processor where a molecule resides
663 >     * @return the id of the processor which contains the molecule
664 >     * @param globalIndex global Index of the molecule
665 >     */
666 >    int getMolToProc(int globalIndex) {
667 >      //assert(globalIndex < molToProcMap_.size());
668 >      return molToProcMap_[globalIndex];
669 >    }
670 >    
671 >    /**
672 >     * Set MolToProcMap array
673 >     */
674 >    void setMolToProcMap(const vector<int>& molToProcMap) {
675 >      molToProcMap_ = molToProcMap;
676 >    }
677 >        
678 >  private:
679 >        
680 >    /**
681 >     * The size of molToProcMap_ is equal to total number of molecules
682 >     * in the system.  It maps a molecule to the processor on which it
683 >     * resides. it is filled by SimCreator once and only once.
684 >     */        
685 >    vector<int> molToProcMap_;
686 >
687 >  };
688 >
689 > } //namespace OpenMD
690 > #endif //BRAINS_SIMMODEL_HPP
691 >

Comparing:
trunk/src/brains/SimInfo.hpp (property svn:keywords), Revision 2 by gezelter, Fri Sep 24 04:16:43 2004 UTC vs.
branches/development/src/brains/SimInfo.hpp (property svn:keywords), Revision 1848 by gezelter, Mon Feb 4 21:13:46 2013 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines