From 6d3ba548e1a3d126ec9d823d8e0535814a35a730 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Fri, 11 Dec 2009 14:40:10 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@3523 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/fix_rigid.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/fix_rigid.cpp b/src/fix_rigid.cpp index 8ce9e80743..15d41bba11 100644 --- a/src/fix_rigid.cpp +++ b/src/fix_rigid.cpp @@ -473,7 +473,7 @@ void FixRigid::init() // set exactly one of OMEGA and ANGMOM so particle contributes once // set OMEGA if either radius or rmass exists // set ANGMOM if shape and mass exist - // set OMEGE if atom->angmom doesn't exist + // set OMEGA if atom->angmom doesn't exist if (eflags[i] == 0) continue; @@ -483,7 +483,7 @@ void FixRigid::init() if (atom->torque_flag) eflags[i] |= TORQUE; if ((radius || rmass) && atom->omega_flag) eflags[i] |= OMEGA; else if (shape && mass && atom->angmom_flag) eflags[i] |= ANGMOM; - else if (atom->omega_flag) eflags[i] != OMEGA; + else if (atom->omega_flag) eflags[i] |= OMEGA; else error->one("Could not set finite-size particle attribute " "in fix rigid"); } @@ -846,6 +846,7 @@ void FixRigid::init() MPI_Allreduce(sum[0],all[0],6*nbody,MPI_DOUBLE,MPI_SUM,world); + double norm; for (ibody = 0; ibody < nbody; ibody++) { if (inertia[ibody][0] == 0.0) { if (fabs(all[ibody][0]) > TOLERANCE) @@ -868,9 +869,10 @@ void FixRigid::init() if (fabs((all[ibody][2]-inertia[ibody][2])/inertia[ibody][2]) > TOLERANCE) error->all("Fix rigid: Bad principal moments"); } - if (fabs(all[ibody][3]) > TOLERANCE || - fabs(all[ibody][4]) > TOLERANCE || - fabs(all[ibody][5]) > TOLERANCE) + norm = (inertia[ibody][0] + inertia[ibody][1] + inertia[ibody][2]) / 3.0; + if (fabs(all[ibody][3]/norm) > TOLERANCE || + fabs(all[ibody][4]/norm) > TOLERANCE || + fabs(all[ibody][5]/norm) > TOLERANCE) error->all("Fix rigid: Bad principal moments"); } }