--- branches/development/src/nonbonded/InteractionManager.hpp 2010/10/02 19:53:32 1502 +++ branches/development/src/nonbonded/InteractionManager.hpp 2011/06/08 16:05:07 1576 @@ -44,7 +44,6 @@ #include "brains/SimInfo.hpp" #include "types/AtomType.hpp" -#include "UseTheForce/ForceField.hpp" #include "nonbonded/LJ.hpp" #include "nonbonded/GB.hpp" #include "nonbonded/Sticky.hpp" @@ -52,94 +51,57 @@ #include "nonbonded/SC.hpp" #include "nonbonded/Morse.hpp" #include "nonbonded/Electrostatic.hpp" +#include "nonbonded/MAW.hpp" +#include "nonbonded/SwitchingFunction.hpp" using namespace std; namespace OpenMD { + /** * @class InteractionManager InteractionManager is responsible for - * keeping track of the non-bonded interactions (C++) and providing - * an interface to the low-level loop (Fortran). + * keeping track of the non-bonded interactions (C++) */ class InteractionManager { public: - static InteractionManager* Instance(); - static void setForceField(ForceField *ff) {forceField_ = ff;}; + InteractionManager(); + ~InteractionManager(); + void setSimInfo(SimInfo* info) {info_ = info;} + void initialize(); - static void doPrePair(AtomType* atype1, - AtomType* atype2, - RealType rij, - RealType &rho_i_at_j, - RealType &rho_j_at_i); - - static void doPreForce(AtomType* atype, - RealType rho, - RealType &frho, - RealType &dfrhodrho); - - static void doSkipCorrection(AtomType* atype1, - AtomType* atype2, - Vector3d d, - RealType rij, - RealType &skippedCharge1, - RealType &skippedCharge2, - RealType sw, - RealType electroMult, - RealType &pot, - RealType &vpair, - Vector3d &f1, - Mat3x3d eFrame1, - Mat3x3d eFrame2, - Vector3d &t1, - Vector3d &t2); - - static void doSelfCorrection(AtomType* atype, - Mat3x3d eFrame, - RealType skippedCharge, - RealType &pot, - Vector3d &t); - - static RealType getCutoff(); - // Fortran support routines - static void do_prepair(int *atid1, int *atid2, RealType *rij, RealType *rho_i_at_j, RealType *rho_j_at_i); - static void do_preforce(int *atid, RealType *rho, RealType *frho, RealType *dfrhodrho); - static void do_pair(int *atid1, int *atid2, RealType *d, RealType *r, RealType *r2, RealType *rcut, RealType *sw, RealType *vdwMult,RealType *electroMult, 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); - static void do_skip_correction(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); - static void do_self_correction(int *atid, RealType *eFrame, RealType *skippedCharge, RealType *pot, RealType *t); - + void doPrePair(InteractionData idat); + void doPreForce(SelfData sdat); + void doPair(InteractionData idat); + void doSkipCorrection(InteractionData idat); + void doSelfCorrection(SelfData sdat); + RealType getSuggestedCutoffRadius(int *atid1); + RealType getSuggestedCutoffRadius(AtomType *atype); private: - virtual ~InteractionManager() { } - // singleton pattern, prevent reconstruction - InteractionManager() { } - InteractionManager(InteractionManager const&) {}; - InteractionManager& operator=(InteractionManager const&) {}; - static InteractionManager* _instance; + bool initialized_; - static void initialize(); - static bool initialized_; + void setupElectrostatics(); - static ForceField* forceField_; - static LJ* lj_; - static GB* gb_; - static Sticky* sticky_; - static EAM* eam_; - static SC* sc_; - static Morse* morse_; - static Electrostatic* electrostatic_; - - static map typeMap_; + SimInfo* info_; + LJ* lj_; + GB* gb_; + Sticky* sticky_; + EAM* eam_; + SC* sc_; + Morse* morse_; + Electrostatic* electrostatic_; + MAW* maw_; + + map typeMap_; /** * Each pair of atom types can have multiple interactions, so the * natural data structures are a map between the pair, and a set * of non-bonded interactions. */ - static map, set > interactions_; - - + map, set > interactions_; }; } #endif