Unverified Commit dcb1b650 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

allow regexp matches for Modify::find_fix_by_style() and consolidate usage of searching for fixes

parent bb21847f
Loading
Loading
Loading
Loading
+5 −13
Changes for src/GRANULAR/fix_pour.cpp: 5 added lines, 13 removed lines.
Original line number Diff line number Diff line
@@ -180,11 +180,8 @@ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) :
  // grav = gravity in distance/time^2 units
  // assume grav = -magnitude at this point, enforce in init()

  int ifix;
  for (ifix = 0; ifix < modify->nfix; ifix++)
    if (utils::strmatch(modify->fix[ifix]->style,"^gravity")) break;

  if (ifix == modify->nfix)
  int ifix = modify->find_fix_by_style("^gravity");
  if (ifix == -1)
    error->all(FLERR,"No fix gravity defined for fix pour");
  grav = - ((FixGravity *) modify->fix[ifix])->magnitude * force->ftm2v;

@@ -309,17 +306,12 @@ void FixPour::init()
  if (domain->triclinic)
    error->all(FLERR,"Cannot use fix pour with triclinic box");

  // insure gravity fix exists
  // insure gravity fix (still) exists
  // for 3d must point in -z, for 2d must point in -y
  // else insertion cannot work

  int ifix;
  for (ifix = 0; ifix < modify->nfix; ifix++) {
    if (strcmp(modify->fix[ifix]->style,"gravity") == 0) break;
    if (strcmp(modify->fix[ifix]->style,"gravity/omp") == 0) break;
    if (strstr(modify->fix[ifix]->style,"gravity/kk") != NULL) break;
  }
  if (ifix == modify->nfix)
  int ifix = modify->find_fix_by_style("^gravity");
  if (ifix == -1)
    error->all(FLERR,"No fix gravity defined for fix pour");

  double xgrav = ((FixGravity *) modify->fix[ifix])->xgrav;
+2 −4
Changes for src/PERI/compute_damage_atom.cpp: 2 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -59,11 +59,9 @@ void ComputeDamageAtom::init()

  // find associated PERI_NEIGH fix that must exist

  ifix_peri = -1;
  for (int i = 0; i < modify->nfix; i++)
    if (strcmp(modify->fix[i]->style,"PERI_NEIGH") == 0) ifix_peri = i;
  ifix_peri = modify->find_fix_by_style("PERI_NEIGH");
  if (ifix_peri == -1)
    error->all(FLERR,"Compute damage/atom requires peridynamic potential");
    error->all(FLERR,"Compute damage/atom requires a peridynamic potential");
}

/* ---------------------------------------------------------------------- */
+5 −8
Changes for src/PERI/compute_dilatation_atom.cpp: 5 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -66,10 +66,10 @@ void ComputeDilatationAtom::init()
  // check PD pair style

  isPMB = isLPS = isVES = isEPS = 0;
  if (force->pair_match("peri/pmb",1)) isPMB = 1;
  if (force->pair_match("peri/lps",1)) isLPS = 1;
  if (force->pair_match("peri/ves",1)) isVES = 1;
  if (force->pair_match("peri/eps",1)) isEPS = 1;
  if (force->pair_match("^peri/pmb",0)) isPMB = 1;
  if (force->pair_match("^peri/lps",0)) isLPS = 1;
  if (force->pair_match("^peri/ves",0)) isVES = 1;
  if (force->pair_match("^peri/eps",0)) isEPS = 1;

  if (isPMB)
    error->all(FLERR,"Compute dilatation/atom cannot be used "
@@ -77,10 +77,7 @@ void ComputeDilatationAtom::init()

  // find associated PERI_NEIGH fix that must exist

  int ifix_peri = -1;
  for (int i = 0; i < modify->nfix; i++)
    if (strcmp(modify->fix[i]->style,"PERI_NEIGH") == 0) ifix_peri = i;
  if (ifix_peri == -1)
  if (modify->find_fix_by_style("^PERI_NEIGH") == -1)
    error->all(FLERR,"Compute dilatation/atom requires Peridynamic pair style");
}

+2 −4
Changes for src/PERI/compute_plasticity_atom.cpp: 2 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -66,11 +66,9 @@ void ComputePlasticityAtom::init()

  // find associated PERI_NEIGH fix that must exist

  ifix_peri = -1;
  for (int i = 0; i < modify->nfix; i++)
    if (strcmp(modify->fix[i]->style,"PERI_NEIGH") == 0) ifix_peri = i;
  ifix_peri = modify->find_fix_by_style("^PERI_NEIGH");
  if (ifix_peri == -1)
    error->all(FLERR,"Compute plasticity/atom requires Peridynamic pair style");
    error->all(FLERR,"Compute plasticity/atom requires a Peridynamics pair style");
}

/* ---------------------------------------------------------------------- */
+3 −3
Changes for src/PERI/pair_peri_eps.cpp: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -524,9 +524,9 @@ void PairPeriEPS::init_style()
  // find associated PERI_NEIGH fix that must exist
  // could have changed locations in fix list since created

  for (int i = 0; i < modify->nfix; i++)
    if (strcmp(modify->fix[i]->style,"PERI_NEIGH") == 0) ifix_peri = i;
  if (ifix_peri == -1) error->all(FLERR,"Fix peri neigh does not exist");
  ifix_peri = modify->find_fix_by_style("^PERI_NEIGH");
  if (ifix_peri == -1)
    error->all(FLERR,"Fix peri neigh does not exist");

  neighbor->request(this,instance_me);
}
Loading