6 |
|
#include <iostream> |
7 |
|
|
8 |
|
#include "SimState.hpp" |
9 |
+ |
#include "StuntDouble.hpp" |
10 |
+ |
#include "BaseVisitor.hpp" |
11 |
|
|
12 |
< |
class Atom{ |
12 |
> |
class Atom : public StuntDouble { |
13 |
|
public: |
14 |
|
|
15 |
|
Atom(int theIndex, SimState* theConfig ); |
26 |
|
void getFrc( double theF[3] ); |
27 |
|
void addFrc( double theF[3] ); |
28 |
|
|
29 |
< |
virtual void zeroForces() = 0; |
29 |
> |
virtual void zeroForces(); |
30 |
|
|
31 |
< |
double getMass() const {return c_mass;} |
31 |
> |
double getMass() {return c_mass;} |
32 |
|
void setMass(double mass) {c_mass = mass;} |
31 |
– |
|
32 |
– |
double getEamRcut() const {return myEamRcut;} |
33 |
– |
void setEamRcut(double eamRcut) {myEamRcut = eamRcut;} |
33 |
|
|
35 |
– |
double getSigma() const {return c_sigma;} |
36 |
– |
void setSigma(double sigma) {c_sigma = sigma;} |
37 |
– |
|
38 |
– |
double getEpslon() const {return c_epslon;} |
39 |
– |
void setEpslon(double epslon) {c_epslon = epslon;} |
40 |
– |
|
41 |
– |
double getCovalent() const {return c_covalent;} |
42 |
– |
void setCovalent(double covalent) {c_covalent = covalent;} |
43 |
– |
|
34 |
|
int getIndex() const {return index;} |
35 |
|
void setIndex(int theIndex); |
36 |
+ |
|
37 |
|
char *getType() {return c_name;} |
38 |
|
void setType(char * name) {strcpy(c_name,name);} |
39 |
|
|
40 |
|
int getIdent( void ) { return ident; } |
41 |
|
void setIdent( int info ) { ident = info; } |
42 |
|
|
43 |
+ |
void getRc(double theRc[3]); |
44 |
+ |
void setRc(double theRc[3]); |
45 |
+ |
|
46 |
+ |
double getMassRatio() { return *massRatio;} |
47 |
+ |
void setMassRatio(double theMassRatio) { *massRatio = theMassRatio;} |
48 |
+ |
|
49 |
|
#ifdef IS_MPI |
50 |
|
int getGlobalIndex( void ) { return myGlobalIndex; } |
51 |
|
void setGlobalIndex( int info ) { myGlobalIndex = info; } |
52 |
|
#endif // is_mpi |
53 |
|
|
57 |
– |
void set_n_hydrogens( int n_h ) {c_n_hyd = n_h;} |
58 |
– |
int get_n_hydrogens() const {return c_n_hyd;} |
59 |
– |
|
54 |
|
void setHasDipole( int value ) { has_dipole = value; } |
55 |
|
int hasDipole( void ) { return has_dipole; } |
56 |
|
|
57 |
< |
void setLJ( void ) { is_LJ = 1; is_VDW = 0; } |
58 |
< |
int isLJ( void ) { return is_LJ; } |
57 |
> |
void setHasCharge(int value) {has_charge = value;} |
58 |
> |
int hasCharge(void) {return has_charge;} |
59 |
|
|
66 |
– |
void seVDW( void ) { is_VDW = 1; is_LJ = 0; } |
67 |
– |
int isVDW( void ) { return is_VDW; } |
60 |
|
|
61 |
< |
void setEAM( void ) { is_EAM = 1; } |
62 |
< |
int isEAM( void ) { return is_EAM; } |
71 |
< |
|
72 |
< |
virtual int isDirectional( void ) = 0; |
73 |
< |
|
74 |
< |
|
61 |
> |
virtual void accept(BaseVisitor* v) {v->visit(this);} |
62 |
> |
|
63 |
|
protected: |
64 |
|
|
65 |
|
SimState* myConfig; |
71 |
|
double* Amat; // the rotation matrix |
72 |
|
double* mu; // the array of dipole moments |
73 |
|
double* ul; // the lab frame unit directional vector |
74 |
+ |
double* rc; //the center of mass of the molecule |
75 |
+ |
double* massRatio; //the ratio of this atom to the total mass of the molecule |
76 |
|
|
77 |
|
double c_mass; /* the mass of the atom in amu */ |
88 |
– |
double c_sigma; /* the sigma parameter for van der walls interactions */ |
89 |
– |
double c_epslon; /* the esplon parameter for VDW interactions */ |
90 |
– |
double c_covalent; // The covalent radius of the atom. |
78 |
|
|
92 |
– |
double myEamRcut; // Atom rcut for eam defined by the forcefield. |
93 |
– |
|
79 |
|
int index; /* set the atom's index */ |
80 |
|
int offset; // the atom's offset in the storage array |
81 |
|
int offsetX, offsetY, offsetZ; |
86 |
|
|
87 |
|
char c_name[100]; /* it's name */ |
88 |
|
int ident; // it's unique numeric identity. |
104 |
– |
|
105 |
– |
int c_n_hyd; // the number of hydrogens bonded to the atom |
89 |
|
|
90 |
|
int has_dipole; // dipole boolean |
91 |
< |
int is_VDW; // VDW boolean |
109 |
< |
int is_LJ; // LJ boolean |
110 |
< |
int is_EAM; //EAM boolean |
91 |
> |
int has_charge; // charge boolean |
92 |
|
|
93 |
|
bool hasCoords; |
94 |
|
|
98 |
|
|
99 |
|
}; |
100 |
|
|
120 |
– |
class GeneralAtom : public Atom{ |
121 |
– |
|
122 |
– |
public: |
123 |
– |
GeneralAtom(int theIndex, SimState* theConfig): Atom(theIndex, theConfig){} |
124 |
– |
virtual ~GeneralAtom(){} |
125 |
– |
|
126 |
– |
int isDirectional( void ){ return 0; } |
127 |
– |
void zeroForces( void ); |
128 |
– |
}; |
129 |
– |
|
130 |
– |
class DirectionalAtom : public Atom { |
131 |
– |
|
132 |
– |
public: |
133 |
– |
DirectionalAtom(int theIndex, SimState* theConfig) : Atom(theIndex, |
134 |
– |
theConfig) |
135 |
– |
{ |
136 |
– |
ssdIdentity = 0; |
137 |
– |
sux = 0.0; |
138 |
– |
suy = 0.0; |
139 |
– |
suz = 0.0; |
140 |
– |
myMu = 0.0; |
141 |
– |
} |
142 |
– |
virtual ~DirectionalAtom() {} |
143 |
– |
|
144 |
– |
virtual void setCoords(void); |
145 |
– |
|
146 |
– |
void printAmatIndex( void ); |
147 |
– |
|
148 |
– |
int isDirectional(void) { return 1; } |
149 |
– |
|
150 |
– |
void setSSD( int value) { ssdIdentity = value; } |
151 |
– |
int isSSD(void) {return ssdIdentity; } |
152 |
– |
|
153 |
– |
|
154 |
– |
void setEuler( double phi, double theta, double psi ); |
155 |
– |
|
156 |
– |
double getSUx( void ) { return sux; } |
157 |
– |
double getSUy( void ) { return suy; } |
158 |
– |
double getSUz( void ) { return suz; } |
159 |
– |
|
160 |
– |
void setSUx( double the_sux ) { sux = the_sux; } |
161 |
– |
void setSUy( double the_suy ) { suy = the_suy; } |
162 |
– |
void setSUz( double the_suz ) { suz = the_suz; } |
163 |
– |
|
164 |
– |
void zeroForces(); |
165 |
– |
|
166 |
– |
void getA( double the_A[3][3] ); // get the full rotation matrix |
167 |
– |
void setA( double the_A[3][3] ); |
168 |
– |
|
169 |
– |
void getU( double the_u[3] ); // get the unit vetor |
170 |
– |
void updateU( void ); |
171 |
– |
|
172 |
– |
void getQ( double the_q[4] ); // get the quanternions |
173 |
– |
void setQ( double the_q[4] ); |
174 |
– |
|
175 |
– |
void getJ( double theJ[3] ); |
176 |
– |
void setJ( double theJ[3] ); |
177 |
– |
|
178 |
– |
double getJx( void ) { return jx; } |
179 |
– |
double getJy( void ) { return jy; } |
180 |
– |
double getJz( void ) { return jz; } |
181 |
– |
|
182 |
– |
void setJx( double the_jx ) { jx = the_jx; } |
183 |
– |
void setJy( double the_jy ) { jy = the_jy; } |
184 |
– |
void setJz( double the_jz ) { jz = the_jz; } |
185 |
– |
|
186 |
– |
void getTrq( double theT[3] ); |
187 |
– |
void addTrq( double theT[3] ); |
188 |
– |
|
189 |
– |
// double getTx( void ) { return trq[offsetX];} |
190 |
– |
// double getTy( void ) { return trq[offsetY]; } |
191 |
– |
// double getTz( void ) { return trq[offsetZ]; } |
192 |
– |
|
193 |
– |
void setI( double the_I[3][3] ); |
194 |
– |
void getI( double the_I[3][3] ); |
195 |
– |
|
196 |
– |
double getIxx( void ) { return Ixx; } |
197 |
– |
double getIxy( void ) { return Ixy; } |
198 |
– |
double getIxz( void ) { return Ixz; } |
199 |
– |
|
200 |
– |
double getIyx( void ) { return Iyx; } |
201 |
– |
double getIyy( void ) { return Iyy; } |
202 |
– |
double getIyz( void ) { return Iyz; } |
203 |
– |
|
204 |
– |
double getIzx( void ) { return Izx; } |
205 |
– |
double getIzy( void ) { return Izy; } |
206 |
– |
double getIzz( void ) { return Izz; } |
207 |
– |
|
208 |
– |
double getMu( void ); |
209 |
– |
void setMu( double the_mu ); |
210 |
– |
|
211 |
– |
void lab2Body( double r[3] ); |
212 |
– |
void body2Lab( double r[3] ); |
213 |
– |
|
214 |
– |
|
215 |
– |
private: |
216 |
– |
int dIndex; |
217 |
– |
|
218 |
– |
double myMu; |
219 |
– |
|
220 |
– |
double sux, suy, suz; // the standard unit vector ( body fixed ) |
221 |
– |
double jx, jy, jz; // the angular momentum vector ( body fixed ) |
222 |
– |
|
223 |
– |
double Ixx, Ixy, Ixz; // the inertial tensor matrix ( body fixed ) |
224 |
– |
double Iyx, Iyy, Iyz; |
225 |
– |
double Izx, Izy, Izz; |
226 |
– |
|
227 |
– |
int ssdIdentity; // boolean of whether atom is ssd |
228 |
– |
|
229 |
– |
}; |
230 |
– |
|
101 |
|
#endif |