Unverified Commit 8778ec9d authored by Axel Kohlmeyer's avatar Axel Kohlmeyer Committed by GitHub
Browse files

Merge pull request #1763 from lammps/fix-pour-doc

add documention to FixPour::outside(), simplify logic a bit
parents cbca94e4 c5b0f0af
Loading
Loading
Loading
Loading
+23 −15
Original line number Diff line number Diff line
@@ -54,7 +54,8 @@ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) :
{
  if (narg < 6) error->all(FLERR,"Illegal fix pour command");

  if (lmp->kokkos) error->all(FLERR,"Cannot yet use fix pour with the KOKKOS package");
  if (lmp->kokkos) 
    error->all(FLERR,"Cannot yet use fix pour with the KOKKOS package");

  time_depend = 1;

@@ -789,10 +790,18 @@ bool FixPour::outside(int dim, double value, double lo, double hi)
{
  double boxlo = domain->boxlo[dim];
  double boxhi = domain->boxhi[dim];

  // check for value inside/outside range, ignoring periodicity
  // if inside or dim is non-periodic, only this test is needed

  bool outside_range = (value < lo || value > hi);
  if (!outside_range || !domain->periodicity[dim]) return outside_range;

  // for periodic dimension: 
  // must perform additional tests if range wraps around the periodic box

  bool outside_pbc_range = true;
  bool outside_regular_range = (value < lo || value > hi);

  if (domain->periodicity[dim]) {
  if ((lo < boxlo && hi > boxhi) || (hi - lo) > domain->prd[dim]) {
    // value is always inside
    outside_pbc_range = false;
@@ -803,9 +812,8 @@ bool FixPour::outside(int dim, double value, double lo, double hi)
    // upper boundary crosses periodic boundary
    outside_pbc_range = (value < lo && value > hi - domain->prd[dim]);
  }
  }

  return (outside_pbc_range && outside_regular_range);
  return outside_pbc_range;
}

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