Commit a11b886b authored by Steve Plimpton's avatar Steve Plimpton
Browse files

add warning if gravity is used incorrectly with overlapped rigid bodies

parent 5859b18d
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -728,6 +728,23 @@ void FixRigid::init()
    }
  }

  // warn if body properties are read from inpfile
  //   and the gravity keyword is not set and a gravity fix exists
  // this could mean body particles are overlapped
  //   and gravity is not applied correctly

  if (inpfile && !id_gravity) {
    for (i = 0; i < modify->nfix; i++) {
      if (strcmp(modify->fix[i]->style,"gravity") == 0) {
        if (comm->me == 0) 
          error->warning(FLERR,"Gravity may not be correctly applied "
                         "to rigid bodies if they consist of "
                         "overlapped particles");
        break;
      }
    }
  }

  // error if npt,nph fix comes before rigid fix

  for (i = 0; i < modify->nfix; i++) {
+17 −0
Original line number Diff line number Diff line
@@ -574,6 +574,23 @@ void FixRigidSmall::init()
    }
  }

  // warn if body properties are read from inpfile or a mol template file
  //   and the gravity keyword is not set and a gravity fix exists
  // this could mean body particles are overlapped
  //   and gravity is not applied correctly

  if ((inpfile || onemols) && !id_gravity) {
    for (i = 0; i < modify->nfix; i++) {
      if (strcmp(modify->fix[i]->style,"gravity") == 0) {
        if (comm->me == 0) 
          error->warning(FLERR,"Gravity may not be correctly applied "
                         "to rigid bodies if they consist of "
                         "overlapped particles");
        break;
      }
    }
  }

  // error if npt,nph fix comes before rigid fix

  for (i = 0; i < modify->nfix; i++) {