git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@15459 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -75,11 +75,10 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
// expand args if any have wildcard character "*"
|
// expand args if any have wildcard character "*"
|
||||||
|
|
||||||
int expand = 0;
|
int expand = 0;
|
||||||
char **earg,**arghold;
|
char **earg;
|
||||||
int nargnew = input->expand_args(narg-iarg,&arg[iarg],1,earg);
|
int nargnew = input->expand_args(narg-iarg,&arg[iarg],1,earg);
|
||||||
|
|
||||||
if (earg != &arg[iarg]) expand = 1;
|
if (earg != &arg[iarg]) expand = 1;
|
||||||
arghold = arg;
|
|
||||||
arg = earg;
|
arg = earg;
|
||||||
|
|
||||||
// parse values until one isn't recognized
|
// parse values until one isn't recognized
|
||||||
@ -190,9 +189,8 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
// if wildcard expansion occurred, free earg memory from expand_args()
|
// if wildcard expansion occurred, free earg memory from expand_args()
|
||||||
|
|
||||||
if (expand) {
|
if (expand) {
|
||||||
for (int i = 0; i < nvalues; i++) delete [] earg[i];
|
for (int i = 0; i < nargnew; i++) delete [] earg[i];
|
||||||
memory->sfree(earg);
|
memory->sfree(earg);
|
||||||
arg = arghold;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup and error check
|
// setup and error check
|
||||||
|
|||||||
@ -68,13 +68,15 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
// nfield may be shrunk below if extra optional args exist
|
// nfield may be shrunk below if extra optional args exist
|
||||||
|
|
||||||
expand = 0;
|
expand = 0;
|
||||||
nfield = input->expand_args(narg-5,&arg[5],1,earg);
|
nfield = nargnew = input->expand_args(narg-5,&arg[5],1,earg);
|
||||||
if (earg != &arg[5]) expand = 1;
|
if (earg != &arg[5]) expand = 1;
|
||||||
|
|
||||||
// allocate field vectors
|
// allocate field vectors
|
||||||
|
|
||||||
pack_choice = new FnPtrPack[nfield];
|
pack_choice = new FnPtrPack[nfield];
|
||||||
vtype = new int[nfield];
|
vtype = new int[nfield];
|
||||||
|
field2index = new int[nfield];
|
||||||
|
argindex = new int[nfield];
|
||||||
|
|
||||||
buffer_allow = 1;
|
buffer_allow = 1;
|
||||||
buffer_flag = 1;
|
buffer_flag = 1;
|
||||||
@ -87,9 +89,6 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
// computes, fixes, variables which the dump accesses
|
// computes, fixes, variables which the dump accesses
|
||||||
|
|
||||||
memory->create(field2index,nfield,"dump:field2index");
|
|
||||||
memory->create(argindex,nfield,"dump:argindex");
|
|
||||||
|
|
||||||
ncompute = 0;
|
ncompute = 0;
|
||||||
id_compute = NULL;
|
id_compute = NULL;
|
||||||
compute = NULL;
|
compute = NULL;
|
||||||
@ -181,14 +180,14 @@ DumpCustom::~DumpCustom()
|
|||||||
// could not do in constructor, b/c some derived classes process earg
|
// could not do in constructor, b/c some derived classes process earg
|
||||||
|
|
||||||
if (expand) {
|
if (expand) {
|
||||||
for (int i = 0; i < nfield; i++) delete [] earg[i];
|
for (int i = 0; i < nargnew; i++) delete [] earg[i];
|
||||||
memory->sfree(earg);
|
memory->sfree(earg);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete [] pack_choice;
|
delete [] pack_choice;
|
||||||
delete [] vtype;
|
delete [] vtype;
|
||||||
memory->destroy(field2index);
|
delete [] field2index;
|
||||||
memory->destroy(argindex);
|
delete [] argindex;
|
||||||
|
|
||||||
delete [] idregion;
|
delete [] idregion;
|
||||||
memory->destroy(thresh_array);
|
memory->destroy(thresh_array);
|
||||||
|
|||||||
@ -40,6 +40,7 @@ class DumpCustom : public Dump {
|
|||||||
|
|
||||||
int expand; // flag for whether field args were expanded
|
int expand; // flag for whether field args were expanded
|
||||||
char **earg; // field names with wildcard expansion
|
char **earg; // field names with wildcard expansion
|
||||||
|
int nargnew; // size of earg
|
||||||
|
|
||||||
int *vtype; // type of each vector (INT, DOUBLE)
|
int *vtype; // type of each vector (INT, DOUBLE)
|
||||||
char **vformat; // format string for each vector element
|
char **vformat; // format string for each vector element
|
||||||
|
|||||||
@ -49,11 +49,10 @@ FixAveAtom::FixAveAtom(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
// this can reset nvalues
|
// this can reset nvalues
|
||||||
|
|
||||||
int expand = 0;
|
int expand = 0;
|
||||||
char **earg,**arghold;
|
char **earg;
|
||||||
nvalues = input->expand_args(nvalues,&arg[6],1,earg);
|
nvalues = input->expand_args(nvalues,&arg[6],1,earg);
|
||||||
|
|
||||||
if (earg != &arg[6]) expand = 1;
|
if (earg != &arg[6]) expand = 1;
|
||||||
arghold = arg;
|
|
||||||
arg = earg;
|
arg = earg;
|
||||||
|
|
||||||
// parse values
|
// parse values
|
||||||
@ -128,7 +127,6 @@ FixAveAtom::FixAveAtom(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
if (expand) {
|
if (expand) {
|
||||||
for (int i = 0; i < nvalues; i++) delete [] earg[i];
|
for (int i = 0; i < nvalues; i++) delete [] earg[i];
|
||||||
memory->sfree(earg);
|
memory->sfree(earg);
|
||||||
arg = arghold;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup and error check
|
// setup and error check
|
||||||
|
|||||||
@ -60,11 +60,10 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
// expand args if any have wildcard character "*"
|
// expand args if any have wildcard character "*"
|
||||||
|
|
||||||
int expand = 0;
|
int expand = 0;
|
||||||
char **earg,**arghold;
|
char **earg;
|
||||||
int nargnew = input->expand_args(narg-7,&arg[7],1,earg);
|
int nargnew = input->expand_args(narg-7,&arg[7],1,earg);
|
||||||
|
|
||||||
if (earg != &arg[7]) expand = 1;
|
if (earg != &arg[7]) expand = 1;
|
||||||
arghold = arg;
|
|
||||||
arg = earg;
|
arg = earg;
|
||||||
|
|
||||||
// parse values until one isn't recognized
|
// parse values until one isn't recognized
|
||||||
@ -377,9 +376,8 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
// wait to do this until after file comment lines are printed
|
// wait to do this until after file comment lines are printed
|
||||||
|
|
||||||
if (expand) {
|
if (expand) {
|
||||||
for (int i = 0; i < nvalues; i++) delete [] earg[i];
|
for (int i = 0; i < nargnew; i++) delete [] earg[i];
|
||||||
memory->sfree(earg);
|
memory->sfree(earg);
|
||||||
arg = arghold;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// this fix produces a global array
|
// this fix produces a global array
|
||||||
|
|||||||
@ -59,11 +59,10 @@ FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg):
|
|||||||
// expand args if any have wildcard character "*"
|
// expand args if any have wildcard character "*"
|
||||||
|
|
||||||
int expand = 0;
|
int expand = 0;
|
||||||
char **earg,**arghold;
|
char **earg;
|
||||||
int nargnew = input->expand_args(narg-6,&arg[6],0,earg);
|
int nargnew = input->expand_args(narg-6,&arg[6],0,earg);
|
||||||
|
|
||||||
if (earg != &arg[6]) expand = 1;
|
if (earg != &arg[6]) expand = 1;
|
||||||
arghold = arg;
|
|
||||||
arg = earg;
|
arg = earg;
|
||||||
|
|
||||||
// parse values until one isn't recognized
|
// parse values until one isn't recognized
|
||||||
@ -292,9 +291,8 @@ FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg):
|
|||||||
// wait to do this until after file comment lines are printed
|
// wait to do this until after file comment lines are printed
|
||||||
|
|
||||||
if (expand) {
|
if (expand) {
|
||||||
for (int i = 0; i < nvalues; i++) delete [] earg[i];
|
for (int i = 0; i < nargnew; i++) delete [] earg[i];
|
||||||
memory->sfree(earg);
|
memory->sfree(earg);
|
||||||
arg = arghold;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// allocate and initialize memory for averaging
|
// allocate and initialize memory for averaging
|
||||||
|
|||||||
@ -100,67 +100,58 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
// this can reset nvalues
|
// this can reset nvalues
|
||||||
|
|
||||||
int expand = 0;
|
int expand = 0;
|
||||||
char **earg,**arghold;
|
char **earg;
|
||||||
nvalues = input->expand_args(nvalues,&arg[9],mode,earg);
|
nvalues = input->expand_args(nvalues,&arg[9],mode,earg);
|
||||||
|
|
||||||
if (earg != &arg[9]) expand = 1;
|
if (earg != &arg[9]) expand = 1;
|
||||||
arghold = arg;
|
|
||||||
arg = earg;
|
arg = earg;
|
||||||
|
|
||||||
// parse values
|
// parse values
|
||||||
|
|
||||||
which = argindex = value2index = NULL;
|
which = new int[nvalues];
|
||||||
ids = NULL;
|
argindex = new int[nvalues];
|
||||||
allocate_values(nvalues);
|
value2index = new int[nvalues];
|
||||||
|
ids = new char*[nvalues];
|
||||||
|
|
||||||
for (int i = 0; i < nvalues; i++) {
|
for (int i = 0; i < nvalues; i++) {
|
||||||
if (strcmp(arg[i],"x") == 0) {
|
if (strcmp(arg[i],"x") == 0) {
|
||||||
which[i] = X;
|
which[i] = X;
|
||||||
argindex[i] = 0;
|
argindex[i] = 0;
|
||||||
ids[i] = NULL;
|
ids[i] = NULL;
|
||||||
iarg++;
|
|
||||||
} else if (strcmp(arg[i],"y") == 0) {
|
} else if (strcmp(arg[i],"y") == 0) {
|
||||||
which[i] = X;
|
which[i] = X;
|
||||||
argindex[i] = 1;
|
argindex[i] = 1;
|
||||||
ids[i] = NULL;
|
ids[i] = NULL;
|
||||||
iarg++;
|
|
||||||
} else if (strcmp(arg[i],"z") == 0) {
|
} else if (strcmp(arg[i],"z") == 0) {
|
||||||
which[i] = X;
|
which[i] = X;
|
||||||
argindex[i] = 2;
|
argindex[i] = 2;
|
||||||
ids[i] = NULL;
|
ids[i] = NULL;
|
||||||
iarg++;
|
|
||||||
|
|
||||||
} else if (strcmp(arg[i],"vx") == 0) {
|
} else if (strcmp(arg[i],"vx") == 0) {
|
||||||
which[i] = V;
|
which[i] = V;
|
||||||
argindex[i] = 0;
|
argindex[i] = 0;
|
||||||
ids[i] = NULL;
|
ids[i] = NULL;
|
||||||
iarg++;
|
|
||||||
} else if (strcmp(arg[i],"vy") == 0) {
|
} else if (strcmp(arg[i],"vy") == 0) {
|
||||||
which[i] = V;
|
which[i] = V;
|
||||||
argindex[i] = 1;
|
argindex[i] = 1;
|
||||||
ids[i] = NULL;
|
ids[i] = NULL;
|
||||||
iarg++;
|
|
||||||
} else if (strcmp(arg[i],"vz") == 0) {
|
} else if (strcmp(arg[i],"vz") == 0) {
|
||||||
which[i] = V;
|
which[i] = V;
|
||||||
argindex[i] = 2;
|
argindex[i] = 2;
|
||||||
ids[i] = NULL;
|
ids[i] = NULL;
|
||||||
iarg++;
|
|
||||||
|
|
||||||
} else if (strcmp(arg[i],"fx") == 0) {
|
} else if (strcmp(arg[i],"fx") == 0) {
|
||||||
which[i] = F;
|
which[i] = F;
|
||||||
argindex[i] = 0;
|
argindex[i] = 0;
|
||||||
ids[i] = NULL;
|
ids[i] = NULL;
|
||||||
iarg++;
|
|
||||||
} else if (strcmp(arg[i],"fy") == 0) {
|
} else if (strcmp(arg[i],"fy") == 0) {
|
||||||
which[i] = F;
|
which[i] = F;
|
||||||
argindex[i] = 1;
|
argindex[i] = 1;
|
||||||
ids[i] = NULL;
|
ids[i] = NULL;
|
||||||
iarg++;
|
|
||||||
} else if (strcmp(arg[i],"fz") == 0) {
|
} else if (strcmp(arg[i],"fz") == 0) {
|
||||||
which[i] = F;
|
which[i] = F;
|
||||||
argindex[i] = 2;
|
argindex[i] = 2;
|
||||||
ids[i] = NULL;
|
ids[i] = NULL;
|
||||||
iarg++;
|
|
||||||
|
|
||||||
} else if ((strncmp(arg[i],"c_",2) == 0) ||
|
} else if ((strncmp(arg[i],"c_",2) == 0) ||
|
||||||
(strncmp(arg[i],"f_",2) == 0) ||
|
(strncmp(arg[i],"f_",2) == 0) ||
|
||||||
@ -193,7 +184,6 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
if (expand) {
|
if (expand) {
|
||||||
for (int i = 0; i < nvalues; i++) delete [] earg[i];
|
for (int i = 0; i < nvalues; i++) delete [] earg[i];
|
||||||
memory->sfree(earg);
|
memory->sfree(earg);
|
||||||
arg = arghold;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup and error check
|
// setup and error check
|
||||||
@ -496,11 +486,11 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
FixAveHisto::~FixAveHisto()
|
FixAveHisto::~FixAveHisto()
|
||||||
{
|
{
|
||||||
memory->destroy(which);
|
delete [] which;
|
||||||
memory->destroy(argindex);
|
delete [] argindex;
|
||||||
memory->destroy(value2index);
|
delete [] value2index;
|
||||||
for (int i = 0; i < nvalues; i++) delete [] ids[i];
|
for (int i = 0; i < nvalues; i++) delete [] ids[i];
|
||||||
memory->sfree(ids);
|
delete [] ids;
|
||||||
|
|
||||||
if (fp && me == 0) fclose(fp);
|
if (fp && me == 0) fclose(fp);
|
||||||
|
|
||||||
@ -1003,18 +993,6 @@ void FixAveHisto::options(int iarg, int narg, char **arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
|
||||||
reallocate vectors for each input value, of length N
|
|
||||||
------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
void FixAveHisto::allocate_values(int n)
|
|
||||||
{
|
|
||||||
memory->grow(which,n,"ave/hsito:which");
|
|
||||||
memory->grow(argindex,n,"ave/histo:argindex");
|
|
||||||
memory->grow(value2index,n,"ave/histo:value2index");
|
|
||||||
ids = (char **) memory->srealloc(ids,n*sizeof(char *),"ave/histo:ids");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
calculate nvalid = next step on which end_of_step does something
|
calculate nvalid = next step on which end_of_step does something
|
||||||
can be this timestep if multiple of nfreq and nrepeat = 1
|
can be this timestep if multiple of nfreq and nrepeat = 1
|
||||||
|
|||||||
@ -66,7 +66,6 @@ class FixAveHisto : public Fix {
|
|||||||
void bin_vector(int, double *, int);
|
void bin_vector(int, double *, int);
|
||||||
void bin_atoms(double *, int);
|
void bin_atoms(double *, int);
|
||||||
void options(int, int, char **);
|
void options(int, int, char **);
|
||||||
void allocate_values(int);
|
|
||||||
bigint nextvalid();
|
bigint nextvalid();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -79,18 +79,20 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
// this can reset nvalues
|
// this can reset nvalues
|
||||||
|
|
||||||
int expand = 0;
|
int expand = 0;
|
||||||
char **earg,**arghold;
|
char **earg;
|
||||||
nvalues = input->expand_args(nvalues,&arg[6],mode,earg);
|
nvalues = input->expand_args(nvalues,&arg[6],mode,earg);
|
||||||
|
|
||||||
if (earg != &arg[6]) expand = 1;
|
if (earg != &arg[6]) expand = 1;
|
||||||
arghold = arg;
|
|
||||||
arg = earg;
|
arg = earg;
|
||||||
|
|
||||||
// parse values
|
// parse values
|
||||||
|
|
||||||
which = argindex = value2index = offcol = varlen = NULL;
|
which = new int[nvalues];
|
||||||
ids = NULL;
|
argindex = new int[nvalues];
|
||||||
allocate_values(nvalues);
|
value2index = new int[nvalues];
|
||||||
|
offcol = new int[nvalues];
|
||||||
|
varlen = new int[nvalues];
|
||||||
|
ids = new char*[nvalues];
|
||||||
|
|
||||||
for (int i = 0; i < nvalues; i++) {
|
for (int i = 0; i < nvalues; i++) {
|
||||||
if (arg[i][0] == 'c') which[i] = COMPUTE;
|
if (arg[i][0] == 'c') which[i] = COMPUTE;
|
||||||
@ -293,7 +295,6 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
if (expand) {
|
if (expand) {
|
||||||
for (int i = 0; i < nvalues; i++) delete [] earg[i];
|
for (int i = 0; i < nvalues; i++) delete [] earg[i];
|
||||||
memory->sfree(earg);
|
memory->sfree(earg);
|
||||||
arg = arghold;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// allocate memory for averaging
|
// allocate memory for averaging
|
||||||
@ -455,13 +456,13 @@ FixAveTime::~FixAveTime()
|
|||||||
|
|
||||||
delete [] format_user;
|
delete [] format_user;
|
||||||
|
|
||||||
memory->destroy(which);
|
delete [] which;
|
||||||
memory->destroy(argindex);
|
delete [] argindex;
|
||||||
memory->destroy(value2index);
|
delete [] value2index;
|
||||||
memory->destroy(offcol);
|
delete [] offcol;
|
||||||
memory->destroy(varlen);
|
delete [] varlen;
|
||||||
for (int i = 0; i < nvalues; i++) delete [] ids[i];
|
for (int i = 0; i < nvalues; i++) delete [] ids[i];
|
||||||
memory->sfree(ids);
|
delete [] ids;
|
||||||
|
|
||||||
delete [] extlist;
|
delete [] extlist;
|
||||||
|
|
||||||
@ -1105,20 +1106,6 @@ void FixAveTime::options(int iarg, int narg, char **arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
|
||||||
reallocate vectors for N input values
|
|
||||||
------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
void FixAveTime::allocate_values(int n)
|
|
||||||
{
|
|
||||||
memory->grow(which,n,"ave/time:which");
|
|
||||||
memory->grow(argindex,n,"ave/time:argindex");
|
|
||||||
memory->grow(value2index,n,"ave/time:value2index");
|
|
||||||
memory->grow(offcol,n,"ave/time:offcol");
|
|
||||||
memory->grow(varlen,n,"ave/time:varlen");
|
|
||||||
ids = (char **) memory->srealloc(ids,n*sizeof(char *),"ave/time:ids");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
reallocate arrays for mode = VECTOR of size Nrows x Nvalues
|
reallocate arrays for mode = VECTOR of size Nrows x Nvalues
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|||||||
@ -70,7 +70,6 @@ class FixAveTime : public Fix {
|
|||||||
void invoke_scalar(bigint);
|
void invoke_scalar(bigint);
|
||||||
void invoke_vector(bigint);
|
void invoke_vector(bigint);
|
||||||
void options(int, int, char **);
|
void options(int, int, char **);
|
||||||
void allocate_values(int);
|
|
||||||
void allocate_arrays();
|
void allocate_arrays();
|
||||||
bigint nextvalid();
|
bigint nextvalid();
|
||||||
};
|
};
|
||||||
|
|||||||
@ -569,7 +569,7 @@ void Thermo::modify_params(int narg, char **arg)
|
|||||||
format_int_user = NULL;
|
format_int_user = NULL;
|
||||||
format_bigint_user = NULL;
|
format_bigint_user = NULL;
|
||||||
format_float_user = NULL;
|
format_float_user = NULL;
|
||||||
for (int i = 0; i < nfield_initial; i++) {
|
for (int i = 0; i < nfield_initial+1; i++) {
|
||||||
delete [] format_column_user[i];
|
delete [] format_column_user[i];
|
||||||
format_column_user[i] = NULL;
|
format_column_user[i] = NULL;
|
||||||
}
|
}
|
||||||
@ -610,7 +610,7 @@ void Thermo::modify_params(int narg, char **arg)
|
|||||||
strcpy(format_float_user,arg[iarg+2]);
|
strcpy(format_float_user,arg[iarg+2]);
|
||||||
} else {
|
} else {
|
||||||
int i = force->inumeric(FLERR,arg[iarg+1]) - 1;
|
int i = force->inumeric(FLERR,arg[iarg+1]) - 1;
|
||||||
if (i < 0 || i >= nfield_initial)
|
if (i < 0 || i >= nfield_initial+1)
|
||||||
error->all(FLERR,"Illegal thermo_modify command");
|
error->all(FLERR,"Illegal thermo_modify command");
|
||||||
if (format_column_user[i]) delete [] format_column_user[i];
|
if (format_column_user[i]) delete [] format_column_user[i];
|
||||||
int n = strlen(arg[iarg+2]) + 1;
|
int n = strlen(arg[iarg+2]) + 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user