73 |
|
class SnapshotManager; |
74 |
|
class Molecule; |
75 |
|
class SelectionManager; |
76 |
+ |
class StuntDouble; |
77 |
|
/** |
78 |
|
* @class SimInfo SimInfo.hpp "brains/SimInfo.hpp" |
79 |
< |
* @brief As one of the heavy weight class of OOPSE, SimInfo |
80 |
< |
* One of the major changes in SimInfo class is the data struct. It only maintains a list of molecules. |
81 |
< |
* And the Molecule class will maintain all of the concrete objects (atoms, bond, bend, torsions, rigid bodies, |
82 |
< |
* cutoff groups, constrains). |
83 |
< |
* Another major change is the index. No matter single version or parallel version, atoms and |
84 |
< |
* rigid bodies have both global index and local index. Local index is not important to molecule as well as |
84 |
< |
* cutoff group. |
79 |
> |
* @brief One of the heavy weight classes of OOPSE, SimInfo maintains a list of molecules. |
80 |
> |
* The Molecule class maintains all of the concrete objects |
81 |
> |
* (atoms, bond, bend, torsions, rigid bodies, cutoff groups, constrains). |
82 |
> |
* In both the single and parallel versions, atoms and |
83 |
> |
* rigid bodies have both global and local indices. The local index is |
84 |
> |
* not relevant to molecules or cutoff groups. |
85 |
|
*/ |
86 |
|
class SimInfo { |
87 |
|
public: |
95 |
|
* @param simParams |
96 |
|
* @note |
97 |
|
*/ |
98 |
< |
SimInfo(MakeStamps* stamps, std::vector<std::pair<MoleculeStamp*, int> >& molStampPairs, ForceField* ff, Globals* simParams); |
98 |
> |
SimInfo(ForceField* ff, Globals* simParams); |
99 |
|
virtual ~SimInfo(); |
100 |
|
|
101 |
|
/** |
207 |
|
|
208 |
|
/** Returns the number of degrees of freedom */ |
209 |
|
int getNdf() { |
210 |
< |
return ndf_; |
210 |
> |
return ndf_ - getFdf(); |
211 |
|
} |
212 |
|
|
213 |
|
/** Returns the number of raw degrees of freedom */ |
220 |
|
return ndfTrans_; |
221 |
|
} |
222 |
|
|
223 |
+ |
/** sets the current number of frozen degrees of freedom */ |
224 |
+ |
void setFdf(int fdf) { |
225 |
+ |
fdf_local = fdf; |
226 |
+ |
} |
227 |
+ |
|
228 |
+ |
int getFdf(); |
229 |
+ |
|
230 |
|
//getNZconstraint and setNZconstraint ruin the coherent of SimInfo class, need refactorying |
231 |
|
|
232 |
|
/** Returns the total number of z-constraint molecules in the system */ |
306 |
|
return i != molecules_.end() ? i->second : NULL; |
307 |
|
} |
308 |
|
|
309 |
< |
/** Calculate the maximum cutoff radius based on the atom types */ |
303 |
< |
double calcMaxCutoffRadius(); |
304 |
< |
|
305 |
< |
double getRcut() { |
309 |
> |
RealType getRcut() { |
310 |
|
return rcut_; |
311 |
|
} |
312 |
|
|
313 |
< |
double getRsw() { |
313 |
> |
RealType getRsw() { |
314 |
|
return rsw_; |
315 |
|
} |
316 |
+ |
|
317 |
+ |
RealType getList() { |
318 |
+ |
return rlist_; |
319 |
+ |
} |
320 |
|
|
321 |
|
std::string getFinalConfigFileName() { |
322 |
|
return finalConfigFileName_; |
323 |
|
} |
324 |
< |
|
324 |
> |
|
325 |
|
void setFinalConfigFileName(const std::string& fileName) { |
326 |
|
finalConfigFileName_ = fileName; |
327 |
|
} |
328 |
|
|
329 |
+ |
std::string getRawMetaData() { |
330 |
+ |
return rawMetaData_; |
331 |
+ |
} |
332 |
+ |
void setRawMetaData(const std::string& rawMetaData) { |
333 |
+ |
rawMetaData_ = rawMetaData; |
334 |
+ |
} |
335 |
+ |
|
336 |
|
std::string getDumpFileName() { |
337 |
|
return dumpFileName_; |
338 |
|
} |
380 |
|
return fortranInitialized_; |
381 |
|
} |
382 |
|
|
383 |
+ |
bool getCalcBoxDipole() { |
384 |
+ |
return calcBoxDipole_; |
385 |
+ |
} |
386 |
+ |
|
387 |
|
//below functions are just forward functions |
388 |
|
//To compose or to inherit is always a hot debate. In general, is-a relation need subclassing, in the |
389 |
|
//the other hand, has-a relation need composing. |
441 |
|
|
442 |
|
friend std::ostream& operator <<(std::ostream& o, SimInfo& info); |
443 |
|
|
444 |
< |
void getCutoff(double& rcut, double& rsw); |
444 |
> |
void getCutoff(RealType& rcut, RealType& rsw); |
445 |
|
|
446 |
|
private: |
447 |
|
|
460 |
|
/** Figure out which coulombic correction method to use and pass to fortran */ |
461 |
|
void setupElectrostaticSummationMethod( int isError ); |
462 |
|
|
463 |
+ |
/** Figure out which polynomial type to use for the switching function */ |
464 |
+ |
void setupSwitchingFunction(); |
465 |
+ |
|
466 |
+ |
/** Determine if we need to accumulate the simulation box dipole */ |
467 |
+ |
void setupAccumulateBoxDipole(); |
468 |
+ |
|
469 |
|
/** Calculates the number of degress of freedom in the whole system */ |
470 |
|
void calcNdf(); |
471 |
|
void calcNdfRaw(); |
472 |
|
void calcNdfTrans(); |
473 |
|
|
474 |
+ |
ForceField* forceField_; |
475 |
+ |
Globals* simParams_; |
476 |
+ |
|
477 |
+ |
std::map<int, Molecule*> molecules_; /**< Molecule array */ |
478 |
+ |
|
479 |
|
/** |
480 |
|
* Adds molecule stamp and the total number of the molecule with same molecule stamp in the whole |
481 |
|
* system. |
482 |
|
*/ |
483 |
|
void addMoleculeStamp(MoleculeStamp* molStamp, int nmol); |
454 |
– |
|
455 |
– |
MakeStamps* stamps_; |
456 |
– |
ForceField* forceField_; |
457 |
– |
Globals* simParams_; |
458 |
– |
|
459 |
– |
std::map<int, Molecule*> molecules_; /**< Molecule array */ |
484 |
|
|
485 |
|
//degress of freedom |
486 |
|
int ndf_; /**< number of degress of freedom (excludes constraints), ndf_ is local */ |
487 |
+ |
int fdf_local; /**< number of frozen degrees of freedom */ |
488 |
+ |
int fdf_; /**< number of frozen degrees of freedom */ |
489 |
|
int ndfRaw_; /**< number of degress of freedom (includes constraints), ndfRaw_ is local */ |
490 |
|
int ndfTrans_; /**< number of translation degress of freedom, ndfTrans_ is local */ |
491 |
|
int nZconstraint_; /** number of z-constraint molecules, nZconstraint_ is global */ |
537 |
|
*/ |
538 |
|
LocalIndexManager localIndexMan_; |
539 |
|
|
540 |
+ |
// unparsed MetaData block for storing in Dump and EOR files: |
541 |
+ |
std::string rawMetaData_; |
542 |
+ |
|
543 |
|
//file names |
544 |
|
std::string finalConfigFileName_; |
545 |
|
std::string dumpFileName_; |
546 |
|
std::string statFileName_; |
547 |
|
std::string restFileName_; |
548 |
|
|
549 |
< |
double rcut_; /**< cutoff radius*/ |
550 |
< |
double rsw_; /**< radius of switching function*/ |
549 |
> |
RealType rcut_; /**< cutoff radius*/ |
550 |
> |
RealType rsw_; /**< radius of switching function*/ |
551 |
> |
RealType rlist_; /**< neighbor list radius */ |
552 |
|
|
553 |
|
bool fortranInitialized_; /**< flag indicate whether fortran side is initialized */ |
554 |
|
|
555 |
+ |
bool calcBoxDipole_; /**< flag to indicate whether or not we calculate the simulation box dipole moment */ |
556 |
+ |
|
557 |
+ |
public: |
558 |
+ |
/** |
559 |
+ |
* return an integral objects by its global index. In MPI version, if the StuntDouble with specified |
560 |
+ |
* global index does not belong to local processor, a NULL will be return. |
561 |
+ |
*/ |
562 |
+ |
StuntDouble* getIOIndexToIntegrableObject(int index); |
563 |
+ |
void setIOIndexToIntegrableObject(const std::vector<StuntDouble*>& v); |
564 |
+ |
private: |
565 |
+ |
std::vector<StuntDouble*> IOIndexToIntegrableObject; |
566 |
+ |
//public: |
567 |
+ |
//void setStuntDoubleFromGlobalIndex(std::vector<StuntDouble*> v); |
568 |
+ |
/** |
569 |
+ |
* return a StuntDouble by its global index. In MPI version, if the StuntDouble with specified |
570 |
+ |
* global index does not belong to local processor, a NULL will be return. |
571 |
+ |
*/ |
572 |
+ |
//StuntDouble* getStuntDoubleFromGlobalIndex(int index); |
573 |
+ |
//private: |
574 |
+ |
//std::vector<StuntDouble*> sdByGlobalIndex_; |
575 |
+ |
|
576 |
|
#ifdef IS_MPI |
577 |
|
//in Parallel version, we need MolToProc |
578 |
|
public: |
594 |
|
void setMolToProcMap(const std::vector<int>& molToProcMap) { |
595 |
|
molToProcMap_ = molToProcMap; |
596 |
|
} |
597 |
+ |
|
598 |
+ |
|
599 |
|
|
600 |
|
private: |
601 |
|
|