git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@3645 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp 2010-01-11 21:15:28 +00:00
parent 8c8691f535
commit d9310d7e56
10 changed files with 59 additions and 16 deletions

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -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;
}
/* ---------------------------------------------------------------------- */

View File

@ -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;

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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);