# | Line 166 | Line 166 | void Molecule::getCOM( double COM[3] ) { | |
---|---|---|
166 | ||
167 | } | |
168 | ||
169 | < | void Molecule::getCOMvel( double mtot, double COMvel[3] ) { |
169 | > | double Molecule::getCOMvel( double COMvel[3] ) { |
170 | ||
171 | < | double mass; |
171 | > | double mass, mtot; |
172 | int i; | |
173 | ||
174 | COMvel[0] = 0.0; | |
# | Line 178 | Line 178 | void Molecule::getCOMvel( double mtot, double COMvel[3 | |
178 | ||
179 | for (i=0; i < nAtoms; i++) { | |
180 | if (myAtoms[i] != NULL) { | |
181 | < | |
181 | > | |
182 | mass = myAtoms[i]->getMass(); | |
183 | mtot += mass; | |
184 | COMvel[0] += myAtoms[i]->get_vx() * mass; | |
# | Line 192 | Line 192 | void Molecule::getCOMvel( double mtot, double COMvel[3 | |
192 | COMvel[1] /= mtot; | |
193 | COMvel[2] /= mtot; | |
194 | ||
195 | + | return mtot; |
196 | + | |
197 | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |