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

Comparing:
branches/mmeineke/OOPSE/libmdtools/Atom.hpp (file contents), Revision 377 by mmeineke, Fri Mar 21 17:42:12 2003 UTC vs.
trunk/OOPSE/libmdtools/Atom.hpp (file contents), Revision 670 by mmeineke, Thu Aug 7 21:47:18 2003 UTC

# Line 5 | Line 5 | class Atom{
5   #include <cstdlib>
6   #include <iostream>
7  
8 + #include "SimState.hpp"
9 +
10   class Atom{
11   public:
10  Atom(int theIndex) {
11    c_n_hyd = 0;
12    has_dipole = 0;
13    is_VDW = 0;
14    is_LJ = 0;
12  
13 <    index = theIndex;
14 <    offset = 3 * index;
18 <    offsetX = offset;
19 <    offsetY = offset+1;
20 <    offsetZ = offset+2;
13 >  Atom(int theIndex, SimState* theConfig );
14 >  virtual ~Atom() {}
15  
16 <    Axx = index*9;
23 <    Axy = Axx+1;
24 <    Axz = Axx+2;
25 <    
26 <    Ayx = Axx+3;
27 <    Ayy = Axx+4;
28 <    Ayz = Axx+5;
16 >  void setCoords(void);
17  
18 <    Azx = Axx+6;
19 <    Azy = Axx+7;
20 <    Azz = Axx+8;
21 <  }
22 <  virtual ~Atom() {}
18 > //   void addAtoms(int nAdded, double* Apos, double* Avel, double* Afrc,
19 > //                 double* Atrq, double* AAmat, double* Amu,
20 > //                 double* Aul);
21 > //   void deleteAtom(int theIndex);
22 > //   void deleteRange(int startIndex, int stopIndex);
23  
24 <  static void createArrays (int nElements) {
25 <    int i;
38 <    
39 <    pos = new double[nElements*3];
40 <    vel = new double[nElements*3];
41 <    frc = new double[nElements*3];
42 <    trq = new double[nElements*3];
43 <    Amat = new double[nElements*9];
44 <    mu = new double[nElements];
45 <    ul = new double[nElements*3];
24 >  void getPos( double theP[3] );
25 >  void setPos( double theP[3] );
26  
27 <    // init directional values to zero
28 <    
49 <    for( i=0; i<nElements; i++){
50 <      trq[i] = 0.0;
51 <      trq[i+1] = 0.0;
52 <      trq[i+2] = 0.0;
53 <      
54 <      Amat[i] = 1.0;
55 <      Amat[i+1] = 0.0;
56 <      Amat[i+2] = 0.0;
57 <      
58 <      Amat[i+3] = 0.0;
59 <      Amat[i+4] = 1.0;
60 <      Amat[i+5] = 0.0;
61 <      
62 <      Amat[i+6] = 0.0;
63 <      Amat[i+7] = 0.0;
64 <      Amat[i+8] = 1.0;
65 <      
66 <      mu[i] = 0.0;    
67 <      
68 <      ul[i] = 0.0;
69 <      ul[i+1] = 0.0;
70 <      ul[i+2] = 0.0;
71 <    }
72 <  }
73 <  static void destroyArrays(void) {
74 <    delete[] pos;
75 <    delete[] vel;
76 <    delete[] frc;
77 <    delete[] trq;
78 <    delete[] Amat;
79 <    delete[] mu;
80 <  }
27 >  void getVel( double theV[3] );
28 >  void setVel( double theV[3] );
29  
30 <  static double* getPosArray( void ) { return pos; }
31 <  static double* getVelArray( void ) { return vel; }
32 <  static double* getFrcArray( void ) { return frc; }
85 <  static double* getTrqArray( void ) { return trq; }
86 <  static double* getAmatArray( void ) { return Amat; }
87 <  static double* getMuArray( void ) { return mu; }
88 <  static double* getUlArray( void ) { return ul; }
89 <  
90 <  double getX() const {return pos[offsetX];}
91 <  double getY() const {return pos[offsetY];}
92 <  double getZ() const {return pos[offsetZ];}
93 <  void setX(double x) {pos[offsetX] = x;}
94 <  void setY(double y) {pos[offsetY] = y;}
95 <  void setZ(double z) {pos[offsetZ] = z;}
96 <  
97 <  double get_vx() const  {return vel[offsetX];}
98 <  double get_vy() const  {return vel[offsetY];}
99 <  double get_vz() const  {return vel[offsetZ];}
100 <  void set_vx(double vx) {vel[offsetX] = vx;}
101 <  void set_vy(double vy) {vel[offsetY] = vy;}
102 <  void set_vz(double vz) {vel[offsetZ] = vz;}
103 <  
104 <  double getFx() const   {return frc[offsetX];}
105 <  double getFy() const   {return frc[offsetY];}
106 <  double getFz() const   {return frc[offsetZ];}
107 <  void addFx(double add) {frc[offsetX] += add;}
108 <  void addFy(double add) {frc[offsetY] += add;}
109 <  void addFz(double add) {frc[offsetZ] += add;}
30 >  void getFrc( double theF[3] );
31 >  void addFrc( double theF[3] );
32 >
33    virtual void zeroForces() = 0;
34  
35    double getMass() const {return c_mass;}
36    void setMass(double mass) {c_mass = mass;}
37 +
38 +  double getEamRcut() const {return myEamRcut;}
39 +  void setEamRcut(double eamRcut) {myEamRcut = eamRcut;}
40    
41    double getSigma() const {return c_sigma;}
42    void setSigma(double sigma) {c_sigma = sigma;}
# Line 122 | Line 48 | class Atom{ (public)
48    void setCovalent(double covalent) {c_covalent = covalent;}
49    
50    int getIndex() const {return index;}
51 <  void setIndex(int theIndex) {
126 <    index = theIndex;
127 <    offset = index*3;
128 <    offsetX = offset;
129 <    offsetY = offset+1;
130 <    offsetZ = offset+2;
131 <
132 <    Axx = index*9;
133 <    Axy = Axx+1;
134 <    Axz = Axx+2;
135 <    
136 <    Ayx = Axx+3;
137 <    Ayy = Axx+4;
138 <    Ayz = Axx+5;
139 <
140 <    Azx = Axx+6;
141 <    Azy = Axx+7;
142 <    Azz = Axx+8;
143 <  }
144 <
51 >  void setIndex(int theIndex);
52    char *getType() {return c_name;}
53    void setType(char * name) {strcpy(c_name,name);}
54    
# Line 165 | Line 72 | class Atom{ (public)
72    void seVDW( void )        { is_VDW = 1; is_LJ = 0; }
73    int isVDW( void )    { return is_VDW; }
74  
75 +  void setEAM( void ) { is_EAM = 1; }
76 +  int  isEAM( void ) { return is_EAM; }
77 +
78    virtual int isDirectional( void ) = 0;
79  
170  static double* pos; // the position array
171  static double* vel; // the velocity array
172  static double* frc; // the forc array
173  static double* trq; // the torque vector  ( space fixed )
174  static double* Amat; // the rotation matrix
175  static double* mu; // the dipole moment array
176  static double* ul; // the lab frame unit directional vector
80  
81   protected:
82    
83 +  SimState* myConfig;
84 +
85 +  double* pos; // the position array
86 +  double* vel; // the velocity array
87 +  double* frc; // the forc array
88 +  double* trq; // the torque vector  ( space fixed )
89 +  double* Amat; // the rotation matrix
90 +  double* mu;   // the array of dipole moments
91 +  double* ul;   // the lab frame unit directional vector
92 +
93    double c_mass; /* the mass of the atom in amu */
94    double c_sigma; /* the sigma parameter for van der walls interactions */
95    double c_epslon; /* the esplon parameter for VDW interactions */
96    double c_covalent; // The covalent radius of the atom.
97  
98 +  double myEamRcut; // Atom rcut for eam defined by the forcefield.
99 +
100    int index; /* set the atom's index */
101    int offset; // the atom's offset in the storage array
102    int offsetX, offsetY, offsetZ;
# Line 198 | Line 113 | class Atom{ (public)
113    int has_dipole; // dipole boolean
114    int is_VDW;    // VDW boolean
115    int is_LJ;    // LJ boolean
116 +  int is_EAM; //EAM boolean
117  
118 +  bool hasCoords;
119 +
120   #ifdef IS_MPI
121    int myGlobalIndex;
122   #endif
123    
124   };
125  
208
209
126   class GeneralAtom : public Atom{
127  
128   public:
129 <  GeneralAtom(int theIndex): Atom(theIndex){}
129 >  GeneralAtom(int theIndex, SimState* theConfig): Atom(theIndex, theConfig){}
130    virtual ~GeneralAtom(){}
131  
132    int isDirectional( void ){ return 0; }
133 <  void zeroForces() {
218 <    frc[offsetX] = 0.0;
219 <    frc[offsetY] = 0.0;
220 <    frc[offsetZ] = 0.0;
221 <  }
133 >  void zeroForces( void );
134   };
135  
136   class DirectionalAtom : public Atom {
137    
138   public:
139 <  DirectionalAtom(int theIndex) : Atom(theIndex)
139 >  DirectionalAtom(int theIndex, SimState* theConfig) : Atom(theIndex,
140 >                                                            theConfig)
141    {
142      ssdIdentity = 0;
143      sux = 0.0;
# Line 233 | Line 146 | class DirectionalAtom : public Atom { (public)
146    }
147    virtual ~DirectionalAtom() {}
148  
149 +  void printAmatIndex( void );
150 +
151    int isDirectional(void) { return 1; }
152    
153    void setSSD( int value) { ssdIdentity = value; }
154    int isSSD(void) {return ssdIdentity; }
155  
241  void setA( double the_A[3][3] );
242
243  void setI( double the_I[3][3] );
244
245  void setQ( double the_q[4] );
156    
157    void setEuler( double phi, double theta, double psi );
158 +
159 +  double getSUx( void ) { return sux; }
160 +  double getSUy( void ) { return suy; }
161 +  double getSUz( void ) { return suz; }
162    
163    void setSUx( double the_sux ) { sux = the_sux; }
164    void setSUy( double the_suy ) { suy = the_suy; }
165    void setSUz( double the_suz ) { suz = the_suz; }
166  
167 <  void setJx( double the_jx ) { jx = the_jx; }
254 <  void setJy( double the_jy ) { jy = the_jy; }
255 <  void setJz( double the_jz ) { jz = the_jz; }
256 <    
257 <  void addTx( double the_tx ) { trq[offsetX] += the_tx;}
258 <  void addTy( double the_ty ) { trq[offsetY] += the_ty;}
259 <  void addTz( double the_tz ) { trq[offsetZ] += the_tz;}
167 >  void zeroForces();
168  
261  void zeroForces() {
262    frc[offsetX] = 0.0;
263    frc[offsetY] = 0.0;
264    frc[offsetZ] = 0.0;
265
266    trq[offsetX] = 0.0;
267    trq[offsetY] = 0.0;
268    trq[offsetZ] = 0.0;
269  }
270
271  double getAxx( void ) { return Amat[Axx]; }
272  double getAxy( void ) { return Amat[Axy]; }
273  double getAxz( void ) { return Amat[Axz]; }
274  
275  double getAyx( void ) { return Amat[Ayx]; }
276  double getAyy( void ) { return Amat[Ayy]; }
277  double getAyz( void ) { return Amat[Ayz]; }
278  
279  double getAzx( void ) { return Amat[Azx]; }
280  double getAzy( void ) { return Amat[Azy]; }
281  double getAzz( void ) { return Amat[Azz]; }
282
169    void getA( double the_A[3][3] ); // get the full rotation matrix
170 +  void setA( double the_A[3][3] );
171  
285  double getSUx( void ) { return sux; }
286  double getSUy( void ) { return suy; }
287  double getSUz( void ) { return suz; }
288
172    void getU( double the_u[3] ); // get the unit vetor
173 +  void updateU( void );
174 +
175    void getQ( double the_q[4] ); // get the quanternions
176 +  void setQ( double the_q[4] );
177  
178 +  void getJ( double theJ[3] );
179 +  void setJ( double theJ[3] );
180 +
181    double getJx( void ) { return jx; }
182    double getJy( void ) { return jy; }
183    double getJz( void ) { return jz; }
184  
185 <  double getTx( void ) { return trq[offsetX];}
186 <  double getTy( void ) { return trq[offsetY]; }
187 <  double getTz( void ) { return trq[offsetZ]; }
185 >  void setJx( double the_jx ) { jx = the_jx; }
186 >  void setJy( double the_jy ) { jy = the_jy; }
187 >  void setJz( double the_jz ) { jz = the_jz; }
188  
189 +  void getTrq( double theT[3] );
190 +  void addTrq( double theT[3] );
191 +
192 +  //  double getTx( void ) { return trq[offsetX];}
193 +  //  double getTy( void ) { return trq[offsetY]; }
194 +  //  double getTz( void ) { return trq[offsetZ]; }
195 +
196 +  void setI( double the_I[3][3] );
197 +  void getI( double the_I[3][3] );
198 +  
199    double getIxx( void ) { return Ixx; }
200    double getIxy( void ) { return Ixy; }
201    double getIxz( void ) { return Ixz; }
# Line 309 | Line 208 | class DirectionalAtom : public Atom { (public)
208    double getIzy( void ) { return Izy; }
209    double getIzz( void ) { return Izz; }
210  
211 <  double getMu( void ) { return mu[index]; }
212 <  void setMu( double the_mu ) { mu[index] = the_mu; }
211 >  double getMu( void );
212 >  void setMu( double the_mu );
213  
214    void lab2Body( double r[3] );
215    void body2Lab( double r[3] );
317  void updateU( void );
216  
217 +
218   private:
219    int dIndex;
220  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines