| 1 | mmeineke | 377 | #ifndef _ATOM_H_ | 
| 2 |  |  | #define _ATOM_H_ | 
| 3 |  |  |  | 
| 4 | gezelter | 829 | #include <string.h> | 
| 5 |  |  | #include <stdlib.h> | 
| 6 | mmeineke | 377 | #include <iostream> | 
| 7 |  |  |  | 
| 8 | mmeineke | 670 | #include "SimState.hpp" | 
| 9 |  |  |  | 
| 10 | mmeineke | 377 | class Atom{ | 
| 11 |  |  | public: | 
| 12 |  |  |  | 
| 13 | mmeineke | 670 | Atom(int theIndex, SimState* theConfig ); | 
| 14 | gezelter | 409 | virtual ~Atom() {} | 
| 15 | mmeineke | 377 |  | 
| 16 | tim | 689 | virtual void setCoords(void); | 
| 17 | mmeineke | 377 |  | 
| 18 | mmeineke | 599 | void getPos( double theP[3] ); | 
| 19 |  |  | void setPos( double theP[3] ); | 
| 20 |  |  |  | 
| 21 |  |  | void getVel( double theV[3] ); | 
| 22 |  |  | void setVel( double theV[3] ); | 
| 23 |  |  |  | 
| 24 |  |  | void getFrc( double theF[3] ); | 
| 25 |  |  | void addFrc( double theF[3] ); | 
| 26 |  |  |  | 
| 27 | mmeineke | 377 | virtual void zeroForces() = 0; | 
| 28 |  |  |  | 
| 29 |  |  | double getMass() const {return c_mass;} | 
| 30 |  |  | void setMass(double mass) {c_mass = mass;} | 
| 31 | chuckv | 669 |  | 
| 32 |  |  | double getEamRcut() const {return myEamRcut;} | 
| 33 |  |  | void setEamRcut(double eamRcut) {myEamRcut = eamRcut;} | 
| 34 | mmeineke | 377 |  | 
| 35 |  |  | double getSigma() const {return c_sigma;} | 
| 36 |  |  | void setSigma(double sigma) {c_sigma = sigma;} | 
| 37 |  |  |  | 
| 38 |  |  | double getEpslon() const {return c_epslon;} | 
| 39 |  |  | void setEpslon(double epslon) {c_epslon = epslon;} | 
| 40 |  |  |  | 
| 41 |  |  | double getCovalent() const {return c_covalent;} | 
| 42 |  |  | void setCovalent(double covalent) {c_covalent = covalent;} | 
| 43 |  |  |  | 
| 44 |  |  | int getIndex() const {return index;} | 
| 45 | gezelter | 409 | void setIndex(int theIndex); | 
| 46 | mmeineke | 377 | char *getType() {return c_name;} | 
| 47 |  |  | void setType(char * name) {strcpy(c_name,name);} | 
| 48 |  |  |  | 
| 49 |  |  | int getIdent( void ) { return ident; } | 
| 50 |  |  | void setIdent( int info ) { ident = info; } | 
| 51 |  |  |  | 
| 52 |  |  | #ifdef IS_MPI | 
| 53 |  |  | int getGlobalIndex( void ) { return myGlobalIndex; } | 
| 54 |  |  | void setGlobalIndex( int info ) { myGlobalIndex = info; } | 
| 55 |  |  | #endif // is_mpi | 
| 56 |  |  |  | 
| 57 |  |  | void set_n_hydrogens( int n_h ) {c_n_hyd = n_h;} | 
| 58 |  |  | int get_n_hydrogens() const {return c_n_hyd;} | 
| 59 |  |  |  | 
| 60 |  |  | void setHasDipole( int value ) { has_dipole = value; } | 
| 61 |  |  | int hasDipole( void ) { return has_dipole; } | 
| 62 |  |  |  | 
| 63 |  |  | void setLJ( void )        { is_LJ = 1; is_VDW = 0; } | 
| 64 |  |  | int isLJ( void )    { return is_LJ; } | 
| 65 |  |  |  | 
| 66 |  |  | void seVDW( void )        { is_VDW = 1; is_LJ = 0; } | 
| 67 |  |  | int isVDW( void )    { return is_VDW; } | 
| 68 |  |  |  | 
| 69 | chuckv | 631 | void setEAM( void ) { is_EAM = 1; } | 
| 70 |  |  | int  isEAM( void ) { return is_EAM; } | 
| 71 |  |  |  | 
| 72 | mmeineke | 377 | virtual int isDirectional( void ) = 0; | 
| 73 |  |  |  | 
| 74 |  |  |  | 
| 75 |  |  | protected: | 
| 76 |  |  |  | 
| 77 | mmeineke | 670 | SimState* myConfig; | 
| 78 |  |  |  | 
| 79 |  |  | double* pos; // the position array | 
| 80 |  |  | double* vel; // the velocity array | 
| 81 |  |  | double* frc; // the forc array | 
| 82 |  |  | double* trq; // the torque vector  ( space fixed ) | 
| 83 |  |  | double* Amat; // the rotation matrix | 
| 84 |  |  | double* mu;   // the array of dipole moments | 
| 85 |  |  | double* ul;   // the lab frame unit directional vector | 
| 86 |  |  |  | 
| 87 | mmeineke | 377 | double c_mass; /* the mass of the atom in amu */ | 
| 88 |  |  | double c_sigma; /* the sigma parameter for van der walls interactions */ | 
| 89 |  |  | double c_epslon; /* the esplon parameter for VDW interactions */ | 
| 90 |  |  | double c_covalent; // The covalent radius of the atom. | 
| 91 |  |  |  | 
| 92 | chuckv | 669 | double myEamRcut; // Atom rcut for eam defined by the forcefield. | 
| 93 |  |  |  | 
| 94 | mmeineke | 377 | int index; /* set the atom's index */ | 
| 95 |  |  | int offset; // the atom's offset in the storage array | 
| 96 |  |  | int offsetX, offsetY, offsetZ; | 
| 97 |  |  |  | 
| 98 |  |  | int Axx, Axy, Axz; // the rotational matrix indices | 
| 99 |  |  | int Ayx, Ayy, Ayz; | 
| 100 |  |  | int Azx, Azy, Azz; | 
| 101 |  |  |  | 
| 102 |  |  | char c_name[100]; /* it's name */ | 
| 103 |  |  | int ident;  // it's unique numeric identity. | 
| 104 |  |  |  | 
| 105 |  |  | int c_n_hyd; // the number of hydrogens bonded to the atom | 
| 106 |  |  |  | 
| 107 |  |  | int has_dipole; // dipole boolean | 
| 108 |  |  | int is_VDW;    // VDW boolean | 
| 109 |  |  | int is_LJ;    // LJ boolean | 
| 110 | chuckv | 631 | int is_EAM; //EAM boolean | 
| 111 | mmeineke | 377 |  | 
| 112 | mmeineke | 670 | bool hasCoords; | 
| 113 |  |  |  | 
| 114 | mmeineke | 377 | #ifdef IS_MPI | 
| 115 |  |  | int myGlobalIndex; | 
| 116 |  |  | #endif | 
| 117 |  |  |  | 
| 118 |  |  | }; | 
| 119 |  |  |  | 
| 120 |  |  | class GeneralAtom : public Atom{ | 
| 121 |  |  |  | 
| 122 |  |  | public: | 
| 123 | mmeineke | 670 | GeneralAtom(int theIndex, SimState* theConfig): Atom(theIndex, theConfig){} | 
| 124 | mmeineke | 377 | virtual ~GeneralAtom(){} | 
| 125 |  |  |  | 
| 126 |  |  | int isDirectional( void ){ return 0; } | 
| 127 | mmeineke | 670 | void zeroForces( void ); | 
| 128 | mmeineke | 377 | }; | 
| 129 |  |  |  | 
| 130 |  |  | class DirectionalAtom : public Atom { | 
| 131 |  |  |  | 
| 132 |  |  | public: | 
| 133 | mmeineke | 670 | DirectionalAtom(int theIndex, SimState* theConfig) : Atom(theIndex, | 
| 134 |  |  | theConfig) | 
| 135 | mmeineke | 377 | { | 
| 136 |  |  | ssdIdentity = 0; | 
| 137 |  |  | sux = 0.0; | 
| 138 |  |  | suy = 0.0; | 
| 139 |  |  | suz = 0.0; | 
| 140 | tim | 689 | myMu = 0.0; | 
| 141 | mmeineke | 377 | } | 
| 142 |  |  | virtual ~DirectionalAtom() {} | 
| 143 |  |  |  | 
| 144 | tim | 689 | virtual void setCoords(void); | 
| 145 |  |  |  | 
| 146 | mmeineke | 597 | void printAmatIndex( void ); | 
| 147 |  |  |  | 
| 148 | mmeineke | 377 | int isDirectional(void) { return 1; } | 
| 149 |  |  |  | 
| 150 |  |  | void setSSD( int value) { ssdIdentity = value; } | 
| 151 |  |  | int isSSD(void) {return ssdIdentity; } | 
| 152 |  |  |  | 
| 153 |  |  |  | 
| 154 |  |  | void setEuler( double phi, double theta, double psi ); | 
| 155 | mmeineke | 599 |  | 
| 156 |  |  | double getSUx( void ) { return sux; } | 
| 157 |  |  | double getSUy( void ) { return suy; } | 
| 158 |  |  | double getSUz( void ) { return suz; } | 
| 159 | mmeineke | 377 |  | 
| 160 |  |  | void setSUx( double the_sux ) { sux = the_sux; } | 
| 161 |  |  | void setSUy( double the_suy ) { suy = the_suy; } | 
| 162 |  |  | void setSUz( double the_suz ) { suz = the_suz; } | 
| 163 |  |  |  | 
| 164 | mmeineke | 670 | void zeroForces(); | 
| 165 | mmeineke | 377 |  | 
| 166 |  |  | void getA( double the_A[3][3] ); // get the full rotation matrix | 
| 167 | mmeineke | 599 | void setA( double the_A[3][3] ); | 
| 168 | mmeineke | 377 |  | 
| 169 | mmeineke | 599 | void getU( double the_u[3] ); // get the unit vetor | 
| 170 |  |  | void updateU( void ); | 
| 171 | mmeineke | 377 |  | 
| 172 |  |  | void getQ( double the_q[4] ); // get the quanternions | 
| 173 | mmeineke | 599 | void setQ( double the_q[4] ); | 
| 174 | mmeineke | 377 |  | 
| 175 | mmeineke | 599 | void getJ( double theJ[3] ); | 
| 176 |  |  | void setJ( double theJ[3] ); | 
| 177 |  |  |  | 
| 178 | mmeineke | 377 | double getJx( void ) { return jx; } | 
| 179 |  |  | double getJy( void ) { return jy; } | 
| 180 |  |  | double getJz( void ) { return jz; } | 
| 181 |  |  |  | 
| 182 | mmeineke | 599 | void setJx( double the_jx ) { jx = the_jx; } | 
| 183 |  |  | void setJy( double the_jy ) { jy = the_jy; } | 
| 184 |  |  | void setJz( double the_jz ) { jz = the_jz; } | 
| 185 |  |  |  | 
| 186 |  |  | void getTrq( double theT[3] ); | 
| 187 |  |  | void addTrq( double theT[3] ); | 
| 188 |  |  |  | 
| 189 | gezelter | 611 | //  double getTx( void ) { return trq[offsetX];} | 
| 190 |  |  | //  double getTy( void ) { return trq[offsetY]; } | 
| 191 |  |  | //  double getTz( void ) { return trq[offsetZ]; } | 
| 192 | mmeineke | 377 |  | 
| 193 | mmeineke | 599 | void setI( double the_I[3][3] ); | 
| 194 |  |  | void getI( double the_I[3][3] ); | 
| 195 |  |  |  | 
| 196 | mmeineke | 377 | double getIxx( void ) { return Ixx; } | 
| 197 |  |  | double getIxy( void ) { return Ixy; } | 
| 198 |  |  | double getIxz( void ) { return Ixz; } | 
| 199 |  |  |  | 
| 200 |  |  | double getIyx( void ) { return Iyx; } | 
| 201 |  |  | double getIyy( void ) { return Iyy; } | 
| 202 |  |  | double getIyz( void ) { return Iyz; } | 
| 203 |  |  |  | 
| 204 |  |  | double getIzx( void ) { return Izx; } | 
| 205 |  |  | double getIzy( void ) { return Izy; } | 
| 206 |  |  | double getIzz( void ) { return Izz; } | 
| 207 |  |  |  | 
| 208 | mmeineke | 670 | double getMu( void ); | 
| 209 |  |  | void setMu( double the_mu ); | 
| 210 | mmeineke | 377 |  | 
| 211 |  |  | void lab2Body( double r[3] ); | 
| 212 |  |  | void body2Lab( double r[3] ); | 
| 213 |  |  |  | 
| 214 | mmeineke | 599 |  | 
| 215 | mmeineke | 377 | private: | 
| 216 |  |  | int dIndex; | 
| 217 |  |  |  | 
| 218 | tim | 689 | double myMu; | 
| 219 |  |  |  | 
| 220 | mmeineke | 377 | double sux, suy, suz; // the standard unit vector    ( body fixed ) | 
| 221 |  |  | double jx, jy, jz;    // the angular momentum vector ( body fixed ) | 
| 222 |  |  |  | 
| 223 |  |  | double Ixx, Ixy, Ixz; // the inertial tensor matrix  ( body fixed ) | 
| 224 |  |  | double Iyx, Iyy, Iyz; | 
| 225 |  |  | double Izx, Izy, Izz; | 
| 226 |  |  |  | 
| 227 |  |  | int ssdIdentity; // boolean of whether atom is ssd | 
| 228 |  |  |  | 
| 229 |  |  | }; | 
| 230 |  |  |  | 
| 231 |  |  | #endif |