| 42 |
|
#ifndef NONBONDED_EAM_HPP |
| 43 |
|
#define NONBONDED_EAM_HPP |
| 44 |
|
|
| 45 |
+ |
#include "nonbonded/NonBondedInteraction.hpp" |
| 46 |
|
#include "types/AtomType.hpp" |
| 47 |
|
#include "UseTheForce/ForceField.hpp" |
| 48 |
|
#include "math/Vector3.hpp" |
| 51 |
|
namespace OpenMD { |
| 52 |
|
|
| 53 |
|
struct EAMAtomData { |
| 54 |
< |
CubicSpline rho; |
| 55 |
< |
CubicSpline F; |
| 56 |
< |
CubicSpline Z; |
| 54 |
> |
CubicSpline* rho; |
| 55 |
> |
CubicSpline* F; |
| 56 |
> |
CubicSpline* Z; |
| 57 |
|
RealType rcut; |
| 58 |
|
}; |
| 59 |
|
|
| 60 |
|
struct EAMInteractionData { |
| 61 |
< |
CubicSpline phi; |
| 61 |
> |
CubicSpline* phi; |
| 62 |
|
bool explicitlySet; |
| 63 |
|
}; |
| 64 |
|
|
| 68 |
|
eamUnknown |
| 69 |
|
}; |
| 70 |
|
|
| 71 |
< |
class EAM { |
| 71 |
> |
class EAM : public MetallicInteraction { |
| 72 |
|
|
| 73 |
|
public: |
| 74 |
< |
static EAM* Instance(); |
| 75 |
< |
static void setForceField(ForceField *ff) {forceField_ = ff;}; |
| 76 |
< |
static void initialize(); |
| 77 |
< |
static void addType(AtomType* atomType); |
| 78 |
< |
static void addExplicitInteraction(AtomType* atype1, AtomType* atype2, RealType dr, int nr, std::vector<RealType> phiAB); |
| 79 |
< |
|
| 80 |
< |
static void calcDensity(AtomType* at1, AtomType* at2, const Vector3d d, const RealType rij, const RealType r2, RealType rho_i_at_j, RealType rho_j_at_i); |
| 74 |
> |
EAM(); |
| 75 |
> |
void setForceField(ForceField *ff) {forceField_ = ff;}; |
| 76 |
> |
void addType(AtomType* atomType); |
| 77 |
> |
void addExplicitInteraction(AtomType* atype1, AtomType* atype2, RealType dr, int nr, std::vector<RealType> phiAB); |
| 78 |
> |
void calcDensity(DensityData ddat); |
| 79 |
> |
void calcFunctional(FunctionalData fdat); |
| 80 |
> |
void calcForce(InteractionData idat); |
| 81 |
> |
virtual string getName() { return name_; } |
| 82 |
|
|
| 81 |
– |
static void calcFunctional(AtomType* at1, const RealType rho, RealType frho, RealType* dfrhodrho); |
| 82 |
– |
|
| 83 |
– |
static void calcForce(AtomType* at1, AtomType* at2, const Vector3d d, const RealType rij, const RealType r2, const RealType sw, RealType &vpair, RealType &pot, Vector3d &f1, const RealType rho1, const RealType rho2, const RealType dfrho1, const RealType dfrho2, RealType fshift1, RealType fshift2); |
| 84 |
– |
|
| 85 |
– |
// Fortran support routines; |
| 86 |
– |
static void calc_eam_prepair_rho(int *atid1, int *atid2, RealType *d, RealType *rij, RealType *r2, RealType* rho_i_at_j, RealType* rho_j_at_i); |
| 87 |
– |
static void calc_eam_preforce_Frho(int *atid1, RealType* rho, RealType* frho, RealType* dfrhodrho); |
| 88 |
– |
static void do_eam_pair(int *atid1, int *atid2, RealType *d, RealType *rij, RealType *r2, RealType *sw, RealType *vpair, RealType *pot, RealType *f1, RealType* rho1, RealType* rho2, RealType* dfrho1, RealType* dfrho2, RealType* fshift1, RealType* fshift2); |
| 89 |
– |
static void setCutoffEAM(RealType *thisRcut); |
| 90 |
– |
|
| 83 |
|
private: |
| 84 |
< |
virtual ~EAM() { } |
| 93 |
< |
// singleton pattern, prevent reconstruction |
| 94 |
< |
EAM() { } |
| 95 |
< |
EAM(EAM const &) {}; |
| 96 |
< |
EAM& operator=(EAM const&) {}; |
| 97 |
< |
static EAM* _instance; |
| 98 |
< |
|
| 84 |
> |
void initialize(); |
| 85 |
|
EAMParam getEAMParam(AtomType* atomType); |
| 86 |
|
CubicSpline* getZ(AtomType* atomType); |
| 87 |
|
CubicSpline* getRho(AtomType* atomType); |
| 88 |
|
CubicSpline* getF(AtomType* atomType); |
| 89 |
+ |
RealType getRcut(AtomType* atomType); |
| 90 |
|
CubicSpline* getPhi(AtomType* atomType1, AtomType* atomType2); |
| 91 |
|
|
| 92 |
< |
static bool initialized_; |
| 93 |
< |
static std::map<int, AtomType*> EAMlist; |
| 94 |
< |
static std::map<AtomType*, EAMAtomData> EAMMap; |
| 95 |
< |
static std::map<std::pair<AtomType*, AtomType*>, EAMInteractionData> MixingMap; |
| 96 |
< |
static ForceField* forceField_; |
| 97 |
< |
static RealType eamRcut_; |
| 98 |
< |
static EAMMixingMethod mixMeth_; |
| 92 |
> |
bool initialized_; |
| 93 |
> |
std::map<int, AtomType*> EAMlist; |
| 94 |
> |
std::map<AtomType*, EAMAtomData> EAMMap; |
| 95 |
> |
std::map<std::pair<AtomType*, AtomType*>, EAMInteractionData> MixingMap; |
| 96 |
> |
ForceField* forceField_; |
| 97 |
> |
RealType eamRcut_; |
| 98 |
> |
EAMMixingMethod mixMeth_; |
| 99 |
> |
string name_; |
| 100 |
|
|
| 101 |
|
}; |
| 102 |
|
} |