Merge pull request #1544 from akohlmey/collected-small-fixes

Collected small changes and bugfixes for the next patch release
This commit is contained in:
Axel Kohlmeyer
2019-07-05 20:33:55 -04:00
committed by GitHub
31 changed files with 40 additions and 53 deletions

View File

@ -57,8 +57,7 @@ Boolean expression is FALSE, then no commands are executed.
The syntax for Boolean expressions is described below. The syntax for Boolean expressions is described below.
Each command (t1, f1, e1, etc) can be any valid LAMMPS input script Each command (t1, f1, e1, etc) can be any valid LAMMPS input script
command, except an "include"_include.html command, which is not command. If the command is more than one word, it must enclosed in
allowed. If the command is more than one word, it must enclosed in
quotes, so it will be treated as a single argument, as in the examples quotes, so it will be treated as a single argument, as in the examples
above. above.

View File

@ -78,7 +78,7 @@ ComputeTempAsphere::ComputeTempAsphere(LAMMPS *lmp, int narg, char **arg) :
if (mode == ROTATE) extra_dof = 0; if (mode == ROTATE) extra_dof = 0;
vector = new double[6]; vector = new double[size_vector];
} }

View File

@ -71,7 +71,7 @@ ComputeTempBody::ComputeTempBody(LAMMPS *lmp, int narg, char **arg) :
} else error->all(FLERR,"Illegal compute temp/body command"); } else error->all(FLERR,"Illegal compute temp/body command");
} }
vector = new double[6]; vector = new double[size_vector];
} }

View File

@ -101,7 +101,7 @@ ComputeTempCS::ComputeTempCS(LAMMPS *lmp, int narg, char **arg) :
// allocate memory // allocate memory
vector = new double[6]; vector = new double[size_vector];
maxatom = 0; maxatom = 0;
vint = NULL; vint = NULL;

View File

@ -80,7 +80,7 @@ void FixQEqShielded::init()
void FixQEqShielded::extract_reax() void FixQEqShielded::extract_reax()
{ {
Pair *pair = force->pair_match("reax/c",1); Pair *pair = force->pair_match("^reax/c",0);
if (pair == NULL) error->all(FLERR,"No pair reax/c for fix qeq/shielded"); if (pair == NULL) error->all(FLERR,"No pair reax/c for fix qeq/shielded");
int tmp; int tmp;
chi = (double *) pair->extract("chi",tmp); chi = (double *) pair->extract("chi",tmp);

View File

@ -149,6 +149,6 @@ void ComputeSpin::compute_vector()
void ComputeSpin::allocate() void ComputeSpin::allocate()
{ {
memory->create(vector,6,"compute/spin:vector"); memory->create(vector,size_vector,"compute/spin:vector");
} }

View File

@ -106,9 +106,9 @@ ComputePressureBocs::ComputePressureBocs(LAMMPS *lmp, int narg, char **arg) :
if (keflag && id_temp == NULL) if (keflag && id_temp == NULL)
error->all(FLERR,"Compute pressure/bocs requires temperature ID " error->all(FLERR,"Compute pressure/bocs requires temperature ID "
"to include kinetic energy"); "to include kinetic energy");
vector = new double[6]; vector = new double[size_vector];
nvirial = 0; nvirial = 0;
vptr = NULL; vptr = NULL;
} }
@ -365,7 +365,7 @@ void ComputePressureBocs::compute_vector()
if (force->kspace && kspace_virial && force->kspace->scalar_pressure_flag) if (force->kspace && kspace_virial && force->kspace->scalar_pressure_flag)
error->all(FLERR,"Must use 'kspace_modify pressure/scalar no' for " error->all(FLERR,"Must use 'kspace_modify pressure/scalar no' for "
"tensor components with kspace_style msm"); "tensor components with kspace_style msm");
// invoke temperature if it hasn't been already // invoke temperature if it hasn't been already

View File

@ -46,7 +46,7 @@ ComputeTempDrude::ComputeTempDrude(LAMMPS *lmp, int narg, char **arg) :
extlist[2] = extlist[3] = extlist[4] = extlist[5] = 1; extlist[2] = extlist[3] = extlist[4] = extlist[5] = 1;
tempflag = 0; // because does not compute a single temperature (scalar and vector) tempflag = 0; // because does not compute a single temperature (scalar and vector)
vector = new double[6]; vector = new double[size_vector];
fix_drude = NULL; fix_drude = NULL;
id_temp = NULL; id_temp = NULL;
temperature = NULL; temperature = NULL;

View File

@ -54,7 +54,7 @@ ComputeTempDeformEff::ComputeTempDeformEff(LAMMPS *lmp, int narg, char **arg) :
maxbias = 0; maxbias = 0;
vbiasall = NULL; vbiasall = NULL;
vector = new double[6]; vector = new double[size_vector];
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -58,7 +58,7 @@ ComputeTempRegionEff::ComputeTempRegionEff(LAMMPS *lmp, int narg, char **arg) :
maxbias = 0; maxbias = 0;
vbiasall = NULL; vbiasall = NULL;
vector = new double[6]; vector = new double[size_vector];
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -53,7 +53,7 @@ ComputeFEP::ComputeFEP(LAMMPS *lmp, int narg, char **arg) :
size_vector = 3; size_vector = 3;
extvector = 0; extvector = 0;
vector = new double[3]; vector = new double[size_vector];
fepinitflag = 0; // avoid init to run entirely when called by write_data fepinitflag = 0; // avoid init to run entirely when called by write_data

View File

@ -46,7 +46,7 @@ ComputeTempRotate::ComputeTempRotate(LAMMPS *lmp, int narg, char **arg) :
maxbias = 0; maxbias = 0;
vbiasall = NULL; vbiasall = NULL;
vector = new double[6]; vector = new double[size_vector];
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -124,7 +124,7 @@ FixQEqReax::FixQEqReax(LAMMPS *lmp, int narg, char **arg) :
// register with Atom class // register with Atom class
reaxc = NULL; reaxc = NULL;
reaxc = (PairReaxC *) force->pair_match("reax/c",0); reaxc = (PairReaxC *) force->pair_match("^reax/c",0);
s_hist = t_hist = NULL; s_hist = t_hist = NULL;
grow_arrays(atom->nmax); grow_arrays(atom->nmax);

View File

@ -29,7 +29,7 @@ ComputeCOM::ComputeCOM(LAMMPS *lmp, int narg, char **arg) :
size_vector = 3; size_vector = 3;
extvector = 0; extvector = 0;
vector = new double[3]; vector = new double[size_vector];
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -105,7 +105,7 @@ ComputeGroupGroup::ComputeGroupGroup(LAMMPS *lmp, int narg, char **arg) :
} else error->all(FLERR,"Illegal compute group/group command"); } else error->all(FLERR,"Illegal compute group/group command");
} }
vector = new double[3]; vector = new double[size_vector];
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -33,7 +33,7 @@ ComputeGyration::ComputeGyration(LAMMPS *lmp, int narg, char **arg) :
extscalar = 0; extscalar = 0;
extvector = 0; extvector = 0;
vector = new double[6]; vector = new double[size_vector];
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -70,7 +70,7 @@ ComputeHeatFlux::ComputeHeatFlux(LAMMPS *lmp, int narg, char **arg) :
error->all(FLERR, error->all(FLERR,
"Compute heat/flux compute ID does not compute stress/atom"); "Compute heat/flux compute ID does not compute stress/atom");
vector = new double[6]; vector = new double[size_vector];
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -115,7 +115,7 @@ ComputeMSD::ComputeMSD(LAMMPS *lmp, int narg, char **arg) :
// displacement vector // displacement vector
vector = new double[4]; vector = new double[size_vector];
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -101,7 +101,7 @@ ComputePressure::ComputePressure(LAMMPS *lmp, int narg, char **arg) :
error->all(FLERR,"Compute pressure requires temperature ID " error->all(FLERR,"Compute pressure requires temperature ID "
"to include kinetic energy"); "to include kinetic energy");
vector = new double[6]; vector = new double[size_vector];
nvirial = 0; nvirial = 0;
vptr = NULL; vptr = NULL;
} }

View File

@ -37,7 +37,7 @@ ComputeTemp::ComputeTemp(LAMMPS *lmp, int narg, char **arg) :
extvector = 1; extvector = 1;
tempflag = 1; tempflag = 1;
vector = new double[6]; vector = new double[size_vector];
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -125,7 +125,7 @@ ComputeTempChunk::ComputeTempChunk(LAMMPS *lmp, int narg, char **arg) :
// vector data // vector data
vector = new double[6]; vector = new double[size_vector];
// chunk-based data // chunk-based data

View File

@ -39,7 +39,7 @@ ComputeTempCOM::ComputeTempCOM(LAMMPS *lmp, int narg, char **arg) :
tempflag = 1; tempflag = 1;
tempbias = 1; tempbias = 1;
vector = new double[6]; vector = new double[size_vector];
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -48,7 +48,7 @@ ComputeTempDeform::ComputeTempDeform(LAMMPS *lmp, int narg, char **arg) :
maxbias = 0; maxbias = 0;
vbiasall = NULL; vbiasall = NULL;
vector = new double[6]; vector = new double[size_vector];
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -49,7 +49,7 @@ ComputeTempPartial::ComputeTempPartial(LAMMPS *lmp, int narg, char **arg) :
maxbias = 0; maxbias = 0;
vbiasall = NULL; vbiasall = NULL;
vector = new double[6]; vector = new double[size_vector];
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -101,7 +101,7 @@ ComputeTempRamp::ComputeTempRamp(LAMMPS *lmp, int narg, char **arg) :
maxbias = 0; maxbias = 0;
vbiasall = NULL; vbiasall = NULL;
vector = new double[6]; vector = new double[size_vector];
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -49,7 +49,7 @@ ComputeTempRegion::ComputeTempRegion(LAMMPS *lmp, int narg, char **arg) :
maxbias = 0; maxbias = 0;
vbiasall = NULL; vbiasall = NULL;
vector = new double[6]; vector = new double[size_vector];
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -72,7 +72,7 @@ ComputeTempSphere::ComputeTempSphere(LAMMPS *lmp, int narg, char **arg) :
if (mode == ROTATE) extra_dof = 0; if (mode == ROTATE) extra_dof = 0;
vector = new double[6]; vector = new double[size_vector];
// error checks // error checks

View File

@ -75,7 +75,7 @@ ComputeVACF::ComputeVACF(LAMMPS *lmp, int narg, char **arg) :
// displacement vector // displacement vector
vector = new double[4]; vector = new double[size_vector];
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -82,7 +82,6 @@ Input::Input(LAMMPS *lmp, int argc, char **argv) : Pointers(lmp)
label_active = 0; label_active = 0;
labelstr = NULL; labelstr = NULL;
jump_skip = 0; jump_skip = 0;
ifthenelse_flag = 0;
if (me == 0) { if (me == 0) {
nfile = 1; nfile = 1;
@ -959,11 +958,10 @@ void Input::ifthenelse()
ncommands++; ncommands++;
} }
ifthenelse_flag = 1; for (int i = 0; i < ncommands; i++) {
for (int i = 0; i < ncommands; i++) one(commands[i]); one(commands[i]);
ifthenelse_flag = 0; delete [] commands[i];
}
for (int i = 0; i < ncommands; i++) delete [] commands[i];
delete [] commands; delete [] commands;
return; return;
@ -1015,13 +1013,10 @@ void Input::ifthenelse()
// execute the list of commands // execute the list of commands
ifthenelse_flag = 1; for (int i = 0; i < ncommands; i++) {
for (int i = 0; i < ncommands; i++) one(commands[i]); one(commands[i]);
ifthenelse_flag = 0; delete [] commands[i];
}
// clean up
for (int i = 0; i < ncommands; i++) delete [] commands[i];
delete [] commands; delete [] commands;
return; return;
@ -1034,13 +1029,6 @@ void Input::include()
{ {
if (narg != 1) error->all(FLERR,"Illegal include command"); if (narg != 1) error->all(FLERR,"Illegal include command");
// do not allow include inside an if command
// NOTE: this check will fail if a 2nd if command was inside the if command
// and came before the include
if (ifthenelse_flag)
error->all(FLERR,"Cannot use include command within an if command");
if (me == 0) { if (me == 0) {
if (nfile == maxfile) if (nfile == maxfile)
error->one(FLERR,"Too many nested levels of input scripts"); error->one(FLERR,"Too many nested levels of input scripts");

View File

@ -54,7 +54,6 @@ class Input : protected Pointers {
int label_active; // 0 = no label, 1 = looking for label int label_active; // 0 = no label, 1 = looking for label
char *labelstr; // label string being looked for char *labelstr; // label string being looked for
int jump_skip; // 1 if skipping next jump, 0 otherwise int jump_skip; // 1 if skipping next jump, 0 otherwise
int ifthenelse_flag; // 1 if executing commands inside an if-then-else
FILE **infiles; // list of open input files FILE **infiles; // list of open input files

View File

@ -406,8 +406,9 @@ void Thermo::compute(int flag)
call function to compute property call function to compute property
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void Thermo::call_vfunc(int ifield) void Thermo::call_vfunc(int ifield_in)
{ {
ifield = ifield_in;
(this->*vfunc[ifield])(); (this->*vfunc[ifield])();
} }