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 599 by mmeineke, Mon Jul 14 21:48:43 2003 UTC vs.
Revision 999 by chrisfen, Fri Jan 30 15:01:09 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 + #include "SimState.hpp"
9 +
10   class Atom{
11   public:
12  
13 <  Atom(int theIndex);
13 >  Atom(int theIndex, SimState* theConfig );
14    virtual ~Atom() {}
15  
16 <  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;
16 >  virtual void setCoords(void);
17  
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  
18    void getPos( double theP[3] );
19    void setPos( double theP[3] );
20  
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  
21    void getVel( double theV[3] );
22    void setVel( double theV[3] );
23  
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
24    void getFrc( double theF[3] );
25    void addFrc( double theF[3] );
26  
63  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;}
27    virtual void zeroForces() = 0;
28  
29    double getMass() const {return c_mass;}
30    void setMass(double mass) {c_mass = mass;}
31 +
32 +  double getEamRcut() const {return myEamRcut;}
33 +  void setEamRcut(double eamRcut) {myEamRcut = eamRcut;}
34    
35    double getSigma() const {return c_sigma;}
36    void setSigma(double sigma) {c_sigma = sigma;}
# Line 102 | Line 63 | class Atom{ (public)
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; }
66 >  void setVDW( void )        { is_VDW = 1; is_LJ = 0; }
67    int isVDW( void )    { return is_VDW; }
68  
69 +  void setEAM( void ) { is_EAM = 1; }
70 +  int  isEAM( void ) { return is_EAM; }
71 +
72 +  void setCharged( void ) { is_charged = 1; }
73 +  int isCharged( void ) { return is_charged; }
74 +
75    virtual int isDirectional( void ) = 0;
76  
77  
78   protected:
79    
80 +  SimState* myConfig;
81 +
82 +  double* pos; // the position array
83 +  double* vel; // the velocity array
84 +  double* frc; // the forc array
85 +  double* trq; // the torque vector  ( space fixed )
86 +  double* Amat; // the rotation matrix
87 +  double* mu;   // the array of dipole moments
88 +  double* ul;   // the lab frame unit directional vector
89 +
90    double c_mass; /* the mass of the atom in amu */
91    double c_sigma; /* the sigma parameter for van der walls interactions */
92    double c_epslon; /* the esplon parameter for VDW interactions */
93    double c_covalent; // The covalent radius of the atom.
94  
95 +  double myEamRcut; // Atom rcut for eam defined by the forcefield.
96 +
97    int index; /* set the atom's index */
98    int offset; // the atom's offset in the storage array
99    int offsetX, offsetY, offsetZ;
# Line 129 | Line 108 | class Atom{ (public)
108    int c_n_hyd; // the number of hydrogens bonded to the atom
109    
110    int has_dipole; // dipole boolean
111 <  int is_VDW;    // VDW boolean
112 <  int is_LJ;    // LJ boolean
111 >  int is_VDW;     // VDW boolean
112 >  int is_LJ;      // LJ boolean
113 >  int is_EAM;     // EAM boolean
114 >  int is_charged;   // isCharge boolean
115  
116 +  bool hasCoords;
117 +
118   #ifdef IS_MPI
119    int myGlobalIndex;
120   #endif
# Line 141 | Line 124 | class GeneralAtom : public Atom{ (public)
124   class GeneralAtom : public Atom{
125  
126   public:
127 <  GeneralAtom(int theIndex): Atom(theIndex){}
127 >  GeneralAtom(int theIndex, SimState* theConfig): Atom(theIndex, theConfig){}
128    virtual ~GeneralAtom(){}
129  
130    int isDirectional( void ){ return 0; }
131 <  void zeroForces() {
149 <    frc[offsetX] = 0.0;
150 <    frc[offsetY] = 0.0;
151 <    frc[offsetZ] = 0.0;
152 <  }
131 >  void zeroForces( void );
132   };
133  
134   class DirectionalAtom : public Atom {
135    
136   public:
137 <  DirectionalAtom(int theIndex) : Atom(theIndex)
137 >  DirectionalAtom(int theIndex, SimState* theConfig) : Atom(theIndex,
138 >                                                            theConfig)
139    {
140      ssdIdentity = 0;
141      sux = 0.0;
142      suy = 0.0;
143      suz = 0.0;
144 +    myMu = 0.0;
145    }
146    virtual ~DirectionalAtom() {}
147  
148 +  virtual void setCoords(void);
149 +
150    void printAmatIndex( void );
151  
152    int isDirectional(void) { return 1; }
# Line 182 | Line 165 | class DirectionalAtom : public Atom { (public)
165    void setSUy( double the_suy ) { suy = the_suy; }
166    void setSUz( double the_suz ) { suz = the_suz; }
167  
168 <  void zeroForces() {
186 <    frc[offsetX] = 0.0;
187 <    frc[offsetY] = 0.0;
188 <    frc[offsetZ] = 0.0;
168 >  void zeroForces();
169  
190    trq[offsetX] = 0.0;
191    trq[offsetY] = 0.0;
192    trq[offsetZ] = 0.0;
193  }
194
170    void getA( double the_A[3][3] ); // get the full rotation matrix
171    void setA( double the_A[3][3] );
172  
# Line 215 | Line 190 | class DirectionalAtom : public Atom { (public)
190    void getTrq( double theT[3] );
191    void addTrq( double theT[3] );
192  
193 <  double getTx( void ) { return trq[offsetX];}
194 <  double getTy( void ) { return trq[offsetY]; }
195 <  double getTz( void ) { return trq[offsetZ]; }
193 >  //  double getTx( void ) { return trq[offsetX];}
194 >  //  double getTy( void ) { return trq[offsetY]; }
195 >  //  double getTz( void ) { return trq[offsetZ]; }
196  
222  void addTx( double the_tx ) { trq[offsetX] += the_tx;}
223  void addTy( double the_ty ) { trq[offsetY] += the_ty;}
224  void addTz( double the_tz ) { trq[offsetZ] += the_tz;}
225
197    void setI( double the_I[3][3] );
198    void getI( double the_I[3][3] );
199    
# Line 237 | Line 208 | class DirectionalAtom : public Atom { (public)
208    double getIzx( void ) { return Izx; }
209    double getIzy( void ) { return Izy; }
210    double getIzz( void ) { return Izz; }
240  
211  
212 <  double getMu( void ) { return mu[index]; }
213 <  void setMu( double the_mu ) { mu[index] = the_mu; }
212 >  double getMu( void );
213 >  void setMu( double the_mu );
214  
215    void lab2Body( double r[3] );
216    void body2Lab( double r[3] );
217  
218  
219 +  // Four functions added for derivatives with respect to Euler Angles:
220 +  // (Needed for minimization routines):
221 +
222 +  void getGrad(double gradient[6] );
223 +  void getEulerAngles( double myEuler[3] );
224 +
225 +  double max(double x, double y);
226 +  double min(double x, double y);
227 +  
228 +
229   private:
230    int dIndex;
231  
232 +  double myMu;
233 +
234    double sux, suy, suz; // the standard unit vector    ( body fixed )
235    double jx, jy, jz;    // the angular momentum vector ( body fixed )
236    

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines