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

Comparing trunk/OOPSE/libmdtools/Atom.cpp (file contents):
Revision 409 by gezelter, Wed Mar 26 21:04:38 2003 UTC vs.
Revision 599 by mmeineke, Mon Jul 14 21:48:43 2003 UTC

# Line 1 | Line 1
1 + #include <iostream>
2 +
3 + using namespace std;
4 +
5   #include "Atom.hpp"
6  
7 + double* Atom::pos; // the position array
8 + double* Atom::vel; // the velocity array
9 + double* Atom::frc; // the forc array
10 + double* Atom::trq; // the torque vector  ( space fixed )
11 + double* Atom::Amat; // the rotation matrix
12 + double* Atom::mu;   // the array of dipole moments
13 + double* Atom::ul;   // the lab frame unit directional vector
14 + int Atom::nElements;
15 +
16   Atom::Atom(int theIndex) {
17    c_n_hyd = 0;
18    has_dipole = 0;
# Line 25 | Line 38 | void Atom::createArrays (int nElements) {
38    Azz = Axx+8;
39   }
40  
41 < void Atom::createArrays (int nElements) {
41 > void Atom::createArrays (int the_nElements) {
42    int i;
43    
44 +  nElements = the_nElements;
45 +
46    pos = new double[nElements*3];
47    vel = new double[nElements*3];
48    frc = new double[nElements*3];
# Line 117 | Line 132 | void Atom::addAtoms(int nAdded, double* Apos, double*
132  
133    for(i = 0; i < 3*nAdded; i++) {
134      j = i + 3*nElements;
135 <    new_pos[j] = pos[i];
136 <    new_vel[j] = vel[i];
137 <    new_frc[j] = frc[i];
138 <    new_trq[j] = trq[i];
139 <    new_ul[j] = ul[i];
135 >    new_pos[j] = Apos[i];
136 >    new_vel[j] = Avel[i];
137 >    new_frc[j] = Afrc[i];
138 >    new_trq[j] = Atrq[i];
139 >    new_ul[j] = Aul[i];
140    }
141  
142    for (i = 0; i < 9*nElements; i++) {
# Line 130 | Line 145 | void Atom::addAtoms(int nAdded, double* Apos, double*
145  
146    for(i = 0; i < 9*nAdded; i++) {
147      j = i + 9*nElements;
148 <    new_Amat[j] = Amat[i];
148 >    new_Amat[j] = AAmat[i];
149    }
150  
151    for (i = 0; i < nElements; i++) {
# Line 139 | Line 154 | void Atom::addAtoms(int nAdded, double* Apos, double*
154  
155    for(i = 0; i < nAdded; i++) {
156      j = i + nElements;
157 <    new_mu[j] = mu[i];
157 >    new_mu[j] = Amu[i];
158    }
159  
160    delete[] pos;
# Line 228 | Line 243 | void Atom::deleteRange(int startIndex, int stopIndex)
243    mu = new_mu;
244  
245    nElements = nNew;
246 + }
247 +
248 +
249 + void Atom::getPos( double theP[3] ){
250 +  
251 +  theP[0] = pos[offsetX];
252 +  theP[1] = pos[offsetY];
253 +  theP[2] = pos[offsetZ];
254   }
255 +
256 + void Atom::setPos( double theP[3] ){
257 +  
258 +  pos[offsetX] = theP[0];
259 +  pos[offsetY] = theP[1];
260 +  pos[offsetZ] = theP[2];
261 + }
262 +
263 + void Atom::getVel( double theV[3] ){
264 +  
265 +  theV[0] = vel[offsetX];
266 +  theV[1] = vel[offsetY];
267 +  theV[2] = vel[offsetZ];
268 + }
269 +
270 + void Atom::setVel( double theV[3] ){
271 +  
272 +  vel[offsetX] = theV[0];
273 +  vel[offsetY] = theV[1];
274 +  vel[offsetZ] = theV[2];
275 + }
276 +
277 + void Atom::getFrc( double theF[3] ){
278 +  
279 +  theF[0] = frc[offsetX];
280 +  theF[1] = frc[offsetY];
281 +  theF[2] = frc[offsetZ];
282 + }
283 +
284 + void Atom::addFrc( double theF[3] ){
285 +  
286 +  frc[offsetX] += theF[0];
287 +  frc[offsetY] += theF[1];
288 +  frc[offsetZ] += theF[2];
289 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines