36 |
|
* [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). |
37 |
|
* [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). |
38 |
|
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). |
39 |
< |
* [4] Vardeman & Gezelter, in progress (2009). |
39 |
> |
* [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). |
40 |
> |
* [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). |
41 |
|
*/ |
42 |
|
|
43 |
|
/** |
65 |
|
#include "utils/LocalIndexManager.hpp" |
66 |
|
#include "nonbonded/SwitchingFunction.hpp" |
67 |
|
|
67 |
– |
//another nonsense macro declaration |
68 |
– |
#define __OPENMD_C |
69 |
– |
#include "brains/fSimulation.h" |
70 |
– |
|
68 |
|
using namespace std; |
69 |
|
namespace OpenMD{ |
70 |
< |
enum CutoffMethod { |
74 |
< |
HARD, |
75 |
< |
SWITCHING_FUNCTION, |
76 |
< |
SHIFTED_POTENTIAL, |
77 |
< |
SHIFTED_FORCE |
78 |
< |
}; |
79 |
< |
|
80 |
< |
//forward decalration |
70 |
> |
//forward declaration |
71 |
|
class SnapshotManager; |
72 |
|
class Molecule; |
73 |
|
class SelectionManager; |
167 |
|
return nAtoms_; |
168 |
|
} |
169 |
|
|
170 |
+ |
/** Returns the number of effective cutoff groups on local processor */ |
171 |
+ |
unsigned int getNLocalCutoffGroups(); |
172 |
+ |
|
173 |
|
/** Returns the number of local bonds */ |
174 |
|
unsigned int getNBonds(){ |
175 |
|
return nBonds_; |
299 |
|
/** Overloaded version of gyrational volume that also returns |
300 |
|
det(I) so dV/dr can be calculated*/ |
301 |
|
void getGyrationalVolume(RealType &vol, RealType &detI); |
302 |
< |
/** main driver function to interact with fortran during the |
310 |
< |
initialization and molecule migration */ |
302 |
> |
|
303 |
|
void update(); |
304 |
+ |
/** |
305 |
+ |
* Do final bookkeeping before Force managers need their data. |
306 |
+ |
*/ |
307 |
+ |
void prepareTopology(); |
308 |
|
|
309 |
+ |
|
310 |
|
/** Returns the local index manager */ |
311 |
|
LocalIndexManager* getLocalIndexManager() { |
312 |
|
return &localIndexMan_; |
342 |
|
return globalMolMembership_[id]; |
343 |
|
} |
344 |
|
|
345 |
< |
RealType getCutoffRadius() { |
346 |
< |
return cutoffRadius_; |
347 |
< |
} |
345 |
> |
/** |
346 |
> |
* returns a vector which maps the local atom index on this |
347 |
> |
* processor to the global atom index. With only one processor, |
348 |
> |
* these should be identical. |
349 |
> |
*/ |
350 |
> |
vector<int> getGlobalAtomIndices(); |
351 |
|
|
352 |
< |
RealType getSwitchingRadius() { |
353 |
< |
return switchingRadius_; |
354 |
< |
} |
352 |
> |
/** |
353 |
> |
* returns a vector which maps the local cutoff group index on |
354 |
> |
* this processor to the global cutoff group index. With only one |
355 |
> |
* processor, these should be identical. |
356 |
> |
*/ |
357 |
> |
vector<int> getGlobalGroupIndices(); |
358 |
|
|
356 |
– |
RealType getListRadius() { |
357 |
– |
return listRadius_; |
358 |
– |
} |
359 |
|
|
360 |
|
string getFinalConfigFileName() { |
361 |
|
return finalConfigFileName_; |
415 |
|
} |
416 |
|
|
417 |
|
|
418 |
< |
bool isFortranInitialized() { |
419 |
< |
return fortranInitialized_; |
418 |
> |
bool isTopologyDone() { |
419 |
> |
return topologyDone_; |
420 |
|
} |
421 |
|
|
422 |
|
bool getCalcBoxDipole() { |
476 |
|
*/ |
477 |
|
void removeInteractionPairs(Molecule* mol); |
478 |
|
|
479 |
– |
|
480 |
– |
/** Returns the unique atom types of local processor in an array */ |
481 |
– |
set<AtomType*> getUniqueAtomTypes(); |
482 |
– |
|
479 |
|
/** Returns the set of atom types present in this simulation */ |
480 |
|
set<AtomType*> getSimulatedAtomTypes(); |
481 |
|
|
488 |
|
/** fill up the simtype struct and other simulation-related variables */ |
489 |
|
void setupSimVariables(); |
490 |
|
|
495 |
– |
/** |
496 |
– |
* Setup Fortran Simulation |
497 |
– |
* @see #setupFortranParallel |
498 |
– |
*/ |
499 |
– |
void setupFortranSim(); |
491 |
|
|
501 |
– |
/** Figure out the cutoff radius and cutoff method */ |
502 |
– |
void setupCutoffs(); |
503 |
– |
/** Figure out the switching radius and polynomial type for the switching function */ |
504 |
– |
void setupSwitching(); |
505 |
– |
/** Figure out the simulation variables associated with electrostatics */ |
506 |
– |
void setupElectrostatics(); |
507 |
– |
/** Figure out the neighbor list skin thickness */ |
508 |
– |
void setupNeighborlists(); |
509 |
– |
|
492 |
|
/** Determine if we need to accumulate the simulation box dipole */ |
493 |
|
void setupAccumulateBoxDipole(); |
494 |
|
|
543 |
|
bool requiresSkipCorrection_; /**< does this simulation require a skip-correction? */ |
544 |
|
bool requiresSelfCorrection_; /**< does this simulation require a self-correction? */ |
545 |
|
|
546 |
+ |
public: |
547 |
+ |
bool usesElectrostaticAtoms() { return usesElectrostaticAtoms_; } |
548 |
+ |
bool usesDirectionalAtoms() { return usesDirectionalAtoms_; } |
549 |
+ |
bool usesMetallicAtoms() { return usesMetallicAtoms_; } |
550 |
+ |
bool usesAtomicVirial() { return usesAtomicVirial_; } |
551 |
+ |
bool requiresPrepair() { return requiresPrepair_; } |
552 |
+ |
bool requiresSkipCorrection() { return requiresSkipCorrection_;} |
553 |
+ |
bool requiresSelfCorrection() { return requiresSelfCorrection_;} |
554 |
+ |
|
555 |
+ |
private: |
556 |
|
/// Data structures holding primary simulation objects |
557 |
|
map<int, Molecule*> molecules_; /**< map holding pointers to LOCAL molecules */ |
558 |
< |
simtype fInfo_; /**< A dual struct shared by C++ |
567 |
< |
and Fortran to pass |
568 |
< |
information about what types |
569 |
< |
of calculation are |
570 |
< |
required */ |
571 |
< |
|
558 |
> |
|
559 |
|
/// Stamps are templates for objects that are then used to create |
560 |
|
/// groups of objects. For example, a molecule stamp contains |
561 |
|
/// information on how to build that molecule (i.e. the topology, |
571 |
|
* the simulation. It should be nGlobalAtoms_ in size. |
572 |
|
*/ |
573 |
|
vector<int> globalGroupMembership_; |
574 |
+ |
public: |
575 |
+ |
vector<int> getGlobalGroupMembership() { return globalGroupMembership_; } |
576 |
+ |
private: |
577 |
|
|
578 |
|
/** |
579 |
|
* A vector that maps between the global index of an atom and the |
581 |
|
* by SimCreator once and only once, since it is never changed |
582 |
|
* during the simulation. It shoudl be nGlobalAtoms_ in size. |
583 |
|
*/ |
584 |
< |
vector<int> globalMolMembership_; |
584 |
> |
vector<int> globalMolMembership_; |
585 |
> |
|
586 |
> |
/** |
587 |
> |
* A vector that maps between the local index of an atom and the |
588 |
> |
* index of the AtomType. |
589 |
> |
*/ |
590 |
> |
vector<int> identArray_; |
591 |
> |
public: |
592 |
> |
vector<int> getIdentArray() { return identArray_; } |
593 |
> |
private: |
594 |
> |
|
595 |
> |
/** |
596 |
> |
* A vector which contains the fractional contribution of an |
597 |
> |
* atom's mass to the total mass of the cutoffGroup that atom |
598 |
> |
* belongs to. In the case of single atom cutoff groups, the mass |
599 |
> |
* factor for that atom is 1. For massless atoms, the factor is |
600 |
> |
* also 1. |
601 |
> |
*/ |
602 |
> |
vector<RealType> massFactors_; |
603 |
> |
public: |
604 |
> |
vector<RealType> getMassFactors() { return massFactors_; } |
605 |
> |
|
606 |
> |
PairList* getExcludedInteractions() { return &excludedInteractions_; } |
607 |
> |
PairList* getOneTwoInteractions() { return &oneTwoInteractions_; } |
608 |
> |
PairList* getOneThreeInteractions() { return &oneThreeInteractions_; } |
609 |
> |
PairList* getOneFourInteractions() { return &oneFourInteractions_; } |
610 |
> |
|
611 |
> |
private: |
612 |
|
|
613 |
|
/// lists to handle atoms needing special treatment in the non-bonded interactions |
614 |
|
PairList excludedInteractions_; /**< atoms excluded from interacting with each other */ |
638 |
|
string statFileName_; |
639 |
|
string restFileName_; |
640 |
|
|
624 |
– |
RealType cutoffRadius_; /**< cutoff radius for non-bonded interactions */ |
625 |
– |
RealType switchingRadius_; /**< inner radius of switching function */ |
626 |
– |
RealType listRadius_; /**< Verlet neighbor list radius */ |
627 |
– |
RealType skinThickness_; /**< Verlet neighbor list skin thickness */ |
628 |
– |
CutoffMethod cutoffMethod_; /**< Cutoff Method for most non-bonded interactions */ |
629 |
– |
SwitchingFunctionType sft_; /**< Type of switching function in use */ |
641 |
|
|
642 |
< |
bool fortranInitialized_; /** flag to indicate whether the fortran side is initialized */ |
642 |
> |
bool topologyDone_; /** flag to indicate whether the topology has |
643 |
> |
been scanned and all the relevant |
644 |
> |
bookkeeping has been done*/ |
645 |
|
|
646 |
|
bool calcBoxDipole_; /**< flag to indicate whether or not we calculate |
647 |
|
the simulation box dipole moment */ |
682 |
|
} |
683 |
|
|
684 |
|
private: |
672 |
– |
|
673 |
– |
void setupFortranParallel(); |
685 |
|
|
686 |
|
/** |
687 |
|
* The size of molToProcMap_ is equal to total number of molecules |