16 |
|
offsetX = offset; |
17 |
|
offsetY = offset+1; |
18 |
|
offsetZ = offset+2; |
19 |
+ |
|
20 |
+ |
Axx = index*9; |
21 |
+ |
Axy = Axx+1; |
22 |
+ |
Axz = Axx+2; |
23 |
+ |
|
24 |
+ |
Ayx = Axx+3; |
25 |
+ |
Ayy = Axx+4; |
26 |
+ |
Ayz = Axx+5; |
27 |
+ |
|
28 |
+ |
Azx = Axx+6; |
29 |
+ |
Azy = Axx+7; |
30 |
+ |
Azz = Axx+8; |
31 |
|
} |
32 |
|
virtual ~Atom() {} |
33 |
|
|
36 |
|
vel = new double[nElements*3]; |
37 |
|
frc = new double[nElements*3]; |
38 |
|
trq = new double[nElements*3]; |
39 |
+ |
Amat = new double[nElements*9]; |
40 |
+ |
mu = new double[nElements]; |
41 |
+ |
ul = new double[nElements]; |
42 |
+ |
|
43 |
+ |
// init directional values to zero |
44 |
+ |
|
45 |
+ |
trq[offsetX] = 0.0; |
46 |
+ |
trq[offsetY] = 0.0; |
47 |
+ |
trq[offsetZ] = 0.0; |
48 |
+ |
|
49 |
+ |
Amat[Axx] = 0.0; |
50 |
+ |
Amat[Axy] = 0.0; |
51 |
+ |
Amat[Axz] = 0.0; |
52 |
+ |
|
53 |
+ |
Amat[Ayx] = 0.0; |
54 |
+ |
Amat[Ayy] = 0.0; |
55 |
+ |
Amat[Ayz] = 0.0; |
56 |
+ |
|
57 |
+ |
Amat[Azx] = 0.0; |
58 |
+ |
Amat[Azy] = 0.0; |
59 |
+ |
Amat[Azz] = 0.0; |
60 |
+ |
|
61 |
+ |
mu[index] = 0.0; |
62 |
+ |
|
63 |
+ |
ul[offsetX] = 0.0; |
64 |
+ |
ul[offsetY] = 0.0; |
65 |
+ |
ul[offsetZ] = 0.0; |
66 |
|
} |
67 |
|
static void destroyArrays(void) { |
68 |
|
delete[] pos; |
69 |
|
delete[] vel; |
70 |
|
delete[] frc; |
71 |
|
delete[] trq; |
72 |
+ |
delete[] Amat; |
73 |
+ |
delete[] mu; |
74 |
|
} |
75 |
|
|
76 |
|
static double* getPosArray( void ) { return pos; } |
77 |
|
static double* getVelArray( void ) { return vel; } |
78 |
|
static double* getFrcArray( void ) { return frc; } |
79 |
|
static double* getTrqArray( void ) { return trq; } |
80 |
+ |
static double* getAmatArray( void ) { return Amat; } |
81 |
+ |
static double* getMuArray( void ) { return mu; } |
82 |
+ |
static double* getUlArray( void ) { return ul; } |
83 |
|
|
40 |
– |
|
84 |
|
double getX() const {return pos[offsetX];} |
85 |
|
double getY() const {return pos[offsetY];} |
86 |
|
double getZ() const {return pos[offsetZ];} |
122 |
|
offsetX = offset; |
123 |
|
offsetY = offset+1; |
124 |
|
offsetZ = offset+2; |
125 |
+ |
|
126 |
+ |
Axx = index*9; |
127 |
+ |
Axy = Axx+1; |
128 |
+ |
Axz = Axx+2; |
129 |
+ |
|
130 |
+ |
Ayx = Axx+3; |
131 |
+ |
Ayy = Axx+4; |
132 |
+ |
Ayz = Axx+5; |
133 |
+ |
|
134 |
+ |
Azx = Axx+6; |
135 |
+ |
Azy = Axx+7; |
136 |
+ |
Azz = Axx+8; |
137 |
|
} |
138 |
|
|
139 |
|
char *getType() {return c_name;} |
165 |
|
static double* vel; // the velocity array |
166 |
|
static double* frc; // the forc array |
167 |
|
static double* trq; // the torque vector ( space fixed ) |
168 |
+ |
static double* Amat; // the rotation matrix |
169 |
+ |
static double* mu; // the dipole moment array |
170 |
+ |
static double* ul; // the lab frame unit directional vector |
171 |
|
|
172 |
|
protected: |
173 |
|
|
180 |
|
int offset; // the atom's offset in the storage array |
181 |
|
int offsetX, offsetY, offsetZ; |
182 |
|
|
183 |
+ |
int Axx, Axy, Axz; // the rotational matrix indices |
184 |
+ |
int Ayx, Ayy, Ayz; |
185 |
+ |
int Azx, Azy, Azz; |
186 |
+ |
|
187 |
|
char c_name[100]; /* it's name */ |
188 |
|
int ident; // it's unique numeric identity. |
189 |
|
|
221 |
|
DirectionalAtom(int theIndex) : Atom(theIndex) |
222 |
|
{ |
223 |
|
ssdIdentity = 0; |
224 |
+ |
|
225 |
|
} |
226 |
|
virtual ~DirectionalAtom() {} |
227 |
|
|
165 |
– |
static void createDArrays(int nElements){ |
166 |
– |
trq = new double[nElements*3]; |
167 |
– |
} |
168 |
– |
static void destroyDArrays(void){ |
169 |
– |
delete[] trq; |
170 |
– |
} |
171 |
– |
|
228 |
|
int isDirectional(void) { return 1; } |
229 |
|
|
230 |
|
void setSSD( int value) { ssdIdentity = value; } |
246 |
|
void setJy( double the_jy ) { jy = the_jy; } |
247 |
|
void setJz( double the_jz ) { jz = the_jz; } |
248 |
|
|
249 |
< |
void addTx( double the_tx ) { trq[offsetX] += the_tx;} |
249 |
> |
void addTx( double the_tx ) { trq[offsetX] += the_tx;} |
250 |
|
void addTy( double the_ty ) { trq[offsetY] += the_ty;} |
251 |
|
void addTz( double the_tz ) { trq[offsetZ] += the_tz;} |
252 |
|
|
197 |
– |
void setMu( double the_mu ) { mu = the_mu; } |
198 |
– |
|
253 |
|
void zeroForces() { |
254 |
|
frc[offsetX] = 0.0; |
255 |
|
frc[offsetY] = 0.0; |
260 |
|
trq[offsetZ] = 0.0; |
261 |
|
} |
262 |
|
|
263 |
< |
double getAxx( void ) { return Axx; } |
264 |
< |
double getAxy( void ) { return Axy; } |
265 |
< |
double getAxz( void ) { return Axz; } |
263 |
> |
double getAxx( void ) { return Amat[Axx]; } |
264 |
> |
double getAxy( void ) { return Amat[Axy]; } |
265 |
> |
double getAxz( void ) { return Amat[Axz]; } |
266 |
|
|
267 |
< |
double getAyx( void ) { return Ayx; } |
268 |
< |
double getAyy( void ) { return Ayy; } |
269 |
< |
double getAyz( void ) { return Ayz; } |
267 |
> |
double getAyx( void ) { return Amat[Ayx]; } |
268 |
> |
double getAyy( void ) { return Amat[Ayy]; } |
269 |
> |
double getAyz( void ) { return Amat[Ayz]; } |
270 |
|
|
271 |
< |
double getAzx( void ) { return Azx; } |
272 |
< |
double getAzy( void ) { return Azy; } |
273 |
< |
double getAzz( void ) { return Azz; } |
271 |
> |
double getAzx( void ) { return Amat[Azx]; } |
272 |
> |
double getAzy( void ) { return Amat[Azy]; } |
273 |
> |
double getAzz( void ) { return Amat[Azz]; } |
274 |
|
|
275 |
|
void getA( double the_A[3][3] ); // get the full rotation matrix |
276 |
|
|
278 |
|
double getSUy( void ) { return suy; } |
279 |
|
double getSUz( void ) { return suz; } |
280 |
|
|
281 |
< |
void getU( double the_u[3] ); // get the unit vector |
281 |
> |
void getU( double the_u[3] ); // get the unit vetor |
282 |
|
void getQ( double the_q[4] ); // get the quanternions |
283 |
|
|
284 |
|
double getJx( void ) { return jx; } |
301 |
|
double getIzy( void ) { return Izy; } |
302 |
|
double getIzz( void ) { return Izz; } |
303 |
|
|
304 |
< |
double getMu( void ) { return mu; } |
304 |
> |
double getMu( void ) { return mu[index]; } |
305 |
> |
void setMu( double the_mu ) { mu[index] = the_mu; } |
306 |
|
|
307 |
|
void lab2Body( double r[3] ); |
308 |
|
void body2Lab( double r[3] ); |
310 |
|
private: |
311 |
|
int dIndex; |
312 |
|
|
258 |
– |
double Axx, Axy, Axz; // the rotational matrix |
259 |
– |
double Ayx, Ayy, Ayz; |
260 |
– |
double Azx, Azy, Azz; |
261 |
– |
|
313 |
|
double sux, suy, suz; // the standard unit vector ( body fixed ) |
314 |
|
double jx, jy, jz; // the angular momentum vector ( body fixed ) |
315 |
|
|
317 |
|
double Iyx, Iyy, Iyz; |
318 |
|
double Izx, Izy, Izz; |
319 |
|
|
269 |
– |
double mu; // the magnitude of the dipole moment |
270 |
– |
|
320 |
|
int ssdIdentity; // boolean of whether atom is ssd |
321 |
|
|
322 |
|
}; |