git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@10103 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -669,17 +669,18 @@ void Force::bounds(char *str, int nmax, int &nlo, int &nhi)
|
||||
/* ----------------------------------------------------------------------
|
||||
read a floating point value from a string
|
||||
generate an error if not a legitimate floating point value
|
||||
called by various commands to check validity of their arguments
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
double Force::numeric(char *str)
|
||||
double Force::numeric(const char *file, int line, char *str)
|
||||
{
|
||||
int n = strlen(str);
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (isdigit(str[i])) continue;
|
||||
if (str[i] == '-' || str[i] == '+' || str[i] == '.') continue;
|
||||
if (str[i] == 'e' || str[i] == 'E') continue;
|
||||
error->all(FLERR,"Expected floating point parameter in "
|
||||
"input script or data file");
|
||||
error->all(file,line,"Expected floating point parameter "
|
||||
"in input script or data file");
|
||||
}
|
||||
|
||||
return atof(str);
|
||||
@ -688,14 +689,16 @@ double Force::numeric(char *str)
|
||||
/* ----------------------------------------------------------------------
|
||||
read an integer value from a string
|
||||
generate an error if not a legitimate integer value
|
||||
called by various commands to check validity of their arguments
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
int Force::inumeric(char *str)
|
||||
int Force::inumeric(const char *file, int line, char *str)
|
||||
{
|
||||
int n = strlen(str);
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (isdigit(str[i]) || str[i] == '-' || str[i] == '+') continue;
|
||||
error->all(FLERR,"Expected integer parameter in input script or data file");
|
||||
error->all(file,line,
|
||||
"Expected integer parameter in input script or data file");
|
||||
}
|
||||
|
||||
return atoi(str);
|
||||
|
||||
Reference in New Issue
Block a user