| 12 |
|
is_VDW = 0; |
| 13 |
|
is_LJ = 0; |
| 14 |
|
index = theIndex; |
| 15 |
+ |
offset = 3 * index; |
| 16 |
+ |
offsetX = offset; |
| 17 |
+ |
offsetY = offset+1; |
| 18 |
+ |
offsetZ = offset+2; |
| 19 |
|
} |
| 20 |
|
virtual ~Atom() {} |
| 21 |
|
|
| 32 |
|
delete[] trq; |
| 33 |
|
} |
| 34 |
|
|
| 35 |
< |
double getX() const {return pos[3*index];} |
| 36 |
< |
double getY() const {return pos[3*index+1];} |
| 37 |
< |
double getZ() const {return pos[3*index+2];} |
| 38 |
< |
void setX(double x) {pos[3*index] = x;} |
| 39 |
< |
void setY(double y) {pos[3*index+1] = y;} |
| 40 |
< |
void setZ(double z) {pos[3*index+2] = z;} |
| 35 |
> |
double getX() const {return pos[offsetX];} |
| 36 |
> |
double getY() const {return pos[offsetY];} |
| 37 |
> |
double getZ() const {return pos[offsetZ];} |
| 38 |
> |
void setX(double x) {pos[offsetX] = x;} |
| 39 |
> |
void setY(double y) {pos[offsetY] = y;} |
| 40 |
> |
void setZ(double z) {pos[offsetZ] = z;} |
| 41 |
|
|
| 42 |
< |
double get_vx() const {return vel[3*index];} |
| 43 |
< |
double get_vy() const {return vel[3*index+1];} |
| 44 |
< |
double get_vz() const {return vel[3*index+2];} |
| 45 |
< |
void set_vx(double vx) {vel[3*index] = vx;} |
| 46 |
< |
void set_vy(double vy) {vel[3*index+1] = vy;} |
| 47 |
< |
void set_vz(double vz) {vel[3*index+2] = vz;} |
| 42 |
> |
double get_vx() const {return vel[offsetX];} |
| 43 |
> |
double get_vy() const {return vel[offsetY];} |
| 44 |
> |
double get_vz() const {return vel[offsetZ];} |
| 45 |
> |
void set_vx(double vx) {vel[offsetX] = vx;} |
| 46 |
> |
void set_vy(double vy) {vel[offsetY] = vy;} |
| 47 |
> |
void set_vz(double vz) {vel[offsetZ] = vz;} |
| 48 |
|
|
| 49 |
< |
double getFx() const {return frc[3*index];} |
| 50 |
< |
double getFy() const {return frc[3*index+1];} |
| 51 |
< |
double getFz() const {return frc[3*index+2];} |
| 52 |
< |
void addFx(double add) {frc[3*index] += add;} |
| 53 |
< |
void addFy(double add) {frc[3*index+1] += add;} |
| 54 |
< |
void addFz(double add) {frc[3*index+2] += add;} |
| 49 |
> |
double getFx() const {return frc[offsetX];} |
| 50 |
> |
double getFy() const {return frc[offsetY];} |
| 51 |
> |
double getFz() const {return frc[offsetZ];} |
| 52 |
> |
void addFx(double add) {frc[offsetX] += add;} |
| 53 |
> |
void addFy(double add) {frc[offsetY] += add;} |
| 54 |
> |
void addFz(double add) {frc[offsetZ] += add;} |
| 55 |
|
virtual void zeroForces() = 0; |
| 56 |
|
|
| 57 |
|
double getMass() const {return c_mass;} |
| 67 |
|
void setCovalent(double covalent) {c_covalent = covalent;} |
| 68 |
|
|
| 69 |
|
int getIndex() const {return index;} |
| 70 |
< |
void setIndex(int theIndex) {index = theIndex;} |
| 71 |
< |
|
| 70 |
> |
void setIndex(int theIndex) { |
| 71 |
> |
index = theIndex; |
| 72 |
> |
offset = index*3; |
| 73 |
> |
offsetX = offset; |
| 74 |
> |
offsetY = offset+1; |
| 75 |
> |
offsetZ = offset+2; |
| 76 |
> |
} |
| 77 |
> |
|
| 78 |
|
char *getType() {return c_name;} |
| 79 |
|
void setType(char * name) {strcpy(c_name,name);} |
| 80 |
|
|
| 92 |
|
|
| 93 |
|
virtual int isDirectional( void ) = 0; |
| 94 |
|
|
| 85 |
– |
protected: |
| 86 |
– |
|
| 95 |
|
static double* pos; // the position array |
| 96 |
|
static double* vel; // the velocity array |
| 97 |
|
static double* frc; // the forc array |
| 98 |
|
static double* trq; // the torque vector ( space fixed ) |
| 99 |
|
|
| 100 |
+ |
protected: |
| 101 |
+ |
|
| 102 |
|
double c_mass; /* the mass of the atom in amu */ |
| 103 |
|
double c_sigma; /* the sigma parameter for van der walls interactions */ |
| 104 |
|
double c_epslon; /* the esplon parameter for VDW interactions */ |
| 105 |
|
double c_covalent; // The covalent radius of the atom. |
| 106 |
|
|
| 107 |
|
int index; /* set the atom's index */ |
| 108 |
+ |
int offset; // the atom's offset in the storage array |
| 109 |
+ |
int offsetX, offsetY, offsetZ; |
| 110 |
|
|
| 111 |
|
char c_name[100]; /* it's name */ |
| 112 |
|
|
| 118 |
|
|
| 119 |
|
}; |
| 120 |
|
|
| 121 |
+ |
|
| 122 |
+ |
|
| 123 |
|
class GeneralAtom : public Atom{ |
| 124 |
|
|
| 125 |
|
public: |
| 128 |
|
|
| 129 |
|
int isDirectional( void ){ return 0; } |
| 130 |
|
void zeroForces() { |
| 131 |
< |
frc[3*index] = 0.0; |
| 132 |
< |
frc[3*index+1] = 0.0; |
| 133 |
< |
frc[3*index+2] = 0.0; |
| 131 |
> |
frc[offsetX] = 0.0; |
| 132 |
> |
frc[offsetY] = 0.0; |
| 133 |
> |
frc[offsetZ] = 0.0; |
| 134 |
|
} |
| 135 |
|
}; |
| 136 |
|
|
| 171 |
|
void setJy( double the_jy ) { jy = the_jy; } |
| 172 |
|
void setJz( double the_jz ) { jz = the_jz; } |
| 173 |
|
|
| 174 |
< |
void addTx( double the_tx ) { trq[3*index] += the_tx;} |
| 175 |
< |
void addTy( double the_ty ) { trq[3*index+1] += the_ty;} |
| 176 |
< |
void addTz( double the_tz ) { trq[3*index+2] += the_tz;} |
| 174 |
> |
void addTx( double the_tx ) { trq[offsetX] += the_tx;} |
| 175 |
> |
void addTy( double the_ty ) { trq[offsetY] += the_ty;} |
| 176 |
> |
void addTz( double the_tz ) { trq[offsetZ] += the_tz;} |
| 177 |
|
|
| 178 |
|
void setMu( double the_mu ) { mu = the_mu; } |
| 179 |
|
|
| 180 |
|
void zeroForces() { |
| 181 |
< |
frc[3*index] = 0.0; |
| 182 |
< |
frc[3*index+1] = 0.0; |
| 183 |
< |
frc[3*index+2] = 0.0; |
| 181 |
> |
frc[offsetX] = 0.0; |
| 182 |
> |
frc[offsetY] = 0.0; |
| 183 |
> |
frc[offsetZ] = 0.0; |
| 184 |
|
|
| 185 |
< |
trq[3*index] = 0.0; |
| 186 |
< |
trq[3*index+1] = 0.0; |
| 187 |
< |
trq[3*index+2] = 0.0; |
| 185 |
> |
trq[offsetX] = 0.0; |
| 186 |
> |
trq[offsetY] = 0.0; |
| 187 |
> |
trq[offsetZ] = 0.0; |
| 188 |
|
} |
| 189 |
|
|
| 190 |
|
double getAxx( void ) { return Axx; } |
| 212 |
|
double getJy( void ) { return jy; } |
| 213 |
|
double getJz( void ) { return jz; } |
| 214 |
|
|
| 215 |
< |
double getTx( void ) { return trq[3*index];} |
| 216 |
< |
double getTy( void ) { return trq[3*index+1]; } |
| 217 |
< |
double getTz( void ) { return trq[3*index+2]; } |
| 215 |
> |
double getTx( void ) { return trq[offsetX];} |
| 216 |
> |
double getTy( void ) { return trq[offsetY]; } |
| 217 |
> |
double getTz( void ) { return trq[offsetZ]; } |
| 218 |
|
|
| 219 |
|
double getIxx( void ) { return Ixx; } |
| 220 |
|
double getIxy( void ) { return Ixy; } |