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 483 by gezelter, Wed Apr 9 04:06:43 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 +  int i;
173 +
174 +  COMvel[0] = 0.0;
175 +  COMvel[1] = 0.0;
176 +  COMvel[2] = 0.0;
177 +  mtot   = 0.0;
178 +
179 +  for (i=0; i < nAtoms; i++) {
180 +    if (myAtoms[i] != NULL) {
181 +      
182 +      mass = myAtoms[i]->getMass();
183 +      mtot   += mass;
184 +      COMvel[0] += myAtoms[i]->get_vx() * mass;
185 +      COMvel[1] += myAtoms[i]->get_vy() * mass;
186 +      COMvel[2] += myAtoms[i]->get_vz() * mass;
187 +
188 +    }
189 +  }
190 +
191 +  COMvel[0] /= mtot;
192 +  COMvel[1] /= mtot;
193 +  COMvel[2] /= mtot;
194 +
195 +  return mtot;
196 +
197 + }
198 +
199 + void Molecule::atomicRollCall(int* molMembership) {
200 +  int i, which;
201 +
202 +  for (i=0; i < nAtoms; i++) {
203 +    if (myAtoms[i] != NULL) {
204 +      which = myAtoms[i]->getIndex();
205 +      molMembership[which] = myIndex;
206 +    }
207 +  }
208 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines