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 450 by mmeineke, Thu Apr 3 21:12:51 2003 UTC vs.
Revision 607 by gezelter, Tue Jul 15 14:28:54 2003 UTC

# Line 165 | Line 165 | void Molecule::getCOM( double COM[3] ) {
165    COM[2] /= mtot;
166  
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