ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/Atom.hpp
Revision: 689
Committed: Tue Aug 12 19:56:49 2003 UTC (20 years, 10 months ago) by tim
File size: 6185 byte(s)
Log Message:
debugging globals

File Contents

# Content
1 #ifndef _ATOM_H_
2 #define _ATOM_H_
3
4 #include <cstring>
5 #include <cstdlib>
6 #include <iostream>
7
8 #include "SimState.hpp"
9
10 class Atom{
11 public:
12
13 Atom(int theIndex, SimState* theConfig );
14 virtual ~Atom() {}
15
16 virtual void setCoords(void);
17
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 void getPos( double theP[3] );
25 void setPos( double theP[3] );
26
27 void getVel( double theV[3] );
28 void setVel( double theV[3] );
29
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;}
43
44 double getEpslon() const {return c_epslon;}
45 void setEpslon(double epslon) {c_epslon = epslon;}
46
47 double getCovalent() const {return c_covalent;}
48 void setCovalent(double covalent) {c_covalent = covalent;}
49
50 int getIndex() const {return index;}
51 void setIndex(int theIndex);
52 char *getType() {return c_name;}
53 void setType(char * name) {strcpy(c_name,name);}
54
55 int getIdent( void ) { return ident; }
56 void setIdent( int info ) { ident = info; }
57
58 #ifdef IS_MPI
59 int getGlobalIndex( void ) { return myGlobalIndex; }
60 void setGlobalIndex( int info ) { myGlobalIndex = info; }
61 #endif // is_mpi
62
63 void set_n_hydrogens( int n_h ) {c_n_hyd = n_h;}
64 int get_n_hydrogens() const {return c_n_hyd;}
65
66 void setHasDipole( int value ) { has_dipole = value; }
67 int hasDipole( void ) { return has_dipole; }
68
69 void setLJ( void ) { is_LJ = 1; is_VDW = 0; }
70 int isLJ( void ) { return is_LJ; }
71
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
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;
103
104 int Axx, Axy, Axz; // the rotational matrix indices
105 int Ayx, Ayy, Ayz;
106 int Azx, Azy, Azz;
107
108 char c_name[100]; /* it's name */
109 int ident; // it's unique numeric identity.
110
111 int c_n_hyd; // the number of hydrogens bonded to the atom
112
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
126 class GeneralAtom : public Atom{
127
128 public:
129 GeneralAtom(int theIndex, SimState* theConfig): Atom(theIndex, theConfig){}
130 virtual ~GeneralAtom(){}
131
132 int isDirectional( void ){ return 0; }
133 void zeroForces( void );
134 };
135
136 class DirectionalAtom : public Atom {
137
138 public:
139 DirectionalAtom(int theIndex, SimState* theConfig) : Atom(theIndex,
140 theConfig)
141 {
142 ssdIdentity = 0;
143 sux = 0.0;
144 suy = 0.0;
145 suz = 0.0;
146 myMu = 0.0;
147 }
148 virtual ~DirectionalAtom() {}
149
150 virtual void setCoords(void);
151
152 void printAmatIndex( void );
153
154 int isDirectional(void) { return 1; }
155
156 void setSSD( int value) { ssdIdentity = value; }
157 int isSSD(void) {return ssdIdentity; }
158
159
160 void setEuler( double phi, double theta, double psi );
161
162 double getSUx( void ) { return sux; }
163 double getSUy( void ) { return suy; }
164 double getSUz( void ) { return suz; }
165
166 void setSUx( double the_sux ) { sux = the_sux; }
167 void setSUy( double the_suy ) { suy = the_suy; }
168 void setSUz( double the_suz ) { suz = the_suz; }
169
170 void zeroForces();
171
172 void getA( double the_A[3][3] ); // get the full rotation matrix
173 void setA( double the_A[3][3] );
174
175 void getU( double the_u[3] ); // get the unit vetor
176 void updateU( void );
177
178 void getQ( double the_q[4] ); // get the quanternions
179 void setQ( double the_q[4] );
180
181 void getJ( double theJ[3] );
182 void setJ( double theJ[3] );
183
184 double getJx( void ) { return jx; }
185 double getJy( void ) { return jy; }
186 double getJz( void ) { return jz; }
187
188 void setJx( double the_jx ) { jx = the_jx; }
189 void setJy( double the_jy ) { jy = the_jy; }
190 void setJz( double the_jz ) { jz = the_jz; }
191
192 void getTrq( double theT[3] );
193 void addTrq( double theT[3] );
194
195 // double getTx( void ) { return trq[offsetX];}
196 // double getTy( void ) { return trq[offsetY]; }
197 // double getTz( void ) { return trq[offsetZ]; }
198
199 void setI( double the_I[3][3] );
200 void getI( double the_I[3][3] );
201
202 double getIxx( void ) { return Ixx; }
203 double getIxy( void ) { return Ixy; }
204 double getIxz( void ) { return Ixz; }
205
206 double getIyx( void ) { return Iyx; }
207 double getIyy( void ) { return Iyy; }
208 double getIyz( void ) { return Iyz; }
209
210 double getIzx( void ) { return Izx; }
211 double getIzy( void ) { return Izy; }
212 double getIzz( void ) { return Izz; }
213
214 double getMu( void );
215 void setMu( double the_mu );
216
217 void lab2Body( double r[3] );
218 void body2Lab( double r[3] );
219
220
221 private:
222 int dIndex;
223
224 double myMu;
225
226 double sux, suy, suz; // the standard unit vector ( body fixed )
227 double jx, jy, jz; // the angular momentum vector ( body fixed )
228
229 double Ixx, Ixy, Ixz; // the inertial tensor matrix ( body fixed )
230 double Iyx, Iyy, Iyz;
231 double Izx, Izy, Izz;
232
233 int ssdIdentity; // boolean of whether atom is ssd
234
235 };
236
237 #endif