| 6 |
|
|
| 7 |
|
class Atom{ |
| 8 |
|
public: |
| 9 |
< |
Atom() { |
| 9 |
> |
Atom(int theIndex) { |
| 10 |
|
c_n_hyd = 0; |
| 11 |
|
has_dipole = 0; |
| 12 |
|
is_VDW = 0; |
| 13 |
|
is_LJ = 0; |
| 14 |
+ |
index = theIndex; |
| 15 |
|
} |
| 16 |
|
virtual ~Atom() {} |
| 17 |
+ |
|
| 18 |
+ |
static void createArrays (int nElements) { |
| 19 |
+ |
pos = new double[nElements*3]; |
| 20 |
+ |
vel = new double[nElements*3]; |
| 21 |
+ |
frc = new double[nElements*3]; |
| 22 |
+ |
trq = new double[nElements*3]; |
| 23 |
+ |
} |
| 24 |
+ |
static void destroyArrays(void) { |
| 25 |
+ |
delete[] pos; |
| 26 |
+ |
delete[] vel; |
| 27 |
+ |
delete[] frc; |
| 28 |
+ |
delete[] trq; |
| 29 |
+ |
} |
| 30 |
|
|
| 31 |
< |
double getX() const {return c_x;} |
| 32 |
< |
double getY() const {return c_y;} |
| 33 |
< |
double getZ() const {return c_z;} |
| 34 |
< |
void setX(double x) {c_x = x;} |
| 35 |
< |
void setY(double y) {c_y = y;} |
| 36 |
< |
void setZ(double z) {c_z = z;} |
| 31 |
> |
double getX() const {return pos[3*index];} |
| 32 |
> |
double getY() const {return pos[3*index+1];} |
| 33 |
> |
double getZ() const {return pos[3*index+2];} |
| 34 |
> |
void setX(double x) {pos[3*index] = x;} |
| 35 |
> |
void setY(double y) {pos[3*index+1] = y;} |
| 36 |
> |
void setZ(double z) {pos[3*index+2] = z;} |
| 37 |
|
|
| 38 |
< |
double get_vx() const {return c_vx;} |
| 39 |
< |
double get_vy() const {return c_vy;} |
| 40 |
< |
double get_vz() const {return c_vz;} |
| 41 |
< |
void set_vx(double vx) {c_vx = vx;} |
| 42 |
< |
void set_vy(double vy) {c_vy = vy;} |
| 43 |
< |
void set_vz(double vz) {c_vz = vz;} |
| 38 |
> |
double get_vx() const {return vel[3*index];} |
| 39 |
> |
double get_vy() const {return vel[3*index+1];} |
| 40 |
> |
double get_vz() const {return vel[3*index+2];} |
| 41 |
> |
void set_vx(double vx) {vel[3*index] = vx;} |
| 42 |
> |
void set_vy(double vy) {vel[3*index+1] = vy;} |
| 43 |
> |
void set_vz(double vz) {vel[3*index+2] = vz;} |
| 44 |
|
|
| 45 |
< |
double getFx() const {return c_Fx;} |
| 46 |
< |
double getFy() const {return c_Fy;} |
| 47 |
< |
double getFz() const {return c_Fz;} |
| 48 |
< |
void addFx(double add) {c_Fx += add;} |
| 49 |
< |
void addFy(double add) {c_Fy += add;} |
| 50 |
< |
void addFz(double add) {c_Fz += add;} |
| 45 |
> |
double getFx() const {return frc[3*index];} |
| 46 |
> |
double getFy() const {return frc[3*index+1];} |
| 47 |
> |
double getFz() const {return frc[3*index+2];} |
| 48 |
> |
void addFx(double add) {frc[3*index] += add;} |
| 49 |
> |
void addFy(double add) {frc[3*index+1] += add;} |
| 50 |
> |
void addFz(double add) {frc[3*index+2] += add;} |
| 51 |
|
virtual void zeroForces() = 0; |
| 52 |
|
|
| 53 |
|
double getMass() const {return c_mass;} |
| 62 |
|
double getCovalent() const {return c_covalent;} |
| 63 |
|
void setCovalent(double covalent) {c_covalent = covalent;} |
| 64 |
|
|
| 65 |
< |
int getIndex() const {return c_index;} |
| 66 |
< |
void setIndex(int index) {c_index = index;} |
| 65 |
> |
int getIndex() const {return index;} |
| 66 |
> |
void setIndex(int theIndex) {index = theIndex;} |
| 67 |
|
|
| 68 |
|
char *getType() {return c_name;} |
| 69 |
|
void setType(char * name) {strcpy(c_name,name);} |
| 83 |
|
virtual int isDirectional( void ) = 0; |
| 84 |
|
|
| 85 |
|
protected: |
| 72 |
– |
double c_x; /*the atom's position */ |
| 73 |
– |
double c_y; |
| 74 |
– |
double c_z; |
| 75 |
– |
|
| 76 |
– |
double c_vx; /*the atom's velocity */ |
| 77 |
– |
double c_vy; |
| 78 |
– |
double c_vz; |
| 79 |
– |
|
| 80 |
– |
double c_Fx; /* the atom's forces */ |
| 81 |
– |
double c_Fy; |
| 82 |
– |
double c_Fz; |
| 86 |
|
|
| 87 |
+ |
static double* pos; // the position array |
| 88 |
+ |
static double* vel; // the velocity array |
| 89 |
+ |
static double* frc; // the forc array |
| 90 |
+ |
static double* trq; // the torque vector ( space fixed ) |
| 91 |
+ |
|
| 92 |
|
double c_mass; /* the mass of the atom in amu */ |
| 93 |
|
double c_sigma; /* the sigma parameter for van der walls interactions */ |
| 94 |
|
double c_epslon; /* the esplon parameter for VDW interactions */ |
| 95 |
|
double c_covalent; // The covalent radius of the atom. |
| 96 |
|
|
| 97 |
< |
int c_index; /* set the atom's index */ |
| 97 |
> |
int index; /* set the atom's index */ |
| 98 |
|
|
| 99 |
|
char c_name[100]; /* it's name */ |
| 100 |
|
|
| 109 |
|
class GeneralAtom : public Atom{ |
| 110 |
|
|
| 111 |
|
public: |
| 112 |
< |
GeneralAtom(){} |
| 112 |
> |
GeneralAtom(int theIndex): Atom(theIndex){} |
| 113 |
|
virtual ~GeneralAtom(){} |
| 114 |
|
|
| 115 |
|
int isDirectional( void ){ return 0; } |
| 116 |
|
void zeroForces() { |
| 117 |
< |
c_Fx = 0.0; c_Fy = 0.0; c_Fz = 0.0; |
| 117 |
> |
frc[3*index] = 0.0; |
| 118 |
> |
frc[3*index+1] = 0.0; |
| 119 |
> |
frc[3*index+2] = 0.0; |
| 120 |
|
} |
| 121 |
|
}; |
| 122 |
|
|
| 123 |
|
class DirectionalAtom : public Atom { |
| 124 |
|
|
| 125 |
|
public: |
| 126 |
< |
DirectionalAtom() { ssdIdentity = 0; } |
| 126 |
> |
DirectionalAtom(int theIndex) : Atom(theIndex) |
| 127 |
> |
{ |
| 128 |
> |
ssdIdentity = 0; |
| 129 |
> |
} |
| 130 |
|
virtual ~DirectionalAtom() {} |
| 131 |
|
|
| 132 |
+ |
static void createDArrays(int nElements){ |
| 133 |
+ |
trq = new double[nElements*3]; |
| 134 |
+ |
} |
| 135 |
+ |
static void destroyDArrays(void){ |
| 136 |
+ |
delete[] trq; |
| 137 |
+ |
} |
| 138 |
+ |
|
| 139 |
|
int isDirectional(void) { return 1; } |
| 140 |
|
|
| 141 |
|
void setSSD( int value) { ssdIdentity = value; } |
| 157 |
|
void setJy( double the_jy ) { jy = the_jy; } |
| 158 |
|
void setJz( double the_jz ) { jz = the_jz; } |
| 159 |
|
|
| 160 |
< |
void addTx( double the_tx ) { tx += the_tx;} |
| 161 |
< |
void addTy( double the_ty ) { ty += the_ty;} |
| 162 |
< |
void addTz( double the_tz ) { tz += the_tz;} |
| 160 |
> |
void addTx( double the_tx ) { trq[3*index] += the_tx;} |
| 161 |
> |
void addTy( double the_ty ) { trq[3*index+1] += the_ty;} |
| 162 |
> |
void addTz( double the_tz ) { trq[3*index+2] += the_tz;} |
| 163 |
|
|
| 164 |
|
void setMu( double the_mu ) { mu = the_mu; } |
| 165 |
|
|
| 166 |
|
void zeroForces() { |
| 167 |
< |
c_Fx = 0.0; c_Fy = 0.0; c_Fz = 0.0; |
| 168 |
< |
tx = 0.0; ty = 0.0; tz = 0.0; |
| 167 |
> |
frc[3*index] = 0.0; |
| 168 |
> |
frc[3*index+1] = 0.0; |
| 169 |
> |
frc[3*index+2] = 0.0; |
| 170 |
> |
|
| 171 |
> |
trq[3*index] = 0.0; |
| 172 |
> |
trq[3*index+1] = 0.0; |
| 173 |
> |
trq[3*index+2] = 0.0; |
| 174 |
|
} |
| 175 |
|
|
| 176 |
|
double getAxx( void ) { return Axx; } |
| 198 |
|
double getJy( void ) { return jy; } |
| 199 |
|
double getJz( void ) { return jz; } |
| 200 |
|
|
| 201 |
< |
double getTx( void ) { return tx; } |
| 202 |
< |
double getTy( void ) { return ty; } |
| 203 |
< |
double getTz( void ) { return tz; } |
| 201 |
> |
double getTx( void ) { return trq[3*index];} |
| 202 |
> |
double getTy( void ) { return trq[3*index+1]; } |
| 203 |
> |
double getTz( void ) { return trq[3*index+2]; } |
| 204 |
|
|
| 205 |
|
double getIxx( void ) { return Ixx; } |
| 206 |
|
double getIxy( void ) { return Ixy; } |
| 220 |
|
void body2Lab( double r[3] ); |
| 221 |
|
|
| 222 |
|
private: |
| 223 |
+ |
int dIndex; |
| 224 |
|
|
| 225 |
|
double Axx, Axy, Axz; // the rotational matrix |
| 226 |
|
double Ayx, Ayy, Ayz; |
| 227 |
|
double Azx, Azy, Azz; |
| 228 |
|
|
| 229 |
< |
double sux, suy, suz; // the standard unit vector ( body fixed ) |
| 230 |
< |
double jx, jy, jz; // the angular momentum vector ( body fixed ) |
| 205 |
< |
double tx, ty, tz; // the torque vector ( space fixed ) |
| 229 |
> |
double sux, suy, suz; // the standard unit vector ( body fixed ) |
| 230 |
> |
double jx, jy, jz; // the angular momentum vector ( body fixed ) |
| 231 |
|
|
| 232 |
< |
double Ixx, Ixy, Ixz; // the inertial tensor matrix ( body fixed ) |
| 232 |
> |
double Ixx, Ixy, Ixz; // the inertial tensor matrix ( body fixed ) |
| 233 |
|
double Iyx, Iyy, Iyz; |
| 234 |
|
double Izx, Izy, Izz; |
| 235 |
|
|