| 42 |
|
#ifndef NONBONDED_LJ_HPP |
| 43 |
|
#define NONBONDED_LJ_HPP |
| 44 |
|
|
| 45 |
+ |
#include "nonbonded/NonBondedInteraction.hpp" |
| 46 |
|
#include "types/AtomType.hpp" |
| 47 |
|
#include "UseTheForce/ForceField.hpp" |
| 48 |
|
#include "math/Vector3.hpp" |
| 49 |
|
|
| 50 |
+ |
using namespace std; |
| 51 |
|
namespace OpenMD { |
| 52 |
|
|
| 53 |
|
struct LJInteractionData { |
| 57 |
|
bool explicitlySet; |
| 58 |
|
}; |
| 59 |
|
|
| 60 |
< |
class LJ { |
| 60 |
> |
class LJ : public VanDerWaalsInteraction { |
| 61 |
|
|
| 62 |
|
public: |
| 63 |
< |
static LJ* Instance(); |
| 64 |
< |
static void setForceField(ForceField *ff) {forceField_ = ff;}; |
| 65 |
< |
static void initialize(); |
| 66 |
< |
static void addType(AtomType* atomType); |
| 67 |
< |
static void addExplicitInteraction(AtomType* atype1, AtomType* atype2, RealType sigma, RealType epsilon); |
| 68 |
< |
static void calcForce(AtomType* at1, AtomType* at2, const Vector3d d, const RealType rij, const RealType r2, const RealType rcut, const RealType sw, const RealType vdwMult, RealType &vpair, RealType &pot, Vector3d &f1); |
| 69 |
< |
static RealType getSigma(AtomType* atomType); |
| 70 |
< |
static RealType getEpsilon(AtomType* atomType); |
| 71 |
< |
|
| 70 |
< |
// Fortran support routines; |
| 71 |
< |
static RealType getSigma(int atid); |
| 72 |
< |
static RealType getEpsilon(int atid); |
| 73 |
< |
static void do_lj_pair(int *atid1, int *atid2, RealType *d, RealType *rij, RealType *r2, RealType *rcut, RealType *sw, RealType *vdwMult, RealType *vpair, RealType *pot, RealType *f1); |
| 74 |
< |
static void setLJDefaultCutoff(RealType *thisRcut, int *sP, int *sF); |
| 75 |
< |
|
| 63 |
> |
LJ(); |
| 64 |
> |
void setForceField(ForceField *ff) {forceField_ = ff;}; |
| 65 |
> |
void addType(AtomType* atomType); |
| 66 |
> |
void addExplicitInteraction(AtomType* atype1, AtomType* atype2, RealType sigma, RealType epsilon); |
| 67 |
> |
RealType getSigma(AtomType* atomType); |
| 68 |
> |
RealType getEpsilon(AtomType* atomType); |
| 69 |
> |
virtual void calcForce(InteractionData idat); |
| 70 |
> |
virtual string getName() {return name_;} |
| 71 |
> |
|
| 72 |
|
private: |
| 73 |
< |
virtual ~LJ() { } |
| 74 |
< |
// singleton pattern, prevent reconstruction |
| 75 |
< |
LJ() { } |
| 76 |
< |
LJ(LJ const &) {}; |
| 81 |
< |
LJ& operator=(LJ const&) {}; |
| 82 |
< |
static LJ* _instance; |
| 83 |
< |
|
| 84 |
< |
static LJParam getLJParam(AtomType* atomType); |
| 85 |
< |
static RealType getSigma(AtomType* atomType1, AtomType* atomType2); |
| 86 |
< |
static RealType getEpsilon(AtomType* atomType1, AtomType* atomType2); |
| 73 |
> |
void initialize(); |
| 74 |
> |
LJParam getLJParam(AtomType* atomType); |
| 75 |
> |
RealType getSigma(AtomType* atomType1, AtomType* atomType2); |
| 76 |
> |
RealType getEpsilon(AtomType* atomType1, AtomType* atomType2); |
| 77 |
|
|
| 78 |
< |
static void getLJfunc(const RealType r, RealType &pot, RealType &deriv); |
| 89 |
< |
|
| 90 |
< |
static bool initialized_; |
| 91 |
< |
// LJMap will be used for providing access from Fortran. |
| 92 |
< |
// All of the C++ native classes should use AtomType*, but the |
| 93 |
< |
// fortran calls use int, so we need to look these up first before |
| 94 |
< |
// we can do anything else; |
| 95 |
< |
static std::map<int, AtomType*> LJMap; |
| 96 |
< |
static std::map<std::pair<AtomType*, AtomType*>, LJInteractionData> MixingMap; |
| 97 |
< |
static bool shiftedPot_; |
| 98 |
< |
static bool shiftedFrc_; |
| 99 |
< |
static ForceField* forceField_; |
| 78 |
> |
void getLJfunc(const RealType r, RealType &pot, RealType &deriv); |
| 79 |
|
|
| 80 |
+ |
bool initialized_; |
| 81 |
+ |
|
| 82 |
+ |
map<int, AtomType*> LJMap; |
| 83 |
+ |
map<pair<AtomType*, AtomType*>, LJInteractionData> MixingMap; |
| 84 |
+ |
bool shiftedPot_; |
| 85 |
+ |
bool shiftedFrc_; |
| 86 |
+ |
ForceField* forceField_; |
| 87 |
+ |
string name_; |
| 88 |
|
}; |
| 89 |
|
} |
| 90 |
|
|