ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/Atom.hpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/Atom.hpp (file contents):
Revision 669 by chuckv, Thu Aug 7 00:47:33 2003 UTC vs.
Revision 1113 by tim, Thu Apr 15 16:18:26 2004 UTC

# Line 1 | Line 1
1   #ifndef _ATOM_H_
2   #define _ATOM_H_
3  
4 < #include <cstring>
5 < #include <cstdlib>
4 > #include <string.h>
5 > #include <stdlib.h>
6   #include <iostream>
7  
8 < class Atom{
8 > #include "SimState.hpp"
9 > #include "StuntDouble.hpp"
10 >
11 > class Atom : public StuntDouble {
12   public:
13  
14 <  Atom(int theIndex);
14 >  Atom(int theIndex, SimState* theConfig );
15    virtual ~Atom() {}
16  
17 <  static double* pos; // the position array
15 <  static double* vel; // the velocity array
16 <  static double* frc; // the forc array
17 <  static double* trq; // the torque vector  ( space fixed )
18 <  static double* Amat; // the rotation matrix
19 <  static double* mu; // the dipole moment array
20 <  static double* ul; // the lab frame unit directional vector
21 <  static int nElements;
17 >  virtual void setCoords(void);
18  
23  static void createArrays (int the_nElements);
24  static void destroyArrays(void);
25  void addAtoms(int nAdded, double* Apos, double* Avel, double* Afrc,
26                double* Atrq, double* AAmat, double* Amu,
27                double* Aul);
28  void deleteAtom(int theIndex);
29  void deleteRange(int startIndex, int stopIndex);
30
31  static double* getPosArray( void ) { return pos; }
32  static double* getVelArray( void ) { return vel; }
33  static double* getFrcArray( void ) { return frc; }
34  static double* getTrqArray( void ) { return trq; }
35  static double* getAmatArray( void ) { return Amat; }
36  static double* getMuArray( void ) { return mu; }
37  static double* getUlArray( void ) { return ul; }
38  
19    void getPos( double theP[3] );
20    void setPos( double theP[3] );
21  
42  double getX() const {return pos[offsetX];}
43  double getY() const {return pos[offsetY];}
44  double getZ() const {return pos[offsetZ];}
45  void setX(double x) {pos[offsetX] = x;}
46  void setY(double y) {pos[offsetY] = y;}
47  void setZ(double z) {pos[offsetZ] = z;}
48  
22    void getVel( double theV[3] );
23    void setVel( double theV[3] );
24  
52  double get_vx() const  {return vel[offsetX];}
53  double get_vy() const  {return vel[offsetY];}
54  double get_vz() const  {return vel[offsetZ];}
55  void set_vx(double vx) {vel[offsetX] = vx;}
56  void set_vy(double vy) {vel[offsetY] = vy;}
57  void set_vz(double vz) {vel[offsetZ] = vz;}
58  
59
25    void getFrc( double theF[3] );
26    void addFrc( double theF[3] );
27  
28 <  double getFx() const   {return frc[offsetX];}
64 <  double getFy() const   {return frc[offsetY];}
65 <  double getFz() const   {return frc[offsetZ];}
66 <  void addFx(double add) {frc[offsetX] += add;}
67 <  void addFy(double add) {frc[offsetY] += add;}
68 <  void addFz(double add) {frc[offsetZ] += add;}
69 <  virtual void zeroForces() = 0;
28 >  virtual void zeroForces();
29  
30 <  double getMass() const {return c_mass;}
30 >  double getMass() {return c_mass;}
31    void setMass(double mass) {c_mass = mass;}
73
74  double getEamRcut() const {return myEamRcut;}
75  void setEamRcut(double eamRcut) {myEamRcut = eamRcut;}
32    
77  double getSigma() const {return c_sigma;}
78  void setSigma(double sigma) {c_sigma = sigma;}
79
80  double getEpslon() const {return c_epslon;}
81  void setEpslon(double epslon) {c_epslon = epslon;}
82  
83  double getCovalent() const {return c_covalent;}
84  void setCovalent(double covalent) {c_covalent = covalent;}
85  
33    int getIndex() const {return index;}
34    void setIndex(int theIndex);
35 +
36    char *getType() {return c_name;}
37    void setType(char * name) {strcpy(c_name,name);}
38    
# Line 96 | Line 44 | class Atom{ (public)
44    void setGlobalIndex( int info ) { myGlobalIndex = info; }
45   #endif // is_mpi
46  
99  void set_n_hydrogens( int n_h ) {c_n_hyd = n_h;}
100  int get_n_hydrogens() const {return c_n_hyd;}
101
47    void setHasDipole( int value ) { has_dipole = value; }
48    int hasDipole( void ) { return has_dipole; }
49  
50 <  void setLJ( void )        { is_LJ = 1; is_VDW = 0; }
51 <  int isLJ( void )    { return is_LJ; }
50 >  void setHasCharge(int value) {has_charge = value;}
51 >  int hasCharge(void) {return has_charge;}
52  
108  void seVDW( void )        { is_VDW = 1; is_LJ = 0; }
109  int isVDW( void )    { return is_VDW; }
110
111  void setEAM( void ) { is_EAM = 1; }
112  int  isEAM( void ) { return is_EAM; }
113
114  virtual int isDirectional( void ) = 0;
115
116
53   protected:
54    
55 <  double c_mass; /* the mass of the atom in amu */
120 <  double c_sigma; /* the sigma parameter for van der walls interactions */
121 <  double c_epslon; /* the esplon parameter for VDW interactions */
122 <  double c_covalent; // The covalent radius of the atom.
55 >  SimState* myConfig;
56  
57 <  double myEamRcut; // Atom rcut for eam defined by the forcefield.
57 >  double* pos; // the position array
58 >  double* vel; // the velocity array
59 >  double* frc; // the forc array
60 >  double* trq; // the torque vector  ( space fixed )
61 >  double* Amat; // the rotation matrix
62 >  double* mu;   // the array of dipole moments
63 >  double* ul;   // the lab frame unit directional vector
64  
65 +  double c_mass; /* the mass of the atom in amu */
66 +
67    int index; /* set the atom's index */
68    int offset; // the atom's offset in the storage array
69    int offsetX, offsetY, offsetZ;
# Line 133 | Line 74 | class Atom{ (public)
74  
75    char c_name[100]; /* it's name */
76    int ident;  // it's unique numeric identity.
136
137  int c_n_hyd; // the number of hydrogens bonded to the atom
77    
78    int has_dipole; // dipole boolean
79 <  int is_VDW;    // VDW boolean
141 <  int is_LJ;    // LJ boolean
142 <  int is_EAM; //EAM boolean
79 >  int has_charge; // charge boolean
80  
81 +  bool hasCoords;
82 +
83   #ifdef IS_MPI
84    int myGlobalIndex;
85   #endif
86    
87   };
88  
150 class GeneralAtom : public Atom{
151
152 public:
153  GeneralAtom(int theIndex): Atom(theIndex){}
154  virtual ~GeneralAtom(){}
155
156  int isDirectional( void ){ return 0; }
157  void zeroForces() {
158    frc[offsetX] = 0.0;
159    frc[offsetY] = 0.0;
160    frc[offsetZ] = 0.0;
161  }
162 };
163
164 class DirectionalAtom : public Atom {
165  
166 public:
167  DirectionalAtom(int theIndex) : Atom(theIndex)
168  {
169    ssdIdentity = 0;
170    sux = 0.0;
171    suy = 0.0;
172    suz = 0.0;
173  }
174  virtual ~DirectionalAtom() {}
175
176  void printAmatIndex( void );
177
178  int isDirectional(void) { return 1; }
179  
180  void setSSD( int value) { ssdIdentity = value; }
181  int isSSD(void) {return ssdIdentity; }
182
183  
184  void setEuler( double phi, double theta, double psi );
185
186  double getSUx( void ) { return sux; }
187  double getSUy( void ) { return suy; }
188  double getSUz( void ) { return suz; }
189  
190  void setSUx( double the_sux ) { sux = the_sux; }
191  void setSUy( double the_suy ) { suy = the_suy; }
192  void setSUz( double the_suz ) { suz = the_suz; }
193
194  void zeroForces() {
195    frc[offsetX] = 0.0;
196    frc[offsetY] = 0.0;
197    frc[offsetZ] = 0.0;
198
199    trq[offsetX] = 0.0;
200    trq[offsetY] = 0.0;
201    trq[offsetZ] = 0.0;
202  }
203
204  void getA( double the_A[3][3] ); // get the full rotation matrix
205  void setA( double the_A[3][3] );
206
207  void getU( double the_u[3] ); // get the unit vetor
208  void updateU( void );
209
210  void getQ( double the_q[4] ); // get the quanternions
211  void setQ( double the_q[4] );
212
213  void getJ( double theJ[3] );
214  void setJ( double theJ[3] );
215
216  double getJx( void ) { return jx; }
217  double getJy( void ) { return jy; }
218  double getJz( void ) { return jz; }
219
220  void setJx( double the_jx ) { jx = the_jx; }
221  void setJy( double the_jy ) { jy = the_jy; }
222  void setJz( double the_jz ) { jz = the_jz; }
223
224  void getTrq( double theT[3] );
225  void addTrq( double theT[3] );
226
227  //  double getTx( void ) { return trq[offsetX];}
228  //  double getTy( void ) { return trq[offsetY]; }
229  //  double getTz( void ) { return trq[offsetZ]; }
230
231  void addTx( double the_tx ) { trq[offsetX] += the_tx;}
232  void addTy( double the_ty ) { trq[offsetY] += the_ty;}
233  void addTz( double the_tz ) { trq[offsetZ] += the_tz;}
234
235  void setI( double the_I[3][3] );
236  void getI( double the_I[3][3] );
237  
238  double getIxx( void ) { return Ixx; }
239  double getIxy( void ) { return Ixy; }
240  double getIxz( void ) { return Ixz; }
241  
242  double getIyx( void ) { return Iyx; }
243  double getIyy( void ) { return Iyy; }
244  double getIyz( void ) { return Iyz; }
245  
246  double getIzx( void ) { return Izx; }
247  double getIzy( void ) { return Izy; }
248  double getIzz( void ) { return Izz; }
249  
250
251  double getMu( void ) { return mu[index]; }
252  void setMu( double the_mu ) { mu[index] = the_mu; }
253
254  void lab2Body( double r[3] );
255  void body2Lab( double r[3] );
256
257
258 private:
259  int dIndex;
260
261  double sux, suy, suz; // the standard unit vector    ( body fixed )
262  double jx, jy, jz;    // the angular momentum vector ( body fixed )
263  
264  double Ixx, Ixy, Ixz; // the inertial tensor matrix  ( body fixed )
265  double Iyx, Iyy, Iyz;
266  double Izx, Izy, Izz;
267
268  int ssdIdentity; // boolean of whether atom is ssd
269
270 };
271
89   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines