47 |
|
|
48 |
|
/** |
49 |
|
* @class SimInfo SimInfo.hpp "brains/SimInfo.hpp" |
50 |
< |
* @brief |
50 |
> |
* @brief As one of the heavy weight class of OOPSE, SimInfo |
51 |
> |
* One of the major changes in SimInfo class is the data struct. It only maintains a list of molecules. |
52 |
> |
* And the Molecule class will maintain all of the concrete objects (atoms, bond, bend, torsions, rigid bodies, |
53 |
> |
* cutoff groups, constrains). |
54 |
> |
* Another major change is the index. No matter single version or parallel version, atoms and |
55 |
> |
* rigid bodies have both global index and local index. Local index is not important to molecule as well as |
56 |
> |
* cutoff group. |
57 |
|
*/ |
58 |
|
class SimInfo { |
59 |
|
public: |
232 |
|
|
233 |
|
/** Returns the local index manager */ |
234 |
|
LocalIndexManager* getLocalIndexManager() { |
235 |
< |
return localIndexMan_; |
235 |
> |
return &localIndexMan_; |
236 |
|
} |
237 |
|
|
238 |
|
int getMoleculeStampId(int globalIndex) { |
257 |
|
return i != molecules_.end() ? i->second : NULL; |
258 |
|
} |
259 |
|
|
260 |
< |
/** Returns the unique atom types of local processor in an array */ |
261 |
< |
std::set<AtomType*> SimInfo::getUniqueAtomTypes(); |
260 |
> |
/** Calculate the maximum cutoff radius based on the atom types */ |
261 |
> |
double calcMaxCutoffRadius(); |
262 |
|
|
263 |
+ |
double getRcut() { |
264 |
+ |
return rcut_; |
265 |
+ |
} |
266 |
+ |
|
267 |
+ |
void setRcut(double rcut) { |
268 |
+ |
rcut_ = rcut; |
269 |
+ |
} |
270 |
+ |
|
271 |
+ |
double getRsw() { |
272 |
+ |
return rsw_; |
273 |
+ |
} |
274 |
+ |
void setRsw(double rsw) { |
275 |
+ |
rsw_ = rsw; |
276 |
+ |
} |
277 |
+ |
|
278 |
|
std::string getFinalConfigFileName() { |
279 |
|
return finalConfigFileName_; |
280 |
|
} |
300 |
|
statFileName_ = fileName; |
301 |
|
} |
302 |
|
|
303 |
+ |
/** |
304 |
+ |
* Returns the pointer of internal globalGroupMembership_ array. This array will be filled by SimCreator class |
305 |
+ |
* @see #SimCreator::setGlobalIndex |
306 |
+ |
*/ |
307 |
|
int* getGlobalGroupMembershipPointer() { |
308 |
|
return globalGroupMembership_[0]; |
309 |
|
} |
310 |
|
|
311 |
+ |
/** |
312 |
+ |
* Returns the pointer of internal globalMolMembership_ array. This array will be filled by SimCreator class |
313 |
+ |
* @see #SimCreator::setGlobalIndex |
314 |
+ |
*/ |
315 |
+ |
int* getGlobalMolMembershipPointer() { |
316 |
+ |
return globalMolMembership_[0]; |
317 |
+ |
} |
318 |
+ |
|
319 |
|
//below functions are just forward functions |
320 |
|
//To compose or to inherit is always a hot debate. In general, is-a relation need subclassing, in the |
321 |
|
//the other hand, has-a relation need composing. |
360 |
|
|
361 |
|
private: |
362 |
|
|
363 |
+ |
|
364 |
+ |
/** Returns the unique atom types of local processor in an array */ |
365 |
+ |
std::set<AtomType*> SimInfo::getUniqueAtomTypes(); |
366 |
+ |
|
367 |
+ |
/** fill up the simtype struct*/ |
368 |
|
void setupSimType(); |
369 |
|
|
370 |
|
/** |
382 |
|
void removeExcludePairs(Molecule* mol); |
383 |
|
|
384 |
|
/** |
385 |
< |
* Adds molecule stamps into |
385 |
> |
* Adds molecule stamp and the total number of the molecule with same molecule stamp in the whole |
386 |
> |
* system. |
387 |
|
*/ |
388 |
|
void addMoleculeStamp(MoleculeStamp* molStamp, int nmol); |
389 |
|
|
406 |
|
* It is filled by SimCreator once and only once, since it is never changed during the simulation. |
407 |
|
*/ |
408 |
|
std::vector<int> globalGroupMembership_; |
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 molecule 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> globalMolMembership_; |
416 |
+ |
|
417 |
|
|
418 |
|
std::vector<int> molStampIds_; /**< stamp id array of all molecules in the system */ |
419 |
|
std::vector<MoleculeStamp*> moleculeStamps_; /**< molecule stamps array */ |
436 |
|
Globals* globals_; |
437 |
|
int seed_; /**< seed for random number generator */ |
438 |
|
|
439 |
+ |
/** |
440 |
+ |
* The reason to have a local index manager is that when molecule is migrating to other processors, |
441 |
+ |
* the atoms and the rigid-bodies will release their local indices to LocalIndexManager. Combining the |
442 |
+ |
* information of molecule migrating to current processor, Migrator class can query the LocalIndexManager |
443 |
+ |
* to make a efficient data moving plan. |
444 |
+ |
*/ |
445 |
|
LocalIndexManager localIndexMan_; |
446 |
|
|
447 |
+ |
//file names |
448 |
|
std::string finalConfigFileName_; |
449 |
|
std::string dumpFileName_; |
450 |
|
std::string statFileName_; |
451 |
+ |
|
452 |
+ |
double rcut_; /**< cutoff radius*/ |
453 |
+ |
double rsw_; /**< radius of switching function*/ |
454 |
|
|
455 |
|
#ifdef IS_MPI |
456 |
|
//in Parallel version, we need MolToProc |
466 |
|
return molToProcMap_[globalIndex]; |
467 |
|
} |
468 |
|
|
469 |
+ |
/** |
470 |
+ |
* Returns the pointer of internal molToProcMap array. This array will be filled by SimCreator class |
471 |
+ |
* @see #SimCreator::divideMolecules |
472 |
+ |
*/ |
473 |
|
int* getMolToProcMapPointer() { |
474 |
|
return &molToProcMap_[0]; |
475 |
|
} |