44 |
|
|
45 |
|
#include "brains/SimInfo.hpp" |
46 |
|
#include "types/AtomType.hpp" |
47 |
– |
#include "UseTheForce/ForceField.hpp" |
47 |
|
#include "nonbonded/LJ.hpp" |
48 |
|
#include "nonbonded/GB.hpp" |
49 |
|
#include "nonbonded/Sticky.hpp" |
57 |
|
using namespace std; |
58 |
|
|
59 |
|
namespace OpenMD { |
60 |
+ |
|
61 |
|
/** |
62 |
|
* @class InteractionManager InteractionManager is responsible for |
63 |
< |
* keeping track of the non-bonded interactions (C++) and providing |
64 |
< |
* an interface to the low-level loop (Fortran). |
63 |
> |
* keeping track of the non-bonded interactions (C++) |
64 |
|
*/ |
65 |
|
class InteractionManager { |
66 |
|
|
67 |
|
public: |
68 |
< |
static InteractionManager* Instance(); |
69 |
< |
static void setForceField(ForceField *ff) {forceField_ = ff;} |
70 |
< |
static void setCutoffRadius(RealType rcut) {rCut_ = rcut;} |
71 |
< |
static void setSwitchingRadius(RealType rsw) {rSwitch_ = rsw;} |
73 |
< |
static void setCutoffMethod(CutoffMethod cm) {cutoffMethod_ = cm;} |
68 |
> |
InteractionManager(); |
69 |
> |
~InteractionManager(); |
70 |
> |
void setSimInfo(SimInfo* info) {info_ = info;} |
71 |
> |
void initialize(); |
72 |
|
|
73 |
|
// Fortran support routines |
74 |
|
|
75 |
< |
static void doPrePair(int *atid1, int *atid2, RealType *rij, RealType *rho_i_at_j, RealType *rho_j_at_i); |
76 |
< |
static void doPreForce(int *atid, RealType *rho, RealType *frho, RealType *dfrhodrho); |
77 |
< |
static void doPair(int *atid1, int *atid2, RealType *d, RealType *r, RealType *r2, RealType *rcut, RealType *sw, int *topoDist, RealType *pot, RealType *vpair, RealType *f1, RealType *eFrame1, RealType *eFrame2, RealType *A1, RealType *A2, RealType *t1, RealType *t2, RealType *rho1, RealType *rho2, RealType *dfrho1, RealType *dfrho2, RealType *fshift1, RealType *fshift2); |
78 |
< |
static void doSkipCorrection(int *atid1, int *atid2, RealType *d, RealType *r, RealType *skippedCharge1, RealType *skippedCharge2, RealType *sw, RealType *electroMult, RealType *pot, RealType *vpair, RealType *f1, RealType *eFrame1, RealType *eFrame2, RealType *t1, RealType *t2); |
79 |
< |
static void doSelfCorrection(int *atid, RealType *eFrame, RealType *skippedCharge, RealType *pot, RealType *t); |
80 |
< |
static RealType getSuggestedCutoffRadius(int *atid1); |
81 |
< |
static RealType getSuggestedCutoffRadius(AtomType *atype); |
84 |
< |
static void setSwitch(RealType *rIn, RealType *rOut); |
85 |
< |
static void getSwitch(RealType *r2, RealType *sw, RealType *dswdr, RealType *r, int *in_switching_region); |
75 |
> |
void doPrePair(InteractionData idat); |
76 |
> |
void doPreForce(SelfData sdat); |
77 |
> |
void doPair(InteractionData idat); |
78 |
> |
void doSkipCorrection(InteractionData idat); |
79 |
> |
void doSelfCorrection(SelfData sdat); |
80 |
> |
RealType getSuggestedCutoffRadius(int *atid1); |
81 |
> |
RealType getSuggestedCutoffRadius(AtomType *atype); |
82 |
|
|
83 |
|
private: |
84 |
< |
virtual ~InteractionManager() { } |
89 |
< |
// singleton pattern, prevent reconstruction |
90 |
< |
InteractionManager() { } |
91 |
< |
InteractionManager(InteractionManager const&) {}; |
92 |
< |
InteractionManager& operator=(InteractionManager const&) {}; |
93 |
< |
static InteractionManager* _instance; |
84 |
> |
bool initialized_; |
85 |
|
|
86 |
< |
static void initialize(); |
96 |
< |
static bool initialized_; |
86 |
> |
void setupElectrostatics(); |
87 |
|
|
88 |
< |
static ForceField* forceField_; |
89 |
< |
static LJ* lj_; |
90 |
< |
static GB* gb_; |
91 |
< |
static Sticky* sticky_; |
92 |
< |
static EAM* eam_; |
93 |
< |
static SC* sc_; |
94 |
< |
static Morse* morse_; |
95 |
< |
static Electrostatic* electrostatic_; |
96 |
< |
static MAW* maw_; |
97 |
< |
static SwitchingFunction* switcher_; |
98 |
< |
|
109 |
< |
static RealType rCut_; |
110 |
< |
static RealType rSwitch_; |
111 |
< |
static CutoffMethod cutoffMethod_; |
112 |
< |
|
113 |
< |
static RealType vdwScale_[4]; |
114 |
< |
static RealType electrostaticScale_[4]; |
115 |
< |
|
116 |
< |
static map<int, AtomType*> typeMap_; |
88 |
> |
SimInfo* info_; |
89 |
> |
LJ* lj_; |
90 |
> |
GB* gb_; |
91 |
> |
Sticky* sticky_; |
92 |
> |
EAM* eam_; |
93 |
> |
SC* sc_; |
94 |
> |
Morse* morse_; |
95 |
> |
Electrostatic* electrostatic_; |
96 |
> |
MAW* maw_; |
97 |
> |
|
98 |
> |
map<int, AtomType*> typeMap_; |
99 |
|
/** |
100 |
|
* Each pair of atom types can have multiple interactions, so the |
101 |
|
* natural data structures are a map between the pair, and a set |
102 |
|
* of non-bonded interactions. |
103 |
|
*/ |
104 |
< |
static map<pair<AtomType*, AtomType*>, set<NonBondedInteraction*> > interactions_; |
104 |
> |
map<pair<AtomType*, AtomType*>, set<NonBondedInteraction*> > interactions_; |
105 |
|
}; |
106 |
|
} |
107 |
|
#endif |