| 278 |  |  | 
| 279 |  | } | 
| 280 |  |  | 
| 281 | + | } | 
| 282 | + |  | 
| 283 | + |  | 
| 284 | + | void  RigidBody::updateAtoms(int frame) { | 
| 285 | + | unsigned int i; | 
| 286 | + | Vector3d ref; | 
| 287 | + | Vector3d apos; | 
| 288 | + | DirectionalAtom* dAtom; | 
| 289 | + | Vector3d pos = getPos(frame); | 
| 290 | + | RotMat3x3d a = getA(frame); | 
| 291 | + |  | 
| 292 | + | for (i = 0; i < atoms_.size(); i++) { | 
| 293 | + |  | 
| 294 | + | ref = body2Lab(refCoords_[i], frame); | 
| 295 | + |  | 
| 296 | + | apos = pos + ref; | 
| 297 | + |  | 
| 298 | + | atoms_[i]->setPos(apos, frame); | 
| 299 | + |  | 
| 300 | + | if (atoms_[i]->isDirectional()) { | 
| 301 | + |  | 
| 302 | + | dAtom = (DirectionalAtom *) atoms_[i]; | 
| 303 | + | dAtom->setA(a * refOrients_[i], frame); | 
| 304 | + | } | 
| 305 | + |  | 
| 306 | + | } | 
| 307 | + |  | 
| 308 | + | } | 
| 309 | + |  | 
| 310 | + | void RigidBody::updateAtomVel() { | 
| 311 | + | Mat3x3d skewMat;; | 
| 312 | + |  | 
| 313 | + | Vector3d ji = getJ(); | 
| 314 | + | Mat3x3d I =  getI(); | 
| 315 | + |  | 
| 316 | + | skewMat(0, 0) =0; | 
| 317 | + | skewMat(0, 1) = ji[2] /I(2, 2); | 
| 318 | + | skewMat(0, 2) = -ji[1] /I(1, 1); | 
| 319 | + |  | 
| 320 | + | skewMat(1, 0) = -ji[2] /I(2, 2); | 
| 321 | + | skewMat(1, 1) = 0; | 
| 322 | + | skewMat(1, 2) = ji[0]/I(0, 0); | 
| 323 | + |  | 
| 324 | + | skewMat(2, 0) =ji[1] /I(1, 1); | 
| 325 | + | skewMat(2, 1) = -ji[0]/I(0, 0); | 
| 326 | + | skewMat(2, 2) = 0; | 
| 327 | + |  | 
| 328 | + | Mat3x3d mat = (getA() * skewMat).transpose(); | 
| 329 | + | Vector3d rbVel = getVel(); | 
| 330 | + |  | 
| 331 | + |  | 
| 332 | + | Vector3d velRot; | 
| 333 | + | for (int i =0 ; i < refCoords_.size(); ++i) { | 
| 334 | + | atoms_[i]->setVel(rbVel + mat * refCoords_[i]); | 
| 335 | + | } | 
| 336 | + |  | 
| 337 |  | } | 
| 338 |  |  | 
| 339 | + | void RigidBody::updateAtomVel(int frame) { | 
| 340 | + | Mat3x3d skewMat;; | 
| 341 |  |  | 
| 342 | + | Vector3d ji = getJ(frame); | 
| 343 | + | Mat3x3d I =  getI(); | 
| 344 | + |  | 
| 345 | + | skewMat(0, 0) =0; | 
| 346 | + | skewMat(0, 1) = ji[2] /I(2, 2); | 
| 347 | + | skewMat(0, 2) = -ji[1] /I(1, 1); | 
| 348 | + |  | 
| 349 | + | skewMat(1, 0) = -ji[2] /I(2, 2); | 
| 350 | + | skewMat(1, 1) = 0; | 
| 351 | + | skewMat(1, 2) = ji[0]/I(0, 0); | 
| 352 | + |  | 
| 353 | + | skewMat(2, 0) =ji[1] /I(1, 1); | 
| 354 | + | skewMat(2, 1) = -ji[0]/I(0, 0); | 
| 355 | + | skewMat(2, 2) = 0; | 
| 356 | + |  | 
| 357 | + | Mat3x3d mat = (getA(frame) * skewMat).transpose(); | 
| 358 | + | Vector3d rbVel = getVel(frame); | 
| 359 | + |  | 
| 360 | + |  | 
| 361 | + | Vector3d velRot; | 
| 362 | + | for (int i =0 ; i < refCoords_.size(); ++i) { | 
| 363 | + | atoms_[i]->setVel(rbVel + mat * refCoords_[i], frame); | 
| 364 | + | } | 
| 365 | + |  | 
| 366 | + | } | 
| 367 | + |  | 
| 368 | + |  | 
| 369 | + |  | 
| 370 |  | bool RigidBody::getAtomPos(Vector3d& pos, unsigned int index) { | 
| 371 |  | if (index < atoms_.size()) { | 
| 372 |  |  |