58 |
|
myRigidBodies = theInit.myRigidBodies; |
59 |
|
|
60 |
|
myIntegrableObjects = theInit.myIntegrableObjects; |
61 |
+ |
|
62 |
+ |
for (int i = 0; i < myRigidBodies.size(); i++) |
63 |
+ |
myRigidBodies[i]->calcRefCoords(); |
64 |
|
|
65 |
|
} |
66 |
|
|
135 |
|
double aPos[3]; |
136 |
|
int i, j; |
137 |
|
|
138 |
< |
for(i=0; i<nAtoms; i++) { |
139 |
< |
if(myAtoms[i] != NULL ) { |
138 |
> |
for(i=0; i<myIntegrableObjects.size(); i++) { |
139 |
> |
if(myIntegrableObjects[i] != NULL ) { |
140 |
|
|
141 |
< |
myAtoms[i]->getPos( aPos ); |
141 |
> |
myIntegrableObjects[i]->getPos( aPos ); |
142 |
|
|
143 |
|
for (j=0; j< 3; j++) |
144 |
|
aPos[j] += delta[j]; |
145 |
|
|
146 |
< |
myAtoms[i]->setPos( aPos ); |
146 |
> |
myIntegrableObjects[i]->setPos( aPos ); |
147 |
|
} |
148 |
|
} |
149 |
|
|
176 |
|
|
177 |
|
mtot = 0.0; |
178 |
|
|
179 |
< |
for (i=0; i < nAtoms; i++) { |
180 |
< |
if (myAtoms[i] != NULL) { |
179 |
> |
for (i=0; i < myIntegrableObjects.size(); i++) { |
180 |
> |
if (myIntegrableObjects[i] != NULL) { |
181 |
|
|
182 |
< |
mass = myAtoms[i]->getMass(); |
182 |
> |
mass = myIntegrableObjects[i]->getMass(); |
183 |
|
mtot += mass; |
184 |
|
|
185 |
< |
myAtoms[i]->getPos( aPos ); |
185 |
> |
myIntegrableObjects[i]->getPos( aPos ); |
186 |
|
|
187 |
|
for( j = 0; j < 3; j++) |
188 |
|
COM[j] += aPos[j] * mass; |
206 |
|
|
207 |
|
mtot = 0.0; |
208 |
|
|
209 |
< |
for (i=0; i < nAtoms; i++) { |
210 |
< |
if (myAtoms[i] != NULL) { |
209 |
> |
for (i=0; i < myIntegrableObjects.size(); i++) { |
210 |
> |
if (myIntegrableObjects[i] != NULL) { |
211 |
|
|
212 |
< |
mass = myAtoms[i]->getMass(); |
212 |
> |
mass = myIntegrableObjects[i]->getMass(); |
213 |
|
mtot += mass; |
214 |
|
|
215 |
< |
myAtoms[i]->getVel(aVel); |
215 |
> |
myIntegrableObjects[i]->getVel(aVel); |
216 |
|
|
217 |
|
for (j=0; j<3; j++) |
218 |
|
COMvel[j] += aVel[j]*mass; |
229 |
|
|
230 |
|
double Molecule::getTotalMass() |
231 |
|
{ |
232 |
< |
int natoms; |
230 |
< |
Atom** atoms; |
232 |
> |
|
233 |
|
double totalMass; |
234 |
|
|
233 |
– |
natoms = getNAtoms(); |
234 |
– |
atoms = getMyAtoms(); |
235 |
|
totalMass = 0; |
236 |
< |
for(int i =0; i < natoms; i++){ |
237 |
< |
totalMass += atoms[i]->getMass(); |
236 |
> |
for(int i =0; i < myIntegrableObjects.size(); i++){ |
237 |
> |
totalMass += myIntegrableObjects[i]->getMass(); |
238 |
|
} |
239 |
|
|
240 |
|
return totalMass; |