--- trunk/mdtools/headers/Atom.hpp 2002/11/26 21:04:43 189 +++ trunk/mdtools/headers/Atom.hpp 2003/01/17 21:53:33 237 @@ -13,6 +13,9 @@ class Atom{ (public) is_LJ = 0; index = theIndex; offset = 3 * index; + offsetX = offset; + offsetY = offset+1; + offsetZ = offset+2; } virtual ~Atom() {} @@ -28,27 +31,33 @@ class Atom{ (public) delete[] frc; delete[] trq; } + + static double* getPosArray( void ) { return pos; } + static double* getVelArray( void ) { return vel; } + static double* getFrcArray( void ) { return frc; } + static double* getTrqArray( void ) { return trq; } - double getX() const {return pos[offset];} - double getY() const {return pos[offset+1];} - double getZ() const {return pos[offset+2];} - void setX(double x) {pos[offset] = x;} - void setY(double y) {pos[offset+1] = y;} - void setZ(double z) {pos[offset+2] = z;} - double get_vx() const {return vel[offset];} - double get_vy() const {return vel[offset+1];} - double get_vz() const {return vel[offset+2];} - void set_vx(double vx) {vel[offset] = vx;} - void set_vy(double vy) {vel[offset+1] = vy;} - void set_vz(double vz) {vel[offset+2] = vz;} + double getX() const {return pos[offsetX];} + double getY() const {return pos[offsetY];} + double getZ() const {return pos[offsetZ];} + void setX(double x) {pos[offsetX] = x;} + void setY(double y) {pos[offsetY] = y;} + void setZ(double z) {pos[offsetZ] = z;} - double getFx() const {return frc[offset];} - double getFy() const {return frc[offset+1];} - double getFz() const {return frc[offset+2];} - void addFx(double add) {frc[offset] += add;} - void addFy(double add) {frc[offset+1] += add;} - void addFz(double add) {frc[offset+2] += add;} + double get_vx() const {return vel[offsetX];} + double get_vy() const {return vel[offsetY];} + double get_vz() const {return vel[offsetZ];} + void set_vx(double vx) {vel[offsetX] = vx;} + void set_vy(double vy) {vel[offsetY] = vy;} + void set_vz(double vz) {vel[offsetZ] = vz;} + + double getFx() const {return frc[offsetX];} + double getFy() const {return frc[offsetY];} + double getFz() const {return frc[offsetZ];} + void addFx(double add) {frc[offsetX] += add;} + void addFy(double add) {frc[offsetY] += add;} + void addFz(double add) {frc[offsetZ] += add;} virtual void zeroForces() = 0; double getMass() const {return c_mass;} @@ -64,10 +73,19 @@ class Atom{ (public) void setCovalent(double covalent) {c_covalent = covalent;} int getIndex() const {return index;} - void setIndex(int theIndex) {index = theIndex; offset = index*3;} - + void setIndex(int theIndex) { + index = theIndex; + offset = index*3; + offsetX = offset; + offsetY = offset+1; + offsetZ = offset+2; + } + char *getType() {return c_name;} void setType(char * name) {strcpy(c_name,name);} + + int getIdent( void ) { return ident; } + void setIdent( int info ) { ident = info; } void set_n_hydrogens( int n_h ) {c_n_hyd = n_h;} int get_n_hydrogens() const {return c_n_hyd;} @@ -97,8 +115,10 @@ class Atom{ (public) int index; /* set the atom's index */ int offset; // the atom's offset in the storage array + int offsetX, offsetY, offsetZ; char c_name[100]; /* it's name */ + int ident; // it's unique numeric identity. int c_n_hyd; // the number of hydrogens bonded to the atom @@ -118,9 +138,9 @@ class GeneralAtom : public Atom{ (public) int isDirectional( void ){ return 0; } void zeroForces() { - frc[offset] = 0.0; - frc[offset+1] = 0.0; - frc[offset+2] = 0.0; + frc[offsetX] = 0.0; + frc[offsetY] = 0.0; + frc[offsetZ] = 0.0; } }; @@ -161,20 +181,20 @@ class DirectionalAtom : public Atom { (public) void setJy( double the_jy ) { jy = the_jy; } void setJz( double the_jz ) { jz = the_jz; } - void addTx( double the_tx ) { trq[offset] += the_tx;} - void addTy( double the_ty ) { trq[offset+1] += the_ty;} - void addTz( double the_tz ) { trq[offset+2] += the_tz;} + void addTx( double the_tx ) { trq[offsetX] += the_tx;} + void addTy( double the_ty ) { trq[offsetY] += the_ty;} + void addTz( double the_tz ) { trq[offsetZ] += the_tz;} void setMu( double the_mu ) { mu = the_mu; } void zeroForces() { - frc[offset] = 0.0; - frc[offset+1] = 0.0; - frc[offset+2] = 0.0; + frc[offsetX] = 0.0; + frc[offsetY] = 0.0; + frc[offsetZ] = 0.0; - trq[offset] = 0.0; - trq[offset+1] = 0.0; - trq[offset+2] = 0.0; + trq[offsetX] = 0.0; + trq[offsetY] = 0.0; + trq[offsetZ] = 0.0; } double getAxx( void ) { return Axx; } @@ -202,9 +222,9 @@ class DirectionalAtom : public Atom { (public) double getJy( void ) { return jy; } double getJz( void ) { return jz; } - double getTx( void ) { return trq[offset];} - double getTy( void ) { return trq[offset+1]; } - double getTz( void ) { return trq[offset+2]; } + double getTx( void ) { return trq[offsetX];} + double getTy( void ) { return trq[offsetY]; } + double getTz( void ) { return trq[offsetZ]; } double getIxx( void ) { return Ixx; } double getIxy( void ) { return Ixy; }