validate more numbers read from data files through using force->numeric()/force->inumeric() instead of atof()/atoi()

This commit is contained in:
Axel Kohlmeyer
2019-07-07 15:52:21 -04:00
parent b727f0b126
commit 15e1b39531
34 changed files with 247 additions and 247 deletions

View File

@ -965,15 +965,15 @@ void AtomVecSphere::data_atom(double *coord, imageint imagetmp, char **values)
if (nlocal == nmax) grow(0);
tag[nlocal] = ATOTAGINT(values[0]);
type[nlocal] = atoi(values[1]);
type[nlocal] = force->inumeric(FLERR,values[1]);
if (type[nlocal] <= 0 || type[nlocal] > atom->ntypes)
error->one(FLERR,"Invalid atom type in Atoms section of data file");
radius[nlocal] = 0.5 * atof(values[2]);
radius[nlocal] = 0.5 * force->numeric(FLERR,values[2]);
if (radius[nlocal] < 0.0)
error->one(FLERR,"Invalid radius in Atoms section of data file");
double density = atof(values[3]);
double density = force->numeric(FLERR,values[3]);
if (density <= 0.0)
error->one(FLERR,"Invalid density in Atoms section of data file");
@ -1006,11 +1006,11 @@ void AtomVecSphere::data_atom(double *coord, imageint imagetmp, char **values)
int AtomVecSphere::data_atom_hybrid(int nlocal, char **values)
{
radius[nlocal] = 0.5 * atof(values[0]);
radius[nlocal] = 0.5 * force->numeric(FLERR,values[0]);
if (radius[nlocal] < 0.0)
error->one(FLERR,"Invalid radius in Atoms section of data file");
double density = atof(values[1]);
double density = force->numeric(FLERR,values[1]);
if (density <= 0.0)
error->one(FLERR,"Invalid density in Atoms section of data file");
@ -1028,12 +1028,12 @@ int AtomVecSphere::data_atom_hybrid(int nlocal, char **values)
void AtomVecSphere::data_vel(int m, char **values)
{
v[m][0] = atof(values[0]);
v[m][1] = atof(values[1]);
v[m][2] = atof(values[2]);
omega[m][0] = atof(values[3]);
omega[m][1] = atof(values[4]);
omega[m][2] = atof(values[5]);
v[m][0] = force->numeric(FLERR,values[0]);
v[m][1] = force->numeric(FLERR,values[1]);
v[m][2] = force->numeric(FLERR,values[2]);
omega[m][0] = force->numeric(FLERR,values[3]);
omega[m][1] = force->numeric(FLERR,values[4]);
omega[m][2] = force->numeric(FLERR,values[5]);
}
/* ----------------------------------------------------------------------
@ -1042,9 +1042,9 @@ void AtomVecSphere::data_vel(int m, char **values)
int AtomVecSphere::data_vel_hybrid(int m, char **values)
{
omega[m][0] = atof(values[0]);
omega[m][1] = atof(values[1]);
omega[m][2] = atof(values[2]);
omega[m][0] = force->numeric(FLERR,values[0]);
omega[m][1] = force->numeric(FLERR,values[1]);
omega[m][2] = force->numeric(FLERR,values[2]);
return 3;
}