Commit deff6c66 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

add flag "reinit" with args "yes" / "no" to fixes rigid & rigid/small

parent 286d4f27
Loading
Loading
Loading
Loading
+17 −7
Original line number Diff line number Diff line
@@ -267,6 +267,8 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :

  int seed;
  langflag = 0;
  reinitflag = 1;

  tstat_flag = 0;
  pstat_flag = 0;
  allremap = 1;
@@ -501,6 +503,14 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
      infile = new char[n];
      strcpy(infile,arg[iarg+1]);
      restart_file = 1;
      reinitflag = 0;
      iarg += 2;

    } else if (strcmp(arg[iarg],"reinit") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal fix rigid/small command");
      if (strcmp("yes",arg[iarg+1]) == 0) reinitflag = 1;
      else if  (strcmp("no",arg[iarg+1]) == 0) reinitflag = 0;
      else error->all(FLERR,"Illegal fix rigid command");
      iarg += 2;

    } else error->all(FLERR,"Illegal fix rigid command");
@@ -679,15 +689,15 @@ void FixRigid::init()
  if (strstr(update->integrate_style,"respa"))
    step_respa = ((Respa *) update->integrate)->step;

  // setup rigid bodies, using current atom info
  // only do initialization once, b/c properties may not be re-computable
  //   especially if overlapping particles
  // do not do dynamic init if read body properties from infile
  //   this is b/c the infile defines the static and dynamic properties
  //   and may not be computable if contain overlapping particles
  // setup rigid bodies, using current atom info. if reinitflag is not set,
  // do the initialization only once, b/c properties may not be re-computable
  // especially if overlapping particles.
  //   do not do dynamic init if read body properties from infile.
  // this is b/c the infile defines the static and dynamic properties and may
  // not be computable if contain overlapping particles.
  //   setup_bodies_static() reads infile itself

  if (!setupflag) {
  if (reinitflag || !setupflag) {
    setup_bodies_static();
    if (!infile) setup_bodies_dynamic();
    setupflag = 1;
+1 −0
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@ class FixRigid : public Fix {
  int extended;             // 1 if any particles have extended attributes
  int orientflag;           // 1 if particles store spatial orientation
  int dorientflag;          // 1 if particles store dipole orientation
  int reinitflag;           // 1 if re-initialize rigid bodies between runs

  imageint *xcmimage;       // internal image flags for atoms in rigid bodies
                            // set relative to in-box xcm of each body
+26 −10
Original line number Diff line number Diff line
@@ -138,6 +138,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) :
  langflag = 0;
  infile = NULL;
  onemols = NULL;
  reinitflag = 1;

  tstat_flag = 0;
  pstat_flag = 0;
@@ -173,6 +174,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) :
        error->all(FLERR,"Fix rigid/small langevin period must be > 0.0");
      if (seed <= 0) error->all(FLERR,"Illegal fix rigid/small command");
      iarg += 5;

    } else if (strcmp(arg[iarg],"infile") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal fix rigid/small command");
      delete [] infile;
@@ -180,7 +182,16 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) :
      infile = new char[n];
      strcpy(infile,arg[iarg+1]);
      restart_file = 1;
      reinitflag = 0;
      iarg += 2;

    } else if (strcmp(arg[iarg],"reinit") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal fix rigid/small command");
      if (strcmp("yes",arg[iarg+1]) == 0) reinitflag = 1;
      else if  (strcmp("no",arg[iarg+1]) == 0) reinitflag = 0;
      else error->all(FLERR,"Illegal fix rigid/small command");
      iarg += 2;

    } else if (strcmp(arg[iarg],"mol") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal fix rigid/small command");
      int imol = atom->find_molecule(arg[iarg+1]);
@@ -520,13 +531,14 @@ void FixRigidSmall::init()
}

/* ----------------------------------------------------------------------
   setup static/dynamic properties of rigid bodies, using current atom info
   only do initialization once, b/c properties may not be re-computable
     especially if overlapping particles or bodies inserted from mol template
   do not do dynamic init if read body properties from infile
     this is b/c the infile defines the static and dynamic properties
     and may not be computable if contain overlapping particles
     setup_bodies_static() reads infile itself
   setup static/dynamic properties of rigid bodies, using current atom info.
   if reinitflag is not set, do the initialization only once, b/c properties
   may not be re-computable especially if overlapping particles or bodies
   are inserted from mol template.
     do not do dynamic init if read body properties from infile. this
   is b/c the infile defines the static and dynamic properties and may not
   be computable if contain overlapping particles setup_bodies_static()
   reads infile itself.
     cannot do this until now, b/c requires comm->setup() to have setup stencil
   invoke pre_neighbor() to insure body xcmimage flags are reset
     needed if Verlet::setup::pbc() has remapped/migrated atoms for 2nd run
@@ -535,9 +547,13 @@ void FixRigidSmall::init()

void FixRigidSmall::setup_pre_neighbor()
{
  if (!setupflag) setup_bodies_static();
  if (reinitflag || !setupflag)
    setup_bodies_static();
  else pre_neighbor();
  if (!setupflag && !infile) setup_bodies_dynamic();

  if ((reinitflag || !setupflag) && !infile)
    setup_bodies_dynamic();

  setupflag = 1;
}

+1 −0
Original line number Diff line number Diff line
@@ -131,6 +131,7 @@ class FixRigidSmall : public Fix {
  int extended;         // 1 if any particles have extended attributes
  int orientflag;       // 1 if particles store spatial orientation
  int dorientflag;      // 1 if particles store dipole orientation
  int reinitflag;       // 1 if re-initialize rigid bodies between runs

  int POINT,SPHERE,ELLIPSOID,LINE,TRIANGLE,DIPOLE;   // bitmasks for eflags
  int OMEGA,ANGMOM,TORQUE;