5 |
|
#include <cstdlib> |
6 |
|
#include <iostream> |
7 |
|
|
8 |
+ |
#include "SimState.hpp" |
9 |
+ |
|
10 |
|
class Atom{ |
11 |
|
public: |
12 |
|
|
13 |
< |
Atom(int theIndex); |
13 |
> |
Atom(int theIndex, SimState* theConfig ); |
14 |
|
virtual ~Atom() {} |
15 |
|
|
16 |
< |
static double* pos; // the position array |
15 |
< |
static double* vel; // the velocity array |
16 |
< |
static double* frc; // the forc array |
17 |
< |
static double* trq; // the torque vector ( space fixed ) |
18 |
< |
static double* Amat; // the rotation matrix |
19 |
< |
static double* mu; // the dipole moment array |
20 |
< |
static double* ul; // the lab frame unit directional vector |
21 |
< |
static int nElements; |
16 |
> |
void setCoords(void); |
17 |
|
|
18 |
< |
static void createArrays (int the_nElements); |
19 |
< |
static void destroyArrays(void); |
20 |
< |
void addAtoms(int nAdded, double* Apos, double* Avel, double* Afrc, |
21 |
< |
double* Atrq, double* AAmat, double* Amu, |
22 |
< |
double* Aul); |
28 |
< |
void deleteAtom(int theIndex); |
29 |
< |
void deleteRange(int startIndex, int stopIndex); |
18 |
> |
// void addAtoms(int nAdded, double* Apos, double* Avel, double* Afrc, |
19 |
> |
// double* Atrq, double* AAmat, double* Amu, |
20 |
> |
// double* Aul); |
21 |
> |
// void deleteAtom(int theIndex); |
22 |
> |
// void deleteRange(int startIndex, int stopIndex); |
23 |
|
|
31 |
– |
static double* getPosArray( void ) { return pos; } |
32 |
– |
static double* getVelArray( void ) { return vel; } |
33 |
– |
static double* getFrcArray( void ) { return frc; } |
34 |
– |
static double* getTrqArray( void ) { return trq; } |
35 |
– |
static double* getAmatArray( void ) { return Amat; } |
36 |
– |
static double* getMuArray( void ) { return mu; } |
37 |
– |
static double* getUlArray( void ) { return ul; } |
38 |
– |
|
24 |
|
void getPos( double theP[3] ); |
25 |
|
void setPos( double theP[3] ); |
26 |
|
|
42 |
– |
double getX() const {return pos[offsetX];} |
43 |
– |
double getY() const {return pos[offsetY];} |
44 |
– |
double getZ() const {return pos[offsetZ];} |
45 |
– |
void setX(double x) {pos[offsetX] = x;} |
46 |
– |
void setY(double y) {pos[offsetY] = y;} |
47 |
– |
void setZ(double z) {pos[offsetZ] = z;} |
48 |
– |
|
27 |
|
void getVel( double theV[3] ); |
28 |
|
void setVel( double theV[3] ); |
29 |
|
|
52 |
– |
double get_vx() const {return vel[offsetX];} |
53 |
– |
double get_vy() const {return vel[offsetY];} |
54 |
– |
double get_vz() const {return vel[offsetZ];} |
55 |
– |
void set_vx(double vx) {vel[offsetX] = vx;} |
56 |
– |
void set_vy(double vy) {vel[offsetY] = vy;} |
57 |
– |
void set_vz(double vz) {vel[offsetZ] = vz;} |
58 |
– |
|
59 |
– |
|
30 |
|
void getFrc( double theF[3] ); |
31 |
|
void addFrc( double theF[3] ); |
32 |
|
|
63 |
– |
double getFx() const {return frc[offsetX];} |
64 |
– |
double getFy() const {return frc[offsetY];} |
65 |
– |
double getFz() const {return frc[offsetZ];} |
66 |
– |
void addFx(double add) {frc[offsetX] += add;} |
67 |
– |
void addFy(double add) {frc[offsetY] += add;} |
68 |
– |
void addFz(double add) {frc[offsetZ] += add;} |
33 |
|
virtual void zeroForces() = 0; |
34 |
|
|
35 |
|
double getMass() const {return c_mass;} |
36 |
|
void setMass(double mass) {c_mass = mass;} |
37 |
+ |
|
38 |
+ |
double getEamRcut() const {return myEamRcut;} |
39 |
+ |
void setEamRcut(double eamRcut) {myEamRcut = eamRcut;} |
40 |
|
|
41 |
|
double getSigma() const {return c_sigma;} |
42 |
|
void setSigma(double sigma) {c_sigma = sigma;} |
72 |
|
void seVDW( void ) { is_VDW = 1; is_LJ = 0; } |
73 |
|
int isVDW( void ) { return is_VDW; } |
74 |
|
|
75 |
+ |
void setEAM( void ) { is_EAM = 1; } |
76 |
+ |
int isEAM( void ) { return is_EAM; } |
77 |
+ |
|
78 |
|
virtual int isDirectional( void ) = 0; |
79 |
|
|
80 |
|
|
81 |
|
protected: |
82 |
|
|
83 |
+ |
SimState* myConfig; |
84 |
+ |
|
85 |
+ |
double* pos; // the position array |
86 |
+ |
double* vel; // the velocity array |
87 |
+ |
double* frc; // the forc array |
88 |
+ |
double* trq; // the torque vector ( space fixed ) |
89 |
+ |
double* Amat; // the rotation matrix |
90 |
+ |
double* mu; // the array of dipole moments |
91 |
+ |
double* ul; // the lab frame unit directional vector |
92 |
+ |
|
93 |
|
double c_mass; /* the mass of the atom in amu */ |
94 |
|
double c_sigma; /* the sigma parameter for van der walls interactions */ |
95 |
|
double c_epslon; /* the esplon parameter for VDW interactions */ |
96 |
|
double c_covalent; // The covalent radius of the atom. |
97 |
|
|
98 |
+ |
double myEamRcut; // Atom rcut for eam defined by the forcefield. |
99 |
+ |
|
100 |
|
int index; /* set the atom's index */ |
101 |
|
int offset; // the atom's offset in the storage array |
102 |
|
int offsetX, offsetY, offsetZ; |
113 |
|
int has_dipole; // dipole boolean |
114 |
|
int is_VDW; // VDW boolean |
115 |
|
int is_LJ; // LJ boolean |
116 |
+ |
int is_EAM; //EAM boolean |
117 |
|
|
118 |
+ |
bool hasCoords; |
119 |
+ |
|
120 |
|
#ifdef IS_MPI |
121 |
|
int myGlobalIndex; |
122 |
|
#endif |
126 |
|
class GeneralAtom : public Atom{ |
127 |
|
|
128 |
|
public: |
129 |
< |
GeneralAtom(int theIndex): Atom(theIndex){} |
129 |
> |
GeneralAtom(int theIndex, SimState* theConfig): Atom(theIndex, theConfig){} |
130 |
|
virtual ~GeneralAtom(){} |
131 |
|
|
132 |
|
int isDirectional( void ){ return 0; } |
133 |
< |
void zeroForces() { |
149 |
< |
frc[offsetX] = 0.0; |
150 |
< |
frc[offsetY] = 0.0; |
151 |
< |
frc[offsetZ] = 0.0; |
152 |
< |
} |
133 |
> |
void zeroForces( void ); |
134 |
|
}; |
135 |
|
|
136 |
|
class DirectionalAtom : public Atom { |
137 |
|
|
138 |
|
public: |
139 |
< |
DirectionalAtom(int theIndex) : Atom(theIndex) |
139 |
> |
DirectionalAtom(int theIndex, SimState* theConfig) : Atom(theIndex, |
140 |
> |
theConfig) |
141 |
|
{ |
142 |
|
ssdIdentity = 0; |
143 |
|
sux = 0.0; |
164 |
|
void setSUy( double the_suy ) { suy = the_suy; } |
165 |
|
void setSUz( double the_suz ) { suz = the_suz; } |
166 |
|
|
167 |
< |
void zeroForces() { |
186 |
< |
frc[offsetX] = 0.0; |
187 |
< |
frc[offsetY] = 0.0; |
188 |
< |
frc[offsetZ] = 0.0; |
167 |
> |
void zeroForces(); |
168 |
|
|
190 |
– |
trq[offsetX] = 0.0; |
191 |
– |
trq[offsetY] = 0.0; |
192 |
– |
trq[offsetZ] = 0.0; |
193 |
– |
} |
194 |
– |
|
169 |
|
void getA( double the_A[3][3] ); // get the full rotation matrix |
170 |
|
void setA( double the_A[3][3] ); |
171 |
|
|
193 |
|
// double getTy( void ) { return trq[offsetY]; } |
194 |
|
// double getTz( void ) { return trq[offsetZ]; } |
195 |
|
|
222 |
– |
void addTx( double the_tx ) { trq[offsetX] += the_tx;} |
223 |
– |
void addTy( double the_ty ) { trq[offsetY] += the_ty;} |
224 |
– |
void addTz( double the_tz ) { trq[offsetZ] += the_tz;} |
225 |
– |
|
196 |
|
void setI( double the_I[3][3] ); |
197 |
|
void getI( double the_I[3][3] ); |
198 |
|
|
207 |
|
double getIzx( void ) { return Izx; } |
208 |
|
double getIzy( void ) { return Izy; } |
209 |
|
double getIzz( void ) { return Izz; } |
240 |
– |
|
210 |
|
|
211 |
< |
double getMu( void ) { return mu[index]; } |
212 |
< |
void setMu( double the_mu ) { mu[index] = the_mu; } |
211 |
> |
double getMu( void ); |
212 |
> |
void setMu( double the_mu ); |
213 |
|
|
214 |
|
void lab2Body( double r[3] ); |
215 |
|
void body2Lab( double r[3] ); |