ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-3.0/src/brains/SimInfo.hpp
(Generate patch)

Comparing:
trunk/OOPSE-3.0/src/brains/SimInfo.hpp (file contents), Revision 1490 by gezelter, Fri Sep 24 04:16:43 2004 UTC vs.
branches/new_design/OOPSE-3.0/src/brains/SimInfo.hpp (file contents), Revision 1739 by tim, Mon Nov 15 18:02:15 2004 UTC

# Line 1 | Line 1
1 < #ifndef __SIMINFO_H__
2 < #define __SIMINFO_H__
1 > /*
2 > * Copyright (C) 2000-2004  Object Oriented Parallel Simulation Engine (OOPSE) project
3 > *
4 > * Contact: oopse@oopse.org
5 > *
6 > * This program is free software; you can redistribute it and/or
7 > * modify it under the terms of the GNU Lesser General Public License
8 > * as published by the Free Software Foundation; either version 2.1
9 > * of the License, or (at your option) any later version.
10 > * All we ask is that proper credit is given for our work, which includes
11 > * - but is not limited to - adding the above copyright notice to the beginning
12 > * of your source code files, and to any copyright notice that you may distribute
13 > * with programs based on this work.
14 > *
15 > * This program is distributed in the hope that it will be useful,
16 > * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 > * GNU Lesser General Public License for more details.
19 > *
20 > * You should have received a copy of the GNU Lesser General Public License
21 > * along with this program; if not, write to the Free Software
22 > * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23 > *
24 > */
25  
26 < #include <map>
27 < #include <string>
28 < #include <vector>
26 > /**
27 > * @file SimInfo.hpp
28 > * @author    tlin
29 > * @date  11/02/2004
30 > * @version 1.0
31 > */
32  
33 < #include "Atom.hpp"
34 < #include "RigidBody.hpp"
10 < #include "Molecule.hpp"
11 < #include "Exclude.hpp"
12 < #include "SkipList.hpp"
13 < #include "AbstractClasses.hpp"
14 < #include "MakeStamps.hpp"
15 < #include "SimState.hpp"
16 < #include "Restraints.hpp"
33 > #ifndef BRAINS_SIMMODEL_HPP
34 > #define BRAINS_SIMMODEL_HPP
35  
36 < #define __C
37 < #include "fSimulation.h"
38 < #include "fortranWrapDefines.hpp"
21 < #include "GenericData.hpp"
36 > #include <iostream>
37 > #include <vector>
38 > #include <utility>
39  
40 + #include "brains/fSimulation.h"
41 + #include "brains/SimInfo.hpp"
42 + #include "primitives/Molecule.hpp"
43 + #include "types/MoleculeStamp.hpp"
44 + #include "utils/PropertyMap.hpp"
45 + #include "io/Globals.hpp"
46  
47 < //#include "Minimizer.hpp"
25 < //#include "OOPSEMinimizer.hpp"
47 > namespace oopse{
48  
49 + /**
50 + * @class SimInfo SimInfo.hpp "brains/SimInfo.hpp"
51 + * @brief As one of the heavy weight class of OOPSE, SimInfo
52 + * One of the major changes in SimInfo class is the data struct. It only maintains a list of molecules.
53 + * And the Molecule class will maintain all of the concrete objects (atoms, bond, bend, torsions, rigid bodies,
54 + * cutoff groups, constrains).
55 + * Another major change is the index. No matter single version or parallel version,  atoms and
56 + * rigid bodies have both global index and local index. Local index is not important to molecule as well as
57 + * cutoff group.
58 + */
59 + class SimInfo {
60 +    public:
61 +        typedef std::map<int, Molecule*>::iterator  MoleculeIterator;
62  
63 < double roundMe( double x );
64 < class OOPSEMinimizer;
65 < class SimInfo{
63 >        /**
64 >         * Constructor of SimInfo
65 >         * @param molStampPairs MoleculeStamp Array. The first element of the pair is molecule stamp, the
66 >         * second element is the total number of molecules with the same molecule stamp in the system
67 >         * @param ff pointer of a concrete ForceField instance
68 >         * @param globals
69 >         * @note
70 >         */
71 >        SimInfo(const std::vector<std::pair<MoleculeStamp*, int> >& molStampPairs, ForceField* ff, Globals* globals);
72 >        virtual ~SimInfo();
73  
74 < public:
74 >        /**
75 >         * Adds a molecule
76 >         * @return return true if adding successfully, return false if the molecule is already in SimInfo
77 >         * @param mol molecule to be added
78 >         */
79 >        bool addMolecule(Molecule* mol);
80  
81 <  SimInfo();
82 <  ~SimInfo();
81 >        /**
82 >         * Removes a molecule from SimInfo
83 >         * @return true if removing successfully, return false if molecule is not in this SimInfo
84 >         */
85 >        bool removeMolecule(Molecule* mol);
86  
87 <  int n_atoms; // the number of atoms
88 <  Atom **atoms; // the array of atom objects
87 >        /** Returns the total number of molecules in the system. */
88 >        int getNGlobalMolecules() {
89 >            return nGlobalMols_;
90 >        }
91  
92 <  vector<RigidBody*> rigidBodies;  // A vector of rigid bodies
93 <  vector<StuntDouble*> integrableObjects;
94 <  
95 <  double tau[9]; // the stress tensor
92 >        /** Returns the total number of atoms in the system. */
93 >        int getNGlobalAtoms() {
94 >            return nGlobalAtoms_;
95 >        }
96  
97 <  int n_bonds;    // number of bends
98 <  int n_bends;    // number of bends
99 <  int n_torsions; // number of torsions
100 <  int n_oriented; // number of of atoms with orientation
49 <  int ndf;        // number of actual degrees of freedom
50 <  int ndfRaw;     // number of settable degrees of freedom
51 <  int ndfTrans;   // number of translational degrees of freedom
52 <  int nZconstraints; // the number of zConstraints
97 >        /** Returns the total number of cutoff groups in the system. */
98 >        int getNGlobalCutoffGroups() {
99 >            return nGlobalCutoffGroups_;
100 >        }
101  
102 <  int setTemp;   // boolean to set the temperature at each sampleTime
103 <  int resetIntegrator; // boolean to reset the integrator
102 >        /**
103 >         * Returns the total number of integrable objects (total number of rigid bodies plus the total number
104 >         * of atoms which do not belong to the rigid bodies) in the system
105 >         */
106 >        int getNGlobalIntegrableObjects() {
107 >            return nGlobalIntegrableObjects_;
108 >        }
109 >        
110 >        /**
111 >         * Returns the number of local molecules.
112 >         * @return the number of local molecules
113 >         */
114 >        int getNMolecules() {
115 >            return molecules_.size();
116 >        }
117  
118 <  int n_dipoles; // number of dipoles
118 >        /** Returns the number of local atoms */
119 >        unsigned int getNAtoms() {
120 >            return nAtoms_;
121 >        }
122  
123 <  int n_exclude;
124 <  Exclude* excludes;  // the exclude list for ignoring pairs in fortran
125 <  int nGlobalExcludes;
126 <  int* globalExcludes; // same as above, but these guys participate in
63 <                       // no long range forces.
123 >        /** Returns the number of local bonds */        
124 >        unsigned int getNBonds(){
125 >            return nBonds_;
126 >        }
127  
128 <  int* identArray;     // array of unique identifiers for the atoms
129 <  int* molMembershipArray;  // map of atom numbers onto molecule numbers
128 >        /** Returns the number of local bends */        
129 >        unsigned int getNBends() {
130 >            return nBends_;
131 >        }
132  
133 <  int n_constraints; // the number of constraints on the system
133 >        /** Returns the number of local torsions */        
134 >        unsigned int getNTorsions() {
135 >            return nTorsions_;
136 >        }
137  
138 <  int n_SRI;   // the number of short range interactions
138 >        /** Returns the number of local rigid bodies */        
139 >        unsigned int getNRigidBodies() {
140 >            return nRigidBodies_;
141 >        }
142  
143 <  double lrPot; // the potential energy from the long range calculations.
143 >        /** Returns the number of local integrable objects */
144 >        unsigned int getNIntegrableObjects() {
145 >            return nIntegrableObjects_;
146 >        }
147  
148 <  double Hmat[3][3];  // the periodic boundry conditions. The Hmat is the
149 <                      // column vectors of the x, y, and z box vectors.
150 <                      //   h1  h2  h3
151 <                      // [ Xx  Yx  Zx ]
78 <                      // [ Xy  Yy  Zy ]
79 <                      // [ Xz  Yz  Zz ]
80 <                      //  
81 <  double HmatInv[3][3];
148 >        /** Returns the number of local cutoff groups */
149 >        unsigned int getNCutoffGroups() {
150 >            return nCutoffGroups_;
151 >        }
152  
153 <  double boxL[3]; // The Lengths of the 3 column vectors of Hmat
154 <  double boxVol;
155 <  int orthoRhombic;
156 <  
153 >        /** Returns the total number of constraints in this SimInfo */
154 >        unsigned int getNConstraints() {
155 >            return nConstraints_;
156 >        }
157 >        
158 >        /**
159 >         * Returns the first molecule in this SimInfo and intialize the iterator.
160 >         * @return the first molecule, return NULL if there is not molecule in this SimInfo
161 >         * @param i the iterator of molecule array (user shouldn't change it)
162 >         */
163 >        Molecule* beginMolecule(MoleculeIterator& i);
164  
165 <  double dielectric;      // the dielectric of the medium for reaction field
165 >        /**
166 >          * Returns the next avaliable Molecule based on the iterator.
167 >          * @return the next avaliable molecule, return NULL if reaching the end of the array
168 >          * @param i the iterator of molecule array
169 >          */
170 >        Molecule* nextMolecule(MoleculeIterator& i);
171  
172 <  
173 <  int usePBC; // whether we use periodic boundry conditions.
174 <  int useLJ;
175 <  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;
172 >        /** Returns the number of degrees of freedom */
173 >        int getNdf() {
174 >            return ndf_;
175 >        }
176  
177 <  double dt, run_time;           // the time step and total time
178 <  double sampleTime, statusTime; // the position and energy dump frequencies
179 <  double target_temp;            // the target temperature of the system
180 <  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;
177 >        /** Returns the number of raw degrees of freedom */
178 >        int getNdfRaw() {
179 >            return ndfRaw_;
180 >        }
181  
182 <  int n_mol;           // n_molecules;
183 <  Molecule* molecules; // the array of molecules
184 <  
185 <  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
182 >        /** Returns the number of translational degrees of freedom */
183 >        int getNdfTrans() {
184 >            return ndfTrans_;
185 >        }
186  
187 <  OOPSEMinimizer* the_minimizer; // the energy minimizer
188 <  Restraints* restraint;
189 <  bool has_minimizer;
187 >        //getNZconstraint and setNZconstraint ruin the coherent of SimInfo class, need refactorying
188 >        
189 >        /** Returns the total number of z-constraint molecules in the system */
190 >        int getNZconstraint() {
191 >            return nZconstraint_;
192 >        }
193  
194 <  string finalName;  // the name of the eor file to be written
195 <  string sampleName; // the name of the dump file to be written
196 <  string statusName; // the name of the stat file to be written
194 >        /**
195 >         * Sets the number of z-constraint molecules in the system.
196 >         */
197 >        int setNZconstraint(int nZconstraint) {
198 >            nZconstraint_ = nZconstraint;
199 >        }
200 >        
201 >        /** Returns the snapshot manager. */
202 >        SnapshotManager* getSnapshotManager() {
203 >            return sman_;
204 >        }
205  
206 <  int seed;                    //seed for random number generator
206 >        /** Sets the snapshot manager. */
207 >        void setSnapshotManager(SnapshotManager* sman) {
208 >            sman_ = sman;
209 >        }
210  
211 <  int useSolidThermInt;  // is solid-state thermodynamic integration being used
212 <  int useLiquidThermInt; // is liquid thermodynamic integration being used
213 <  double thermIntLambda; // lambda for TI
214 <  double thermIntK;      // power of lambda for TI
138 <  double vRaw;           // unperturbed potential for TI
139 <  double vHarm;          // harmonic potential for TI
140 <  int i;                 // just an int
211 >        /** Returns the force field */
212 >        ForceField* getForceField() {
213 >            return forceField_;
214 >        }
215  
216 <  vector<double> mfact;
217 <  vector<int> FglobalGroupMembership;
218 <  int ngroup;
145 <  int* globalGroupMembership;
216 >        Globals* getGlobals() {
217 >            return globals_;
218 >        }
219  
220 <  // refreshes the sim if things get changed (load balanceing, volume
221 <  // adjustment, etc.)
220 >        /** Returns the velocity of center of mass of the whole system.*/
221 >        Vector3d getComVel();
222  
223 <  void refreshSim( void );
224 <  
223 >        /** Returns the center of the mass of the whole system.*/
224 >        Vector3d getCom();
225  
226 <  // sets the internal function pointer to fortran.
226 >        /** Returns the seed (used for random number generator) */
227 >        int getSeed() {
228 >            return seed_;
229 >        }
230  
231 <  void setInternal( setFortranSim_TD fSetup,
232 <                    setFortranBox_TD fBox,
233 <                    notifyFortranCutOff_TD fCut){
234 <    setFsimulation = fSetup;
159 <    setFortranBoxSize = fBox;
160 <    notifyFortranCutOffs = fCut;
161 <  }
231 >        /** Sets the seed*/
232 >        void setSeed(int seed) {
233 >            seed_ = seed;
234 >        }
235  
236 <  int getNDF();
237 <  int getNDFraw();
165 <  int getNDFtranslational();
166 <  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 );
236 >        /** main driver function to interact with fortran during the initialization and molecule migration */
237 >        void update();
238  
239 <  double getRcut( void )  { return rCut; }
240 <  double getRlist( void ) { return rList; }
241 <  double getRsw( void )   { return rSw; }
242 <  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; }
239 >        /** Returns the local index manager */
240 >        LocalIndexManager* getLocalIndexManager() {
241 >            return &localIndexMan_;
242 >        }
243  
244 <  void wrapVector( double thePos[3] );
244 >        int getMoleculeStampId(int globalIndex) {
245 >            //assert(globalIndex < molStampIds_.size())
246 >            return molStampIds_[globalIndex];
247 >        }
248  
249 <  SimState* getConfiguration( void ) { return myConfiguration; }
250 <  
251 <  void addProperty(GenericData* prop);
252 <  GenericData* getProperty(const string& propName);
253 <  //vector<GenericData*>& getProperties()  {return properties;}    
249 >        /** Returns the molecule stamp */
250 >        MoleculeStamp* getMoleculeStamp(int id) {
251 >            return moleculeStamps_[id];
252 >        }
253 >        
254 >        /**
255 >         * Finds a molecule with a specified global index
256 >         * @return a pointer point to found molecule
257 >         * @param index
258 >         */
259 >        Molecule* getMoleculeByGlobalIndex(int index) {
260 >            std::map<int, Molecule*> i;
261 >            i = molecules_.find(index);
262  
263 <  int getSeed(void) {  return seed; }
264 <  void setSeed(int theSeed) {  seed = theSeed;}
263 >            return i != molecules_.end() ? i->second : NULL;
264 >        }
265  
266 < private:
266 >        /** Calculate the maximum cutoff radius based on the atom types */
267 >        double calcMaxCutoffRadius();
268  
269 <  SimState* myConfiguration;
269 >        double getRcut() {
270 >            return rcut_;
271 >        }
272  
273 <  int boxIsInit, haveRcut, haveRsw;
273 >        double getRsw() {
274 >            return rsw_;
275 >        }
276 >        
277 >        std::string getFinalConfigFileName() {
278 >            return finalConfigFileName_;
279 >        }
280 >        
281 >        void setFinalConfigFileName(const std::string& fileName) {
282 >            finalConfigFileName_ = fileName;
283 >        }
284  
285 <  double rList, rCut; // variables for the neighborlist
286 <  double rSw;         // the switching radius
285 >        std::string getDumpFileName() {
286 >            return dumpFileName_;
287 >        }
288 >        
289 >        void setDumpFileName(const std::string& fileName) {
290 >            dumpFileName_ = fileName;
291 >        }
292  
293 <  double maxCutoff;
293 >        std::string getStatFileName() {
294 >            return statFileName_;
295 >        }
296 >        
297 >        void setStatFileName(const std::string& fileName) {
298 >            statFileName_ = fileName;
299 >        }
300  
301 <  double distXY;
302 <  double distYZ;
303 <  double distZX;
304 <  
305 <  void calcHmatInv( void );
306 <  void calcBoxL();
307 <  double calcMaxCutOff();
301 >        /**
302 >         * Returns the pointer of internal globalGroupMembership_ array. This array will be filled by SimCreator class
303 >         * @see #SimCreator::setGlobalIndex
304 >         */  
305 >        int* getGlobalGroupMembershipPointer() {
306 >            return globalGroupMembership_[0];
307 >        }
308  
309 <  // private function to initialize the fortran side of the simulation
310 <  setFortranSim_TD setFsimulation;
309 >        /**
310 >         * Returns the pointer of internal globalMolMembership_ array. This array will be filled by SimCreator class
311 >         * @see #SimCreator::setGlobalIndex
312 >         */        
313 >        int* getGlobalMolMembershipPointer() {
314 >            return globalMolMembership_[0];
315 >        }
316  
219  setFortranBox_TD setFortranBoxSize;
220  
221  notifyFortranCutOff_TD notifyFortranCutOffs;
222  
223  //Addtional Properties of SimInfo
224  map<string, GenericData*> properties;
225  void getFortranGroupArrays(SimInfo* info,
226                             vector<int>& FglobalGroupMembership,
227                             vector<double>& mfact);
317  
318 +        bool isFortranInitialized() {
319 +            return fortranInitialized_;
320 +        }
321 +        
322 +        //below functions are just forward functions
323 +        //To compose or to inherit is always a hot debate. In general, is-a relation need subclassing, in the
324 +        //the other hand, has-a relation need composing.
325 +        /**
326 +         * Adds property into property map
327 +         * @param genData GenericData to be added into PropertyMap
328 +         */
329 +        void addProperty(GenericData* genData);
330  
331 < };
331 >        /**
332 >         * Removes property from PropertyMap by name
333 >         * @param propName the name of property to be removed
334 >         */
335 >        void removeProperty(const std::string& propName);
336  
337 +        /**
338 +         * clear all of the properties
339 +         */
340 +        void clearProperties();
341  
342 +        /**
343 +         * Returns all names of properties
344 +         * @return all names of properties
345 +         */
346 +        std::vector<std::string> getPropertyNames();
347 +
348 +        /**
349 +         * Returns all of the properties in PropertyMap
350 +         * @return all of the properties in PropertyMap
351 +         */      
352 +        std::vector<GenericData*> getProperties();
353 +
354 +        /**
355 +         * Returns property
356 +         * @param propName name of property
357 +         * @return a pointer point to property with propName. If no property named propName
358 +         * exists, return NULL
359 +         */      
360 +        GenericData* getPropertyByName(const std::string& propName);
361 +                
362 +        friend std::ostream& operator <<(ostream& o, SimInfo& info);
363 +        
364 +    private:
365 +
366 +        
367 +        /** Returns the unique atom types of local processor in an array */
368 +        std::set<AtomType*> SimInfo::getUniqueAtomTypes();
369 +
370 +        /** fill up the simtype struct*/
371 +        void setupSimType();
372 +
373 +        /**
374 +         * Setup Fortran Simulation
375 +         * @see #setupFortranParallel
376 +         */
377 +        void setupFortranSim();
378 +
379 +        /** Figure out the radius of cutoff, radius of switching function and pass them to fortran */
380 +        void setupCutoff();
381 +
382 +        /** Calculates the number of degress of freedom in the whole system */
383 +        void calcNdf();
384 +        void calcNdfRaw();
385 +        void calcNdfTrans();
386 +
387 +        void addExcludePairs(Molecule* mol);
388 +        void removeExcludePairs(Molecule* mol);
389 +
390 +        /**
391 +         * Adds molecule stamp and the total number of the molecule with same molecule stamp in the whole
392 +         * system.
393 +         */
394 +        void addMoleculeStamp(MoleculeStamp* molStamp, int nmol);
395 +
396 +        std::map<int, Molecule*>  molecules_; /**< Molecule array */
397 +        
398 +        //degress of freedom
399 +        int ndf_;           /**< number of degress of freedom (excludes constraints),  ndf_ is local */
400 +        int ndfRaw_;    /**< number of degress of freedom (includes constraints),  ndfRaw_ is local */
401 +        int ndfTrans_; /**< number of translation degress of freedom, ndfTrans_ is local */
402 +        int nZconstraint_; /** number of  z-constraint molecules, nZconstraint_ is global */
403 +        
404 +        //number of global objects
405 +        int nGlobalMols_;       /**< number of molecules in the system */
406 +        int nGlobalAtoms_;   /**< number of atoms in the system */
407 +        int nGlobalCutoffGroups_; /**< number of cutoff groups in this system */
408 +        int nGlobalIntegrableObjects_; /**< number of integrable objects in this system */
409 +
410 +        /**
411 +         * the size of globalGroupMembership_  is nGlobalAtoms. Its index is  global index of an atom, and the
412 +         * corresponding content is the global index of cutoff group this atom belong to.
413 +         * It is filled by SimCreator once and only once, since it is never changed during the simulation.
414 +         */
415 +        std::vector<int> globalGroupMembership_;
416 +
417 +        /**
418 +         * the size of globalGroupMembership_  is nGlobalAtoms. Its index is  global index of an atom, and the
419 +         * corresponding content is the global index of molecule this atom belong to.
420 +         * It is filled by SimCreator once and only once, since it is never changed during the simulation.
421 +         */
422 +        std::vector<int> globalMolMembership_;        
423 +
424 +        
425 +        std::vector<int> molStampIds_;                                /**< stamp id array of all molecules in the system */
426 +        std::vector<MoleculeStamp*> moleculeStamps_;      /**< molecule stamps array */        
427 +        
428 +        //number of local objects
429 +        int nAtoms_;                        /**< number of atoms in local processor */
430 +        int nBonds_;                        /**< number of bonds in local processor */
431 +        int nBends_;                        /**< number of bends in local processor */
432 +        int nTorsions_;                    /**< number of torsions in local processor */
433 +        int nRigidBodies_;              /**< number of rigid bodies in local processor */
434 +        int nIntegrableObjects_;    /**< number of integrable objects in local processor */
435 +        int nCutoffGroups_;             /**< number of cutoff groups in local processor */
436 +        int nConstraints_;              /**< number of constraints in local processors */
437 +
438 +        simtype fInfo_; /**< A dual struct shared by c++/fortran which indicates the atom types in simulation*/
439 +        Exclude exclude_;
440 +        ForceField* forceField_;            
441 +        PropertyMap properties_;                  /**< Generic Property */
442 +        SnapshotManager* sman_;               /**< SnapshotManager */
443 +        Globals* globals_;
444 +        int seed_; /**< seed for random number generator */
445 +
446 +        /**
447 +         * The reason to have a local index manager is that when molecule is migrating to other processors,
448 +         * the atoms and the rigid-bodies will release their local indices to LocalIndexManager. Combining the
449 +         * information of molecule migrating to current processor, Migrator class can query  the LocalIndexManager
450 +         * to make a efficient data moving plan.
451 +         */        
452 +        LocalIndexManager localIndexMan_;
453 +
454 +        //file names
455 +        std::string finalConfigFileName_;
456 +        std::string dumpFileName_;
457 +        std::string statFileName_;
458 +
459 +        double rcut_;       /**< cutoff radius*/
460 +        double rsw_;        /**< radius of switching function*/
461 +
462 +        bool fortranInitialized_; /**< flag indicate whether fortran side is initialized */
463 +        
464 + #ifdef IS_MPI
465 +    //in Parallel version, we need MolToProc
466 +    public:
467 +                
468 +        /**
469 +         * Finds the processor where a molecule resides
470 +         * @return the id of the processor which contains the molecule
471 +         * @param globalIndex global Index of the molecule
472 +         */
473 +        int getMolToProc(int globalIndex) {
474 +            //assert(globalIndex < molToProcMap_.size());
475 +            return molToProcMap_[globalIndex];
476 +        }
477 +
478 +        /**
479 +         * Returns the pointer of internal molToProcMap array. This array will be filled by SimCreator class
480 +         * @see #SimCreator::divideMolecules
481 +         */
482 +        int* getMolToProcMapPointer() {
483 +            return &molToProcMap_[0];
484 +        }
485 +        
486 +    private:
487 +
488 +        void setupFortranParallel();
489 +        
490 +        /**
491 +         * The size of molToProcMap_ is equal to total number of molecules in the system.
492 +         *  It maps a molecule to the processor on which it resides. it is filled by SimCreator once and only
493 +         * once.
494 +         */        
495 +        std::vector<int> molToProcMap_;
496   #endif
497 +
498 + };
499 +
500 + } //namespace oopse
501 + #endif //BRAINS_SIMMODEL_HPP

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines