git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@4504 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -50,11 +50,16 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
int iarg;
|
int iarg;
|
||||||
if (strcmp(style,"reduce") == 0) {
|
if (strcmp(style,"reduce") == 0) {
|
||||||
if (narg < 5) error->all("Illegal compute reduce command");
|
if (narg < 5) error->all("Illegal compute reduce command");
|
||||||
|
idregion = NULL;
|
||||||
iarg = 3;
|
iarg = 3;
|
||||||
} else if (strcmp(style,"reduce/region") == 0) {
|
} else if (strcmp(style,"reduce/region") == 0) {
|
||||||
if (narg < 6) error->all("Illegal compute reduce/region command");
|
if (narg < 6) error->all("Illegal compute reduce/region command");
|
||||||
iregion = domain->find_region(arg[3]);
|
iregion = domain->find_region(arg[3]);
|
||||||
if (iregion == -1) error->all("Compute reduce region ID does not exist");
|
if (iregion == -1)
|
||||||
|
error->all("Region ID for compute reduce/region does not exist");
|
||||||
|
int n = strlen(arg[3]) + 1;
|
||||||
|
idregion = new char[n];
|
||||||
|
strcpy(idregion,arg[3]);
|
||||||
iarg = 4;
|
iarg = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,6 +286,7 @@ ComputeReduce::~ComputeReduce()
|
|||||||
delete [] ids;
|
delete [] ids;
|
||||||
delete [] value2index;
|
delete [] value2index;
|
||||||
delete [] replace;
|
delete [] replace;
|
||||||
|
delete [] idregion;
|
||||||
|
|
||||||
delete [] vector;
|
delete [] vector;
|
||||||
delete [] onevec;
|
delete [] onevec;
|
||||||
@ -317,6 +323,12 @@ void ComputeReduce::init()
|
|||||||
|
|
||||||
} else value2index[m] = -1;
|
} else value2index[m] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set index and check validity of region
|
||||||
|
|
||||||
|
iregion = domain->find_region(idregion);
|
||||||
|
if (iregion == -1)
|
||||||
|
error->all("Region ID for compute reduce/region does not exist");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|||||||
@ -41,6 +41,7 @@ class ComputeReduce : public Compute {
|
|||||||
double *onevec;
|
double *onevec;
|
||||||
int *replace,*indices,*owner;
|
int *replace,*indices,*owner;
|
||||||
int index;
|
int index;
|
||||||
|
char *idregion;
|
||||||
|
|
||||||
int maxatom;
|
int maxatom;
|
||||||
double *varatom;
|
double *varatom;
|
||||||
|
|||||||
@ -33,7 +33,11 @@ ComputeTempRegion::ComputeTempRegion(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
if (narg != 4) error->all("Illegal compute temp/region command");
|
if (narg != 4) error->all("Illegal compute temp/region command");
|
||||||
|
|
||||||
iregion = domain->find_region(arg[3]);
|
iregion = domain->find_region(arg[3]);
|
||||||
if (iregion == -1) error->all("Temperature region ID does not exist");
|
if (iregion == -1)
|
||||||
|
error->all("Region ID for compute temp/region does not exist");
|
||||||
|
int n = strlen(arg[3]) + 1;
|
||||||
|
idregion = new char[n];
|
||||||
|
strcpy(idregion,arg[3]);
|
||||||
|
|
||||||
scalar_flag = vector_flag = 1;
|
scalar_flag = vector_flag = 1;
|
||||||
size_vector = 6;
|
size_vector = 6;
|
||||||
@ -51,6 +55,7 @@ ComputeTempRegion::ComputeTempRegion(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
ComputeTempRegion::~ComputeTempRegion()
|
ComputeTempRegion::~ComputeTempRegion()
|
||||||
{
|
{
|
||||||
|
delete [] idregion;
|
||||||
memory->destroy_2d_double_array(vbiasall);
|
memory->destroy_2d_double_array(vbiasall);
|
||||||
delete [] vector;
|
delete [] vector;
|
||||||
}
|
}
|
||||||
@ -59,6 +64,12 @@ ComputeTempRegion::~ComputeTempRegion()
|
|||||||
|
|
||||||
void ComputeTempRegion::init()
|
void ComputeTempRegion::init()
|
||||||
{
|
{
|
||||||
|
// set index and check validity of region
|
||||||
|
|
||||||
|
iregion = domain->find_region(idregion);
|
||||||
|
if (iregion == -1)
|
||||||
|
error->all("Region ID for temp reduce/region does not exist");
|
||||||
|
|
||||||
dof = 0.0;
|
dof = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -41,6 +41,7 @@ class ComputeTempRegion : public Compute {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
int iregion;
|
int iregion;
|
||||||
|
char *idregion;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -863,13 +863,18 @@ void Domain::set_lattice(int narg, char **arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
create a new region
|
create a new region
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void Domain::add_region(int narg, char **arg)
|
void Domain::add_region(int narg, char **arg)
|
||||||
{
|
{
|
||||||
if (narg < 2) error->all("Illegal region command");
|
if (narg < 2) error->all("Illegal region command");
|
||||||
|
|
||||||
|
if (strcmp(arg[1],"delete") == 0) {
|
||||||
|
delete_region(narg,arg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (find_region(arg[0]) >= 0) error->all("Reuse of region ID");
|
if (find_region(arg[0]) >= 0) error->all("Reuse of region ID");
|
||||||
|
|
||||||
// extend Region list if necessary
|
// extend Region list if necessary
|
||||||
@ -896,6 +901,21 @@ void Domain::add_region(int narg, char **arg)
|
|||||||
nregion++;
|
nregion++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
delete a region
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void Domain::delete_region(int narg, char **arg)
|
||||||
|
{
|
||||||
|
if (narg != 2) error->all("Illegal region command");
|
||||||
|
|
||||||
|
int iregion = find_region(arg[0]);
|
||||||
|
if (iregion == -1) error->all("Delete region ID does not exist");
|
||||||
|
|
||||||
|
regions[iregion] = regions[nregion-1];
|
||||||
|
nregion--;
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
return region index if name matches existing region ID
|
return region index if name matches existing region ID
|
||||||
return -1 if no such region
|
return -1 if no such region
|
||||||
|
|||||||
@ -101,6 +101,7 @@ class Domain : protected Pointers {
|
|||||||
void minimum_image(double *);
|
void minimum_image(double *);
|
||||||
void set_lattice(int, char **);
|
void set_lattice(int, char **);
|
||||||
void add_region(int, char **);
|
void add_region(int, char **);
|
||||||
|
void delete_region(int, char **);
|
||||||
int find_region(char *);
|
int find_region(char *);
|
||||||
void set_boundary(int, char **);
|
void set_boundary(int, char **);
|
||||||
void print_box(const char *);
|
void print_box(const char *);
|
||||||
|
|||||||
@ -180,6 +180,13 @@ void DumpCFG::init()
|
|||||||
if (ivariable < 0) error->all("Could not find dump cfg variable name");
|
if (ivariable < 0) error->all("Could not find dump cfg variable name");
|
||||||
variable[i] = ivariable;
|
variable[i] = ivariable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set index and check validity of region
|
||||||
|
|
||||||
|
if (iregion >= 0) {
|
||||||
|
iregion = domain->find_region(idregion);
|
||||||
|
if (iregion == -1) error->all("Region ID for dump cfg does not exist");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|||||||
@ -60,6 +60,7 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
vtype = new int[nfield];
|
vtype = new int[nfield];
|
||||||
|
|
||||||
iregion = -1;
|
iregion = -1;
|
||||||
|
idregion = NULL;
|
||||||
nthresh = 0;
|
nthresh = 0;
|
||||||
thresh_array = NULL;
|
thresh_array = NULL;
|
||||||
thresh_op = NULL;
|
thresh_op = NULL;
|
||||||
@ -127,6 +128,7 @@ DumpCustom::~DumpCustom()
|
|||||||
memory->sfree(field2index);
|
memory->sfree(field2index);
|
||||||
memory->sfree(argindex);
|
memory->sfree(argindex);
|
||||||
|
|
||||||
|
delete [] idregion;
|
||||||
memory->sfree(thresh_array);
|
memory->sfree(thresh_array);
|
||||||
memory->sfree(thresh_op);
|
memory->sfree(thresh_op);
|
||||||
memory->sfree(thresh_value);
|
memory->sfree(thresh_value);
|
||||||
@ -1143,6 +1145,9 @@ int DumpCustom::modify_param(int narg, char **arg)
|
|||||||
else {
|
else {
|
||||||
iregion = domain->find_region(arg[1]);
|
iregion = domain->find_region(arg[1]);
|
||||||
if (iregion == -1) error->all("Dump_modify region ID does not exist");
|
if (iregion == -1) error->all("Dump_modify region ID does not exist");
|
||||||
|
int n = strlen(arg[1]) + 1;
|
||||||
|
idregion = new char[n];
|
||||||
|
strcpy(idregion,arg[1]);
|
||||||
}
|
}
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
|
|||||||
@ -34,6 +34,7 @@ class DumpCustom : public Dump {
|
|||||||
protected:
|
protected:
|
||||||
int nevery; // dump frequency to check Fix against
|
int nevery; // dump frequency to check Fix against
|
||||||
int iregion; // -1 if no region, else which region
|
int iregion; // -1 if no region, else which region
|
||||||
|
char *idregion; // region ID
|
||||||
int nthresh; // # of defined threshholds
|
int nthresh; // # of defined threshholds
|
||||||
int *thresh_array; // array to threshhhold on for each nthresh
|
int *thresh_array; // array to threshhhold on for each nthresh
|
||||||
int *thresh_op; // threshhold operation for each nthresh
|
int *thresh_op; // threshhold operation for each nthresh
|
||||||
|
|||||||
Reference in New Issue
Block a user