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

Comparing trunk/OOPSE/libmdtools/Molecule.cpp (file contents):
Revision 446 by gezelter, Thu Apr 3 20:19:50 2003 UTC vs.
Revision 607 by gezelter, Tue Jul 15 14:28:54 2003 UTC

# Line 120 | Line 120 | void Molecule::moveCOM(double* delta){
120    }
121   }
122  
123 < void Molecule::moveCOM(double* delta){
123 > void Molecule::moveCOM(double delta[3]){
124    double x, y, z;
125    int i;
126  
# Line 138 | Line 138 | double* Molecule::getCOM() {
138    }
139   }
140  
141 < double* Molecule::getCOM() {
141 > void Molecule::getCOM( double COM[3] ) {
142  
143    double mass, mtot;
144    int i;
# Line 164 | Line 164 | double* Molecule::getCOM() {
164    COM[1] /= mtot;
165    COM[2] /= mtot;
166  
167  return COM;
167   }
168 +
169 + double Molecule::getCOMvel( double COMvel[3] ) {
170 +
171 +  double mass, mtot;
172 +  double aVel[3];
173 +  int i, j;
174 +
175 +
176 +  for (j=0; j<3; j++)
177 +    COMvel[j] = 0.0;
178 +
179 +  mtot   = 0.0;
180 +
181 +  for (i=0; i < nAtoms; i++) {
182 +    if (myAtoms[i] != NULL) {
183 +
184 +      mass = myAtoms[i]->getMass();
185 +      mtot   += mass;
186 +
187 +      myAtoms[i]->getVel(aVel);
188 +
189 +      for (j=0; j<3; j++)
190 +        COMvel[j] += aVel[j]*mass;
191 +
192 +    }
193 +  }
194 +
195 +  for (j=0; j<3; j++)
196 +    COMvel[j] /= mtot;
197 +
198 +  return mtot;
199 +
200 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines