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: |
60 |
< |
typedef MoleculeIterator MoleculeIterator; |
60 |
> |
typedef std::map<int, Molecule*>::iterator MoleculeIterator; |
61 |
|
|
62 |
|
/** |
63 |
|
* Constructor of SimInfo |
66 |
|
* @param ff pointer of a concrete ForceField instance |
67 |
|
* @param globals |
68 |
|
* @note |
63 |
– |
* <p> |
64 |
– |
* The major change of SimInfo |
65 |
– |
* </p> |
69 |
|
*/ |
70 |
|
SimInfo(const std::vector<std::pair<MoleculeStamp*, int> >& molStampPairs, ForceField* ff, Globals* globals); |
71 |
|
virtual ~SimInfo(); |
229 |
|
|
230 |
|
/** Returns the local index manager */ |
231 |
|
LocalIndexManager* getLocalIndexManager() { |
232 |
< |
return localIndexMan_; |
232 |
> |
return &localIndexMan_; |
233 |
|
} |
234 |
|
|
235 |
|
int getMoleculeStampId(int globalIndex) { |
254 |
|
return i != molecules_.end() ? i->second : NULL; |
255 |
|
} |
256 |
|
|
257 |
< |
/** Returns the unique atom types of local processor in an array */ |
258 |
< |
std::set<AtomType*> SimInfo::getUniqueAtomTypes(); |
257 |
> |
/** Calculate the maximum cutoff radius based on the atom types */ |
258 |
> |
double calcMaxCutoffRadius(); |
259 |
> |
|
260 |
> |
double getRcut() { |
261 |
> |
return rcut_; |
262 |
> |
} |
263 |
|
|
264 |
+ |
double getRsw() { |
265 |
+ |
return rsw_; |
266 |
+ |
} |
267 |
+ |
|
268 |
|
std::string getFinalConfigFileName() { |
269 |
|
return finalConfigFileName_; |
270 |
|
} |
273 |
|
finalConfigFileName_ = fileName; |
274 |
|
} |
275 |
|
|
265 |
– |
|
276 |
|
std::string getDumpFileName() { |
277 |
|
return dumpFileName_; |
278 |
|
} |
289 |
|
statFileName_ = fileName; |
290 |
|
} |
291 |
|
|
292 |
+ |
/** |
293 |
+ |
* Returns the pointer of internal globalGroupMembership_ array. This array will be filled by SimCreator class |
294 |
+ |
* @see #SimCreator::setGlobalIndex |
295 |
+ |
*/ |
296 |
|
int* getGlobalGroupMembershipPointer() { |
297 |
|
return globalGroupMembership_[0]; |
298 |
+ |
} |
299 |
+ |
|
300 |
+ |
/** |
301 |
+ |
* Returns the pointer of internal globalMolMembership_ array. This array will be filled by SimCreator class |
302 |
+ |
* @see #SimCreator::setGlobalIndex |
303 |
+ |
*/ |
304 |
+ |
int* getGlobalMolMembershipPointer() { |
305 |
+ |
return globalMolMembership_[0]; |
306 |
|
} |
307 |
|
|
308 |
+ |
|
309 |
+ |
bool isFortranInitialized() { |
310 |
+ |
return fortranInitialized_; |
311 |
+ |
} |
312 |
+ |
|
313 |
|
//below functions are just forward functions |
314 |
|
//To compose or to inherit is always a hot debate. In general, is-a relation need subclassing, in the |
315 |
|
//the other hand, has-a relation need composing. |
354 |
|
|
355 |
|
private: |
356 |
|
|
357 |
+ |
|
358 |
+ |
/** Returns the unique atom types of local processor in an array */ |
359 |
+ |
std::set<AtomType*> SimInfo::getUniqueAtomTypes(); |
360 |
+ |
|
361 |
+ |
/** fill up the simtype struct*/ |
362 |
|
void setupSimType(); |
363 |
|
|
364 |
|
/** |
367 |
|
*/ |
368 |
|
void setupFortranSim(); |
369 |
|
|
370 |
+ |
/** Figure out the radius of cutoff, radius of switching function and pass them to fortran */ |
371 |
+ |
void setupCutoff(); |
372 |
+ |
|
373 |
|
/** Calculates the number of degress of freedom in the whole system */ |
374 |
|
void calcNdf(); |
375 |
|
void calcNdfRaw(); |
379 |
|
void removeExcludePairs(Molecule* mol); |
380 |
|
|
381 |
|
/** |
382 |
< |
* Adds molecule stamps into |
382 |
> |
* Adds molecule stamp and the total number of the molecule with same molecule stamp in the whole |
383 |
> |
* system. |
384 |
|
*/ |
385 |
|
void addMoleculeStamp(MoleculeStamp* molStamp, int nmol); |
386 |
|
|
403 |
|
* It is filled by SimCreator once and only once, since it is never changed during the simulation. |
404 |
|
*/ |
405 |
|
std::vector<int> globalGroupMembership_; |
406 |
+ |
|
407 |
+ |
/** |
408 |
+ |
* the size of globalGroupMembership_ is nGlobalAtoms. Its index is global index of an atom, and the |
409 |
+ |
* corresponding content is the global index of molecule this atom belong to. |
410 |
+ |
* It is filled by SimCreator once and only once, since it is never changed during the simulation. |
411 |
+ |
*/ |
412 |
+ |
std::vector<int> globalMolMembership_; |
413 |
+ |
|
414 |
|
|
415 |
|
std::vector<int> molStampIds_; /**< stamp id array of all molecules in the system */ |
416 |
|
std::vector<MoleculeStamp*> moleculeStamps_; /**< molecule stamps array */ |
433 |
|
Globals* globals_; |
434 |
|
int seed_; /**< seed for random number generator */ |
435 |
|
|
436 |
+ |
/** |
437 |
+ |
* The reason to have a local index manager is that when molecule is migrating to other processors, |
438 |
+ |
* the atoms and the rigid-bodies will release their local indices to LocalIndexManager. Combining the |
439 |
+ |
* information of molecule migrating to current processor, Migrator class can query the LocalIndexManager |
440 |
+ |
* to make a efficient data moving plan. |
441 |
+ |
*/ |
442 |
|
LocalIndexManager localIndexMan_; |
443 |
|
|
444 |
+ |
//file names |
445 |
|
std::string finalConfigFileName_; |
446 |
|
std::string dumpFileName_; |
447 |
|
std::string statFileName_; |
448 |
+ |
|
449 |
+ |
double rcut_; /**< cutoff radius*/ |
450 |
+ |
double rsw_; /**< radius of switching function*/ |
451 |
+ |
|
452 |
+ |
bool fortranInitialized_; /**< flag indicate whether fortran side is initialized */ |
453 |
|
|
454 |
|
#ifdef IS_MPI |
455 |
|
//in Parallel version, we need MolToProc |
465 |
|
return molToProcMap_[globalIndex]; |
466 |
|
} |
467 |
|
|
468 |
+ |
/** |
469 |
+ |
* Returns the pointer of internal molToProcMap array. This array will be filled by SimCreator class |
470 |
+ |
* @see #SimCreator::divideMolecules |
471 |
+ |
*/ |
472 |
|
int* getMolToProcMapPointer() { |
473 |
|
return &molToProcMap_[0]; |
474 |
|
} |