use alternate implementation of numeric conversion functions

these new functions allow to choose between aborting with Error::one()
and exiting with Error::all(). in the long run those should replace
all of the functions in Force.
This commit is contained in:
Axel Kohlmeyer
2019-07-08 17:40:30 -04:00
parent b469ff6791
commit cfaa537296
36 changed files with 479 additions and 248 deletions

View File

@ -1280,16 +1280,16 @@ void AtomVecBody::data_atom(double *coord, imageint imagetmp, char **values)
if (nlocal == nmax) grow(0);
tag[nlocal] = ATOTAGINT(values[0]);
type[nlocal] = force->inumeric(FLERR,values[1]);
type[nlocal] = utils::inumeric(FLERR,values[1],true,lmp);
if (type[nlocal] <= 0 || type[nlocal] > atom->ntypes)
error->one(FLERR,"Invalid atom type in Atoms section of data file");
body[nlocal] = force->inumeric(FLERR,values[2]);
body[nlocal] = utils::inumeric(FLERR,values[2],true,lmp);
if (body[nlocal] == 0) body[nlocal] = -1;
else if (body[nlocal] == 1) body[nlocal] = 0;
else error->one(FLERR,"Invalid bodyflag in Atoms section of data file");
rmass[nlocal] = force->numeric(FLERR,values[3]);
rmass[nlocal] = utils::numeric(FLERR,values[3],true,lmp);
if (rmass[nlocal] <= 0.0)
error->one(FLERR,"Invalid density in Atoms section of data file");
@ -1318,12 +1318,12 @@ void AtomVecBody::data_atom(double *coord, imageint imagetmp, char **values)
int AtomVecBody::data_atom_hybrid(int nlocal, char **values)
{
body[nlocal] = force->inumeric(FLERR,values[0]);
body[nlocal] = utils::inumeric(FLERR,values[0],true,lmp);
if (body[nlocal] == 0) body[nlocal] = -1;
else if (body[nlocal] == 1) body[nlocal] = 0;
else error->one(FLERR,"Invalid atom type in Atoms section of data file");
rmass[nlocal] = force->numeric(FLERR,values[1]);
rmass[nlocal] = utils::numeric(FLERR,values[1],true,lmp);
if (rmass[nlocal] <= 0.0)
error->one(FLERR,"Invalid density in Atoms section of data file");
@ -1350,12 +1350,12 @@ void AtomVecBody::data_body(int m, int ninteger, int ndouble,
void AtomVecBody::data_vel(int m, char **values)
{
v[m][0] = force->numeric(FLERR,values[0]);
v[m][1] = force->numeric(FLERR,values[1]);
v[m][2] = force->numeric(FLERR,values[2]);
angmom[m][0] = force->numeric(FLERR,values[3]);
angmom[m][1] = force->numeric(FLERR,values[4]);
angmom[m][2] = force->numeric(FLERR,values[5]);
v[m][0] = utils::numeric(FLERR,values[0],true,lmp);
v[m][1] = utils::numeric(FLERR,values[1],true,lmp);
v[m][2] = utils::numeric(FLERR,values[2],true,lmp);
angmom[m][0] = utils::numeric(FLERR,values[3],true,lmp);
angmom[m][1] = utils::numeric(FLERR,values[4],true,lmp);
angmom[m][2] = utils::numeric(FLERR,values[5],true,lmp);
}
/* ----------------------------------------------------------------------
@ -1364,9 +1364,9 @@ void AtomVecBody::data_vel(int m, char **values)
int AtomVecBody::data_vel_hybrid(int m, char **values)
{
angmom[m][0] = force->numeric(FLERR,values[0]);
angmom[m][1] = force->numeric(FLERR,values[1]);
angmom[m][2] = force->numeric(FLERR,values[2]);
angmom[m][0] = utils::numeric(FLERR,values[0],true,lmp);
angmom[m][1] = utils::numeric(FLERR,values[1],true,lmp);
angmom[m][2] = utils::numeric(FLERR,values[2],true,lmp);
return 3;
}