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

Comparing trunk/mdtools/headers/Atom.hpp (file contents):
Revision 189 by mmeineke, Tue Nov 26 21:04:43 2002 UTC vs.
Revision 190 by mmeineke, Tue Nov 26 21:12:04 2002 UTC

# Line 13 | Line 13 | class Atom{ (public)
13      is_LJ = 0;
14      index = theIndex;
15      offset = 3 * index;
16 +    offsetX = offset;
17 +    offsetY = offset+1;
18 +    offsetZ = offset+2;
19    }
20    virtual ~Atom() {}
21  
# Line 29 | Line 32 | class Atom{ (public)
32      delete[] trq;
33    }
34    
35 <  double getX() const {return pos[offset];}
36 <  double getY() const {return pos[offset+1];}
37 <  double getZ() const {return pos[offset+2];}
38 <  void setX(double x) {pos[offset]   = x;}
39 <  void setY(double y) {pos[offset+1] = y;}
40 <  void setZ(double z) {pos[offset+2] = z;}
35 >  double getX() const {return pos[offsetX];}
36 >  double getY() const {return pos[offsetY];}
37 >  double getZ() const {return pos[offsetZ];}
38 >  void setX(double x) {pos[offsetX]   = x;}
39 >  void setY(double y) {pos[offsetY] = y;}
40 >  void setZ(double z) {pos[offsetZ] = z;}
41    
42 <  double get_vx() const  {return vel[offset];}
43 <  double get_vy() const  {return vel[offset+1];}
44 <  double get_vz() const  {return vel[offset+2];}
45 <  void set_vx(double vx) {vel[offset]   = vx;}
46 <  void set_vy(double vy) {vel[offset+1] = vy;}
47 <  void set_vz(double vz) {vel[offset+2] = vz;}
42 >  double get_vx() const  {return vel[offsetX];}
43 >  double get_vy() const  {return vel[offsetY];}
44 >  double get_vz() const  {return vel[offsetZ];}
45 >  void set_vx(double vx) {vel[offsetX]   = vx;}
46 >  void set_vy(double vy) {vel[offsetY] = vy;}
47 >  void set_vz(double vz) {vel[offsetZ] = vz;}
48    
49 <  double getFx() const   {return frc[offset];}
50 <  double getFy() const   {return frc[offset+1];}
51 <  double getFz() const   {return frc[offset+2];}
52 <  void addFx(double add) {frc[offset]   += add;}
53 <  void addFy(double add) {frc[offset+1] += add;}
54 <  void addFz(double add) {frc[offset+2] += add;}
49 >  double getFx() const   {return frc[offsetX];}
50 >  double getFy() const   {return frc[offsetY];}
51 >  double getFz() const   {return frc[offsetZ];}
52 >  void addFx(double add) {frc[offsetX]   += add;}
53 >  void addFy(double add) {frc[offsetY] += add;}
54 >  void addFz(double add) {frc[offsetZ] += add;}
55    virtual void zeroForces() = 0;
56  
57    double getMass() const {return c_mass;}
# Line 64 | Line 67 | class Atom{ (public)
67    void setCovalent(double covalent) {c_covalent = covalent;}
68    
69    int getIndex() const {return index;}
70 <  void setIndex(int theIndex) {index = theIndex; offset = index*3;}
71 <  
70 >  void setIndex(int theIndex) {
71 >    index = theIndex;
72 >    offset = index*3;
73 >    offsetX = offset;
74 >    offsetY = offset+1;
75 >    offsetZ = offset+2;
76 >  }
77 >
78    char *getType() {return c_name;}
79    void setType(char * name) {strcpy(c_name,name);}
80  
# Line 118 | Line 127 | class GeneralAtom : public Atom{ (public)
127  
128    int isDirectional( void ){ return 0; }
129    void zeroForces() {
130 <    frc[offset]   = 0.0;
131 <    frc[offset+1] = 0.0;
132 <    frc[offset+2] = 0.0;
130 >    frc[offsetX]   = 0.0;
131 >    frc[offsetY] = 0.0;
132 >    frc[offsetZ] = 0.0;
133    }
134   };
135  
# Line 161 | Line 170 | class DirectionalAtom : public Atom { (public)
170    void setJy( double the_jy ) { jy = the_jy; }
171    void setJz( double the_jz ) { jz = the_jz; }
172      
173 <  void addTx( double the_tx ) { trq[offset]   += the_tx;}
174 <  void addTy( double the_ty ) { trq[offset+1] += the_ty;}
175 <  void addTz( double the_tz ) { trq[offset+2] += the_tz;}
173 >  void addTx( double the_tx ) { trq[offsetX]   += the_tx;}
174 >  void addTy( double the_ty ) { trq[offsetY] += the_ty;}
175 >  void addTz( double the_tz ) { trq[offsetZ] += the_tz;}
176  
177    void setMu( double the_mu ) { mu = the_mu; }
178  
179    void zeroForces() {
180 <    frc[offset]   = 0.0;
181 <    frc[offset+1] = 0.0;
182 <    frc[offset+2] = 0.0;
180 >    frc[offsetX]   = 0.0;
181 >    frc[offsetY] = 0.0;
182 >    frc[offsetZ] = 0.0;
183  
184 <    trq[offset]   = 0.0;
185 <    trq[offset+1] = 0.0;
186 <    trq[offset+2] = 0.0;
184 >    trq[offsetX]   = 0.0;
185 >    trq[offsetY] = 0.0;
186 >    trq[offsetZ] = 0.0;
187    }
188  
189    double getAxx( void ) { return Axx; }
# Line 202 | Line 211 | class DirectionalAtom : public Atom { (public)
211    double getJy( void ) { return jy; }
212    double getJz( void ) { return jz; }
213  
214 <  double getTx( void ) { return trq[offset];}
215 <  double getTy( void ) { return trq[offset+1]; }
216 <  double getTz( void ) { return trq[offset+2]; }
214 >  double getTx( void ) { return trq[offsetX];}
215 >  double getTy( void ) { return trq[offsetY]; }
216 >  double getTz( void ) { return trq[offsetZ]; }
217  
218    double getIxx( void ) { return Ixx; }
219    double getIxy( void ) { return Ixy; }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines