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 378 by mmeineke, Fri Mar 21 17:42:12 2003 UTC vs.
Revision 631 by chuckv, Thu Jul 17 19:25:51 2003 UTC

# Line 7 | Line 7 | class Atom{ (public)
7  
8   class Atom{
9   public:
10  Atom(int theIndex) {
11    c_n_hyd = 0;
12    has_dipole = 0;
13    is_VDW = 0;
14    is_LJ = 0;
10  
11 <    index = theIndex;
12 <    offset = 3 * index;
18 <    offsetX = offset;
19 <    offsetY = offset+1;
20 <    offsetZ = offset+2;
11 >  Atom(int theIndex);
12 >  virtual ~Atom() {}
13  
14 <    Axx = index*9;
15 <    Axy = Axx+1;
16 <    Axz = Axx+2;
17 <    
18 <    Ayx = Axx+3;
19 <    Ayy = Axx+4;
20 <    Ayz = Axx+5;
14 >  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;
22  
23 <    Azx = Axx+6;
24 <    Azy = Axx+7;
25 <    Azz = Axx+8;
26 <  }
27 <  virtual ~Atom() {}
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  
36  static void createArrays (int nElements) {
37    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];
46
47    // init directional values to zero
48    
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  }
81
31    static double* getPosArray( void ) { return pos; }
32    static double* getVelArray( void ) { return vel; }
33    static double* getFrcArray( void ) { return frc; }
# Line 87 | Line 36 | class Atom{ (public)
36    static double* getMuArray( void ) { return mu; }
37    static double* getUlArray( void ) { return ul; }
38    
39 +  void getPos( double theP[3] );
40 +  void setPos( double theP[3] );
41 +
42    double getX() const {return pos[offsetX];}
43    double getY() const {return pos[offsetY];}
44    double getZ() const {return pos[offsetZ];}
# Line 94 | Line 46 | class Atom{ (public)
46    void setY(double y) {pos[offsetY] = y;}
47    void setZ(double z) {pos[offsetZ] = z;}
48    
49 +  void getVel( double theV[3] );
50 +  void setVel( double theV[3] );
51 +
52    double get_vx() const  {return vel[offsetX];}
53    double get_vy() const  {return vel[offsetY];}
54    double get_vz() const  {return vel[offsetZ];}
# Line 101 | Line 56 | class Atom{ (public)
56    void set_vy(double vy) {vel[offsetY] = vy;}
57    void set_vz(double vz) {vel[offsetZ] = vz;}
58    
59 +
60 +  void getFrc( double theF[3] );
61 +  void addFrc( double theF[3] );
62 +
63    double getFx() const   {return frc[offsetX];}
64    double getFy() const   {return frc[offsetY];}
65    double getFz() const   {return frc[offsetZ];}
# Line 122 | Line 81 | class Atom{ (public)
81    void setCovalent(double covalent) {c_covalent = covalent;}
82    
83    int getIndex() const {return index;}
84 <  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 <
84 >  void setIndex(int theIndex);
85    char *getType() {return c_name;}
86    void setType(char * name) {strcpy(c_name,name);}
87    
# Line 165 | Line 105 | class Atom{ (public)
105    void seVDW( void )        { is_VDW = 1; is_LJ = 0; }
106    int isVDW( void )    { return is_VDW; }
107  
108 +  void setEAM( void ) { is_EAM = 1; }
109 +  int  isEAM( void ) { return is_EAM; }
110 +
111    virtual int isDirectional( void ) = 0;
112  
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
113  
114   protected:
115    
# Line 198 | Line 134 | class Atom{ (public)
134    int has_dipole; // dipole boolean
135    int is_VDW;    // VDW boolean
136    int is_LJ;    // LJ boolean
137 +  int is_EAM; //EAM boolean
138  
139   #ifdef IS_MPI
140    int myGlobalIndex;
# Line 205 | Line 142 | class Atom{ (public)
142    
143   };
144  
208
209
145   class GeneralAtom : public Atom{
146  
147   public:
# Line 233 | Line 168 | class DirectionalAtom : public Atom { (public)
168    }
169    virtual ~DirectionalAtom() {}
170  
171 +  void printAmatIndex( void );
172 +
173    int isDirectional(void) { return 1; }
174    
175    void setSSD( int value) { ssdIdentity = value; }
176    int isSSD(void) {return ssdIdentity; }
177  
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] );
178    
179    void setEuler( double phi, double theta, double psi );
180 +
181 +  double getSUx( void ) { return sux; }
182 +  double getSUy( void ) { return suy; }
183 +  double getSUz( void ) { return suz; }
184    
185    void setSUx( double the_sux ) { sux = the_sux; }
186    void setSUy( double the_suy ) { suy = the_suy; }
187    void setSUz( double the_suz ) { suz = the_suz; }
188  
253  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;}
260
189    void zeroForces() {
190      frc[offsetX] = 0.0;
191      frc[offsetY] = 0.0;
# Line 268 | Line 196 | class DirectionalAtom : public Atom { (public)
196      trq[offsetZ] = 0.0;
197    }
198  
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
199    void getA( double the_A[3][3] ); // get the full rotation matrix
200 +  void setA( double the_A[3][3] );
201  
285  double getSUx( void ) { return sux; }
286  double getSUy( void ) { return suy; }
287  double getSUz( void ) { return suz; }
288
202    void getU( double the_u[3] ); // get the unit vetor
203 +  void updateU( void );
204 +
205    void getQ( double the_q[4] ); // get the quanternions
206 +  void setQ( double the_q[4] );
207  
208 +  void getJ( double theJ[3] );
209 +  void setJ( double theJ[3] );
210 +
211    double getJx( void ) { return jx; }
212    double getJy( void ) { return jy; }
213    double getJz( void ) { return jz; }
214  
215 <  double getTx( void ) { return trq[offsetX];}
216 <  double getTy( void ) { return trq[offsetY]; }
217 <  double getTz( void ) { return trq[offsetZ]; }
215 >  void setJx( double the_jx ) { jx = the_jx; }
216 >  void setJy( double the_jy ) { jy = the_jy; }
217 >  void setJz( double the_jz ) { jz = the_jz; }
218  
219 +  void getTrq( double theT[3] );
220 +  void addTrq( double theT[3] );
221 +
222 +  //  double getTx( void ) { return trq[offsetX];}
223 +  //  double getTy( void ) { return trq[offsetY]; }
224 +  //  double getTz( void ) { return trq[offsetZ]; }
225 +
226 +  void addTx( double the_tx ) { trq[offsetX] += the_tx;}
227 +  void addTy( double the_ty ) { trq[offsetY] += the_ty;}
228 +  void addTz( double the_tz ) { trq[offsetZ] += the_tz;}
229 +
230 +  void setI( double the_I[3][3] );
231 +  void getI( double the_I[3][3] );
232 +  
233    double getIxx( void ) { return Ixx; }
234    double getIxy( void ) { return Ixy; }
235    double getIxz( void ) { return Ixz; }
# Line 308 | Line 241 | class DirectionalAtom : public Atom { (public)
241    double getIzx( void ) { return Izx; }
242    double getIzy( void ) { return Izy; }
243    double getIzz( void ) { return Izz; }
244 +  
245  
246    double getMu( void ) { return mu[index]; }
247    void setMu( double the_mu ) { mu[index] = the_mu; }
248  
249    void lab2Body( double r[3] );
250    void body2Lab( double r[3] );
317  void updateU( void );
251  
252 +
253   private:
254    int dIndex;
255  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines