diff --git a/src/GRANULAR/fix_pour.cpp b/src/GRANULAR/fix_pour.cpp index 613dd61496..9d990fd7ba 100644 --- a/src/GRANULAR/fix_pour.cpp +++ b/src/GRANULAR/fix_pour.cpp @@ -114,14 +114,13 @@ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) : } else error->all("Illegal fix pour command"); } - // error check that a valid region was specified + // error checks on region and its extent being inside simulation box if (iregion == -1) error->all("Must specify a region in fix pour"); - - // error checks on region - - if (domain->regions[iregion]->interior == 0) - error->all("Must use region with side = in with fix pour"); + if (domain->regions[iregion]->bboxflag == 0) + error->all("Fix pour region does not support a bounding box"); + if (domain->regions[iregion]->dynamic_check()) + error->all("Fix pour region cannot be dynamic"); if (strcmp(domain->regions[iregion]->style,"block") == 0) { region_style = 1; diff --git a/src/PRD/prd.cpp b/src/PRD/prd.cpp index 00690f838f..8dabbca99d 100644 --- a/src/PRD/prd.cpp +++ b/src/PRD/prd.cpp @@ -24,6 +24,7 @@ #include "update.h" #include "atom.h" #include "domain.h" +#include "region.h" #include "comm.h" #include "velocity.h" #include "integrate.h" @@ -221,12 +222,16 @@ void PRD::command(int narg, char **arg) update->minimize->init(); - // cannot use PRD with time-dependent fixes + // cannot use PRD with time-dependent fixes or regions for (int i = 0; i < modify->nfix; i++) if (modify->fix[i]->time_depend) error->all("Cannot use PRD with a time-dependent fix defined"); + for (int i = 0; i < modify->nfix; i++) + if (domain->regions[i]->dynamic) + error->all("Cannot use PRD with a time-dependent region defined"); + // perform PRD simulation if (me_universe == 0 && universe->uscreen) diff --git a/src/fix_deposit.cpp b/src/fix_deposit.cpp index 4b446f2da8..b1031a52c8 100644 --- a/src/fix_deposit.cpp +++ b/src/fix_deposit.cpp @@ -70,6 +70,8 @@ FixDeposit::FixDeposit(LAMMPS *lmp, int narg, char **arg) : if (iregion == -1) error->all("Must specify a region in fix deposit"); if (domain->regions[iregion]->bboxflag == 0) error->all("Fix deposit region does not support a bounding box"); + if (domain->regions[iregion]->dynamic_check()) + error->all("Fix deposit region cannot be dynamic"); xlo = domain->regions[iregion]->extent_xlo; xhi = domain->regions[iregion]->extent_xhi; diff --git a/src/fix_wall_region.cpp b/src/fix_wall_region.cpp index e977d557b9..e90419fa0f 100644 --- a/src/fix_wall_region.cpp +++ b/src/fix_wall_region.cpp @@ -62,9 +62,6 @@ FixWallRegion::FixWallRegion(LAMMPS *lmp, int narg, char **arg) : eflag = 0; ewall[0] = ewall[1] = ewall[2] = ewall[3] = 0.0; - - // set this when regions have time dependence - // time_depend = 1; } /* ---------------------------------------------------------------------- */ diff --git a/src/region.cpp b/src/region.cpp index fa1f5a893d..5402f1358c 100644 --- a/src/region.cpp +++ b/src/region.cpp @@ -22,7 +22,7 @@ using namespace LAMMPS_NS; -enum{NONE,LINEAR,WIGGLE,ROTATE,VARIABLE}; +enum{NONE,VELOCITY,WIGGLE,ROTATE,VARIABLE}; /* ---------------------------------------------------------------------- */ @@ -82,12 +82,12 @@ void Region::options(int narg, char **arg) else if (strcmp(arg[iarg+1],"out") == 0) interior = 0; else error->all("Illegal region command"); iarg += 2; - } else if (strcmp(arg[iarg],"linear") == 0) { + } else if (strcmp(arg[iarg],"vel") == 0) { if (iarg+4 > narg) error->all("Illegal region command"); vx = atof(arg[iarg+1]); vy = atof(arg[iarg+2]); vz = atof(arg[iarg+3]); - dynamic = LINEAR; + dynamic = VELOCITY; iarg += 4; } else if (strcmp(arg[iarg],"wiggle") == 0) { if (iarg+5 > narg) error->all("Illegal region command"); @@ -129,7 +129,7 @@ void Region::options(int narg, char **arg) } else xscale = yscale = zscale = 1.0; - if (dynamic == LINEAR) { + if (dynamic == VELOCITY) { vx *= xscale; vy *= yscale; vz *= zscale; @@ -160,6 +160,17 @@ void Region::options(int narg, char **arg) } } +/* ---------------------------------------------------------------------- + return 1 if region is dynamic, 0 if static + only primitive regions define it here + union/intersect regions have their own dynamic_check() +------------------------------------------------------------------------- */ + +int Region::dynamic_check() +{ + return dynamic; +} + /* ---------------------------------------------------------------------- determine if point x,y,z is a match to region volume XOR computes 0 if 2 args are the same, 1 if different @@ -174,7 +185,7 @@ int Region::match(double x, double y, double z) if (dynamic) { double delta = (update->ntimestep - time_origin) * dt; - if (dynamic == LINEAR) { + if (dynamic == VELOCITY) { x -= vx*delta; y -= vy*delta; z -= vz*delta; @@ -207,7 +218,7 @@ int Region::surface(double x, double y, double z, double cutoff) if (dynamic) { double delta = (update->ntimestep - time_origin) * dt; - if (dynamic == LINEAR) { + if (dynamic == VELOCITY) { x -= vx*delta; y -= vy*delta; z -= vz*delta; diff --git a/src/region.h b/src/region.h index cd796398dc..5e20edaa95 100644 --- a/src/region.h +++ b/src/region.h @@ -42,6 +42,7 @@ class Region : protected Pointers { Region(class LAMMPS *, int, char **); virtual ~Region(); void init(); + virtual int dynamic_check(); int match(double, double, double); int surface(double, double, double, double); diff --git a/src/region_intersect.cpp b/src/region_intersect.cpp index ac773165a9..abb959dea3 100644 --- a/src/region_intersect.cpp +++ b/src/region_intersect.cpp @@ -93,6 +93,19 @@ RegIntersect::~RegIntersect() delete [] contact; } +/* ---------------------------------------------------------------------- + return 1 if region is dynamic, 0 if static + dynamic if any sub-region is dynamic, else static +------------------------------------------------------------------------- */ + +int RegIntersect::dynamic_check() +{ + Region **regions = domain->regions; + for (int ilist = 0; ilist < nregion; ilist++) + if (regions[list[ilist]]->dynamic_check()) return 1; + return 0; +} + /* ---------------------------------------------------------------------- inside = 1 if x,y,z is match() with all sub-regions else inside = 0 diff --git a/src/region_intersect.h b/src/region_intersect.h index 8c09277d57..a14a732a13 100644 --- a/src/region_intersect.h +++ b/src/region_intersect.h @@ -22,6 +22,7 @@ class RegIntersect : public Region { public: RegIntersect(class LAMMPS *, int, char **); ~RegIntersect(); + int dynamic_check(); int inside(double, double, double); int surface_interior(double *, double); int surface_exterior(double *, double); diff --git a/src/region_union.cpp b/src/region_union.cpp index 89947acab4..90a6815cbf 100644 --- a/src/region_union.cpp +++ b/src/region_union.cpp @@ -85,6 +85,19 @@ RegUnion::~RegUnion() delete [] contact; } +/* ---------------------------------------------------------------------- + return 1 if region is dynamic, 0 if static + dynamic if any sub-region is dynamic, else static +------------------------------------------------------------------------- */ + +int RegUnion::dynamic_check() +{ + Region **regions = domain->regions; + for (int ilist = 0; ilist < nregion; ilist++) + if (regions[list[ilist]]->dynamic_check()) return 1; + return 0; +} + /* ---------------------------------------------------------------------- inside = 1 if x,y,z is match() with any sub-region else inside = 0 diff --git a/src/region_union.h b/src/region_union.h index d73ca85ef1..534d916873 100644 --- a/src/region_union.h +++ b/src/region_union.h @@ -22,6 +22,7 @@ class RegUnion : public Region { public: RegUnion(class LAMMPS *, int, char **); ~RegUnion(); + int dynamic_check(); int inside(double, double, double); int surface_interior(double *, double); int surface_exterior(double *, double);