2 |
|
#define _ATOM_H_ |
3 |
|
|
4 |
|
#include <cstring> |
5 |
+ |
#include <cstdlib> |
6 |
|
#include <iostream> |
7 |
|
|
8 |
|
class Atom{ |
12 |
|
has_dipole = 0; |
13 |
|
is_VDW = 0; |
14 |
|
is_LJ = 0; |
15 |
+ |
pos = NULL; |
16 |
+ |
|
17 |
|
index = theIndex; |
18 |
|
offset = 3 * index; |
19 |
|
offsetX = offset; |
35 |
|
virtual ~Atom() {} |
36 |
|
|
37 |
|
static void createArrays (int nElements) { |
38 |
+ |
int i; |
39 |
+ |
if( pos != NULL ) destroyArrays(); |
40 |
+ |
|
41 |
|
pos = new double[nElements*3]; |
42 |
|
vel = new double[nElements*3]; |
43 |
|
frc = new double[nElements*3]; |
44 |
|
trq = new double[nElements*3]; |
45 |
|
Amat = new double[nElements*9]; |
46 |
|
mu = new double[nElements]; |
47 |
< |
ul = new double[nElements]; |
47 |
> |
ul = new double[nElements*3]; |
48 |
|
|
49 |
|
// init directional values to zero |
50 |
|
|
51 |
< |
trq[offsetX] = 0.0; |
52 |
< |
trq[offsetY] = 0.0; |
53 |
< |
trq[offsetZ] = 0.0; |
54 |
< |
|
55 |
< |
Amat[Axx] = 0.0; |
56 |
< |
Amat[Axy] = 0.0; |
57 |
< |
Amat[Axz] = 0.0; |
58 |
< |
|
59 |
< |
Amat[Ayx] = 0.0; |
60 |
< |
Amat[Ayy] = 0.0; |
61 |
< |
Amat[Ayz] = 0.0; |
62 |
< |
|
63 |
< |
Amat[Azx] = 0.0; |
64 |
< |
Amat[Azy] = 0.0; |
65 |
< |
Amat[Azz] = 0.0; |
66 |
< |
|
67 |
< |
mu[index] = 0.0; |
68 |
< |
|
69 |
< |
ul[offsetX] = 0.0; |
70 |
< |
ul[offsetY] = 0.0; |
71 |
< |
ul[offsetZ] = 0.0; |
51 |
> |
for( i=0; i<nElements; i++){ |
52 |
> |
trq[i] = 0.0; |
53 |
> |
trq[i+1] = 0.0; |
54 |
> |
trq[i+2] = 0.0; |
55 |
> |
|
56 |
> |
Amat[i] = 1.0; |
57 |
> |
Amat[i+1] = 0.0; |
58 |
> |
Amat[i+2] = 0.0; |
59 |
> |
|
60 |
> |
Amat[i+3] = 0.0; |
61 |
> |
Amat[i+4] = 1.0; |
62 |
> |
Amat[i+5] = 0.0; |
63 |
> |
|
64 |
> |
Amat[i+6] = 0.0; |
65 |
> |
Amat[i+7] = 0.0; |
66 |
> |
Amat[i+8] = 1.0; |
67 |
> |
|
68 |
> |
mu[i] = 0.0; |
69 |
> |
|
70 |
> |
ul[i] = 0.0; |
71 |
> |
ul[i+1] = 0.0; |
72 |
> |
ul[i+2] = 0.0; |
73 |
> |
} |
74 |
|
} |
75 |
|
static void destroyArrays(void) { |
76 |
|
delete[] pos; |
217 |
|
|
218 |
|
int isDirectional( void ){ return 0; } |
219 |
|
void zeroForces() { |
220 |
< |
frc[offsetX] = 0.0; |
220 |
> |
frc[offsetX] = 0.0; |
221 |
|
frc[offsetY] = 0.0; |
222 |
|
frc[offsetZ] = 0.0; |
223 |
|
} |
229 |
|
DirectionalAtom(int theIndex) : Atom(theIndex) |
230 |
|
{ |
231 |
|
ssdIdentity = 0; |
232 |
< |
|
232 |
> |
sux = 0.0; |
233 |
> |
suy = 0.0; |
234 |
> |
suz = 0.0; |
235 |
|
} |
236 |
|
virtual ~DirectionalAtom() {} |
237 |
|
|
261 |
|
void addTz( double the_tz ) { trq[offsetZ] += the_tz;} |
262 |
|
|
263 |
|
void zeroForces() { |
264 |
< |
frc[offsetX] = 0.0; |
264 |
> |
frc[offsetX] = 0.0; |
265 |
|
frc[offsetY] = 0.0; |
266 |
|
frc[offsetZ] = 0.0; |
267 |
|
|
268 |
< |
trq[offsetX] = 0.0; |
268 |
> |
trq[offsetX] = 0.0; |
269 |
|
trq[offsetY] = 0.0; |
270 |
|
trq[offsetZ] = 0.0; |
271 |
|
} |
316 |
|
|
317 |
|
void lab2Body( double r[3] ); |
318 |
|
void body2Lab( double r[3] ); |
319 |
+ |
void updateU( void ); |
320 |
|
|
321 |
|
private: |
322 |
|
int dIndex; |