| 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 |
+ |
|
| 16 |
|
index = theIndex; |
| 17 |
|
offset = 3 * index; |
| 18 |
|
offsetX = offset; |
| 34 |
|
virtual ~Atom() {} |
| 35 |
|
|
| 36 |
|
static void createArrays (int nElements) { |
| 37 |
+ |
int i; |
| 38 |
+ |
|
| 39 |
|
pos = new double[nElements*3]; |
| 40 |
|
vel = new double[nElements*3]; |
| 41 |
|
frc = new double[nElements*3]; |
| 42 |
|
trq = new double[nElements*3]; |
| 43 |
|
Amat = new double[nElements*9]; |
| 44 |
|
mu = new double[nElements]; |
| 45 |
< |
ul = new double[nElements]; |
| 45 |
> |
ul = new double[nElements*3]; |
| 46 |
|
|
| 47 |
|
// init directional values to zero |
| 48 |
|
|
| 49 |
< |
trq[offsetX] = 0.0; |
| 50 |
< |
trq[offsetY] = 0.0; |
| 51 |
< |
trq[offsetZ] = 0.0; |
| 52 |
< |
|
| 53 |
< |
Amat[Axx] = 0.0; |
| 54 |
< |
Amat[Axy] = 0.0; |
| 55 |
< |
Amat[Axz] = 0.0; |
| 56 |
< |
|
| 57 |
< |
Amat[Ayx] = 0.0; |
| 58 |
< |
Amat[Ayy] = 0.0; |
| 59 |
< |
Amat[Ayz] = 0.0; |
| 60 |
< |
|
| 61 |
< |
Amat[Azx] = 0.0; |
| 62 |
< |
Amat[Azy] = 0.0; |
| 63 |
< |
Amat[Azz] = 0.0; |
| 64 |
< |
|
| 65 |
< |
mu[index] = 0.0; |
| 66 |
< |
|
| 67 |
< |
ul[offsetX] = 0.0; |
| 68 |
< |
ul[offsetY] = 0.0; |
| 69 |
< |
ul[offsetZ] = 0.0; |
| 49 |
> |
for( i=0; i<nElements; i++){ |
| 50 |
> |
trq[i] = 0.0; |
| 51 |
> |
trq[i+1] = 0.0; |
| 52 |
> |
trq[i+2] = 0.0; |
| 53 |
> |
|
| 54 |
> |
Amat[i] = 1.0; |
| 55 |
> |
Amat[i+1] = 0.0; |
| 56 |
> |
Amat[i+2] = 0.0; |
| 57 |
> |
|
| 58 |
> |
Amat[i+3] = 0.0; |
| 59 |
> |
Amat[i+4] = 1.0; |
| 60 |
> |
Amat[i+5] = 0.0; |
| 61 |
> |
|
| 62 |
> |
Amat[i+6] = 0.0; |
| 63 |
> |
Amat[i+7] = 0.0; |
| 64 |
> |
Amat[i+8] = 1.0; |
| 65 |
> |
|
| 66 |
> |
mu[i] = 0.0; |
| 67 |
> |
|
| 68 |
> |
ul[i] = 0.0; |
| 69 |
> |
ul[i+1] = 0.0; |
| 70 |
> |
ul[i+2] = 0.0; |
| 71 |
> |
} |
| 72 |
|
} |
| 73 |
|
static void destroyArrays(void) { |
| 74 |
|
delete[] pos; |
| 215 |
|
|
| 216 |
|
int isDirectional( void ){ return 0; } |
| 217 |
|
void zeroForces() { |
| 218 |
< |
frc[offsetX] = 0.0; |
| 218 |
> |
frc[offsetX] = 0.0; |
| 219 |
|
frc[offsetY] = 0.0; |
| 220 |
|
frc[offsetZ] = 0.0; |
| 221 |
|
} |
| 227 |
|
DirectionalAtom(int theIndex) : Atom(theIndex) |
| 228 |
|
{ |
| 229 |
|
ssdIdentity = 0; |
| 230 |
< |
|
| 230 |
> |
sux = 0.0; |
| 231 |
> |
suy = 0.0; |
| 232 |
> |
suz = 0.0; |
| 233 |
|
} |
| 234 |
|
virtual ~DirectionalAtom() {} |
| 235 |
|
|
| 259 |
|
void addTz( double the_tz ) { trq[offsetZ] += the_tz;} |
| 260 |
|
|
| 261 |
|
void zeroForces() { |
| 262 |
< |
frc[offsetX] = 0.0; |
| 262 |
> |
frc[offsetX] = 0.0; |
| 263 |
|
frc[offsetY] = 0.0; |
| 264 |
|
frc[offsetZ] = 0.0; |
| 265 |
|
|
| 266 |
< |
trq[offsetX] = 0.0; |
| 266 |
> |
trq[offsetX] = 0.0; |
| 267 |
|
trq[offsetY] = 0.0; |
| 268 |
|
trq[offsetZ] = 0.0; |
| 269 |
|
} |
| 314 |
|
|
| 315 |
|
void lab2Body( double r[3] ); |
| 316 |
|
void body2Lab( double r[3] ); |
| 317 |
+ |
void updateU( void ); |
| 318 |
|
|
| 319 |
|
private: |
| 320 |
|
int dIndex; |