192 |
|
} |
193 |
|
|
194 |
|
void RigidBody::calcForcesAndTorques() { |
195 |
– |
unsigned int i; |
196 |
– |
unsigned int j; |
195 |
|
Vector3d afrc; |
196 |
|
Vector3d atrq; |
197 |
+ |
Vector3d apos; |
198 |
|
Vector3d rpos; |
199 |
< |
Vector3d frc; |
200 |
< |
Vector3d trq; |
201 |
< |
|
202 |
< |
|
204 |
< |
zeroForces(); |
205 |
< |
|
206 |
< |
frc = getFrc(); |
207 |
< |
trq = getTrq(); |
199 |
> |
Vector3d frc(0.0); |
200 |
> |
Vector3d trq(0.0); |
201 |
> |
Vector3d pos = this->getPos(); |
202 |
> |
for (int i = 0; i < atoms_.size(); i++) { |
203 |
|
|
209 |
– |
for (i = 0; i < atoms_.size(); i++) { |
210 |
– |
|
204 |
|
afrc = atoms_[i]->getFrc(); |
205 |
< |
|
206 |
< |
rpos = refCoords_[i]; |
205 |
> |
apos = atoms_[i]->getPos(); |
206 |
> |
rpos = apos - pos; |
207 |
|
|
208 |
|
frc += afrc; |
209 |
|
|