Commit 61e93e53 authored by sjplimp's avatar sjplimp
Browse files

git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@13355 f3b2605a-c512-4ea7-a41b-209d697bcdaa
parent dc53071b
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@ using namespace MathConst;
#define EPSILON 1.0e-7
#define BIG 1.0e20

#define SINERTIA 0.4            // moment of inertia prefactor for sphere

/* ---------------------------------------------------------------------- */

Molecule::Molecule(LAMMPS *lmp, char *idarg, char *file) : Pointers(lmp)
@@ -154,8 +156,7 @@ void Molecule::compute_mass()
/* ----------------------------------------------------------------------
   compute com = center of mass of molecule
   could have been set by user, otherwise calculate it
   NOTE: does not account for finite size particles
         user should specify COM if wants that effect
   does NOT account for finite size particles
   also compute:
     dxcom = displacement of each atom from COM
     comatom = which atom (1-Natom) is nearest the COM
@@ -217,7 +218,7 @@ void Molecule::compute_com()
/* ----------------------------------------------------------------------
   compute itensor = 6 moments of inertia of molecule around xyz axes
   could have been set by user, otherwise calculate it
   NOTE: account for finite size particles?
   accounts for finite size spheres, assuming no overlap
   also compute:
     inertia = 3 principal components of inertia
     ex,ey,ez = principal axes in space coords
@@ -247,6 +248,16 @@ void Molecule::compute_inertia()
      itensor[4] -= onemass * dx*dz;
      itensor[5] -= onemass * dx*dy;
    }

    if (radiusflag) {
      for (int i = 0; i < natoms; i++) {
        if (rmassflag) onemass = rmass[i];
        else onemass = atom->type[type[i]];
        itensor[0] += SINERTIA*onemass * radius[i]*radius[i];
        itensor[1] += SINERTIA*onemass * radius[i]*radius[i];
        itensor[2] += SINERTIA*onemass * radius[i]*radius[i];
      }
    }
  }

  // diagonalize inertia tensor for each body via Jacobi rotations