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

Comparing:
trunk/OOPSE-4/src/brains/SimInfo.hpp (file contents), Revision 1492 by tim, Fri Sep 24 16:27:58 2004 UTC vs.
branches/new_design/OOPSE-4/src/brains/SimInfo.hpp (file contents), Revision 1804 by tim, Tue Nov 30 19:58:25 2004 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines