Commit 093f9817 authored by Trung Nguyen's avatar Trung Nguyen
Browse files

Improved the way body inertia moments are checked if they are zero when...

Improved the way body inertia moments are checked if they are zero when updating body quaterions in fix rigid/nve
parent 5e3fe197
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -258,8 +258,8 @@ void no_squish_rotate(int k, double *p, double *q, double *inertia,
  // obtain phi, cosines and sines
  // obtain phi, cosines and sines


  phi = p[0]*kq[0] + p[1]*kq[1] + p[2]*kq[2] + p[3]*kq[3];
  phi = p[0]*kq[0] + p[1]*kq[1] + p[2]*kq[2] + p[3]*kq[3];
  if (fabs(inertia[k-1]) < 1e-6) phi *= 0.0;
  phi /= (4.0 * inertia[k-1]);
  else phi /= 4.0 * inertia[k-1];
  if (!std::isfinite(phi)) phi = 0.0;
  c_phi = cos(dt * phi);
  c_phi = cos(dt * phi);
  s_phi = sin(dt * phi);
  s_phi = sin(dt * phi);