--- trunk/OOPSE/libmdtools/Atom.hpp 2003/08/07 00:47:33 669 +++ trunk/OOPSE/libmdtools/Atom.hpp 2003/08/07 21:47:18 670 @@ -5,67 +5,31 @@ class Atom{ #include #include +#include "SimState.hpp" + class Atom{ public: - Atom(int theIndex); + Atom(int theIndex, SimState* theConfig ); virtual ~Atom() {} - static double* pos; // the position array - static double* vel; // the velocity array - static double* frc; // the forc array - static double* trq; // the torque vector ( space fixed ) - static double* Amat; // the rotation matrix - static double* mu; // the dipole moment array - static double* ul; // the lab frame unit directional vector - static int nElements; + void setCoords(void); - static void createArrays (int the_nElements); - static void destroyArrays(void); - void addAtoms(int nAdded, double* Apos, double* Avel, double* Afrc, - double* Atrq, double* AAmat, double* Amu, - double* Aul); - void deleteAtom(int theIndex); - void deleteRange(int startIndex, int stopIndex); +// void addAtoms(int nAdded, double* Apos, double* Avel, double* Afrc, +// double* Atrq, double* AAmat, double* Amu, +// double* Aul); +// void deleteAtom(int theIndex); +// void deleteRange(int startIndex, int stopIndex); - static double* getPosArray( void ) { return pos; } - static double* getVelArray( void ) { return vel; } - static double* getFrcArray( void ) { return frc; } - static double* getTrqArray( void ) { return trq; } - static double* getAmatArray( void ) { return Amat; } - static double* getMuArray( void ) { return mu; } - static double* getUlArray( void ) { return ul; } - void getPos( double theP[3] ); void setPos( double theP[3] ); - 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;} - void getVel( double theV[3] ); void setVel( double theV[3] ); - 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;} - - void getFrc( double theF[3] ); void addFrc( double theF[3] ); - 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;} @@ -116,6 +80,16 @@ class Atom{ (protected) protected: + SimState* myConfig; + + double* pos; // the position array + double* vel; // the velocity array + double* frc; // the forc array + double* trq; // the torque vector ( space fixed ) + double* Amat; // the rotation matrix + double* mu; // the array of dipole moments + double* ul; // the lab frame unit directional vector + double c_mass; /* the mass of the atom in amu */ double c_sigma; /* the sigma parameter for van der walls interactions */ double c_epslon; /* the esplon parameter for VDW interactions */ @@ -141,6 +115,8 @@ class Atom{ (protected) int is_LJ; // LJ boolean int is_EAM; //EAM boolean + bool hasCoords; + #ifdef IS_MPI int myGlobalIndex; #endif @@ -150,21 +126,18 @@ class GeneralAtom : public Atom{ (public) class GeneralAtom : public Atom{ public: - GeneralAtom(int theIndex): Atom(theIndex){} + GeneralAtom(int theIndex, SimState* theConfig): Atom(theIndex, theConfig){} virtual ~GeneralAtom(){} int isDirectional( void ){ return 0; } - void zeroForces() { - frc[offsetX] = 0.0; - frc[offsetY] = 0.0; - frc[offsetZ] = 0.0; - } + void zeroForces( void ); }; class DirectionalAtom : public Atom { public: - DirectionalAtom(int theIndex) : Atom(theIndex) + DirectionalAtom(int theIndex, SimState* theConfig) : Atom(theIndex, + theConfig) { ssdIdentity = 0; sux = 0.0; @@ -191,16 +164,8 @@ class DirectionalAtom : public Atom { (public) void setSUy( double the_suy ) { suy = the_suy; } void setSUz( double the_suz ) { suz = the_suz; } - void zeroForces() { - frc[offsetX] = 0.0; - frc[offsetY] = 0.0; - frc[offsetZ] = 0.0; + void zeroForces(); - trq[offsetX] = 0.0; - trq[offsetY] = 0.0; - trq[offsetZ] = 0.0; - } - void getA( double the_A[3][3] ); // get the full rotation matrix void setA( double the_A[3][3] ); @@ -228,10 +193,6 @@ class DirectionalAtom : public Atom { (public) // double getTy( void ) { return trq[offsetY]; } // double getTz( void ) { return trq[offsetZ]; } - 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 setI( double the_I[3][3] ); void getI( double the_I[3][3] ); @@ -246,10 +207,9 @@ class DirectionalAtom : public Atom { (public) double getIzx( void ) { return Izx; } double getIzy( void ) { return Izy; } double getIzz( void ) { return Izz; } - - double getMu( void ) { return mu[index]; } - void setMu( double the_mu ) { mu[index] = the_mu; } + double getMu( void ); + void setMu( double the_mu ); void lab2Body( double r[3] ); void body2Lab( double r[3] );