Unverified Commit 2f9f4557 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer Committed by GitHub
Browse files

Merge pull request #1750 from rbberger/fix_pour_bugfix

Bugfix for fix pour and PBC
parents 67b17470 3e2b572e
Loading
Loading
Loading
Loading
+11 −9
Original line number Diff line number Diff line
@@ -782,25 +782,27 @@ int FixPour::overlap(int i)
   return 1 if value is outside, 0 if inside
------------------------------------------------------------------------- */

int FixPour::outside(int dim, double value, double lo, double hi)
bool FixPour::outside(int dim, double value, double lo, double hi)
{
  double boxlo = domain->boxlo[dim];
  double boxhi = domain->boxhi[dim];
  bool outside_pbc_range = true;
  bool outside_regular_range = (value < lo || value > hi);

  if (domain->periodicity[dim]) {
    if (lo < boxlo && hi > boxhi) {
      return 0;
    if ((lo < boxlo && hi > boxhi) || (hi - lo) > domain->prd[dim]) {
      // value is always inside
      outside_pbc_range = false;
    } else if (lo < boxlo) {
      if (value > hi && value < lo + domain->prd[dim]) return 1;
      // lower boundary crosses periodic boundary
      outside_pbc_range = (value > hi && value < lo + domain->prd[dim]);
    } else if (hi > boxhi) {
      if (value > hi - domain->prd[dim] && value < lo) return 1;
    } else {
      if (value < lo || value > hi) return 1;
      // upper boundary crosses periodic boundary
      outside_pbc_range = (value < lo && value > hi - domain->prd[dim]);
    }
  }

  if (value < lo || value > hi) return 1;
  return 0;
  return (outside_pbc_range && outside_regular_range);
}

/* ---------------------------------------------------------------------- */
+1 −1
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ class FixPour : public Fix {

  void find_maxid();
  int overlap(int);
  int outside(int, double, double, double);
  bool outside(int, double, double, double);
  void xyz_random(double, double *);
  double radius_sample();
  void options(int, char **);