forked from lijiext/lammps
Merge branch 'collected-small-changes' into collected-post-stable-patches
This commit is contained in:
commit
6dcd0ccfc3
|
@ -74,7 +74,7 @@ is an integer or floating-point number, respectively, and reject the
|
||||||
input with an error message (for instance, when an integer is required,
|
input with an error message (for instance, when an integer is required,
|
||||||
but a floating-point number 1.0 is provided):
|
but a floating-point number 1.0 is provided):
|
||||||
|
|
||||||
ERROR: Expected integer parameter in input script or data file :pre
|
ERROR: Expected integer parameter instead of '1.0' in input script or data file :pre
|
||||||
|
|
||||||
Some commands allow for using variable references in place of numeric
|
Some commands allow for using variable references in place of numeric
|
||||||
constants so that the value can be evaluated and may change over the
|
constants so that the value can be evaluated and may change over the
|
||||||
|
@ -85,6 +85,9 @@ reading the input and before parsing commands,
|
||||||
|
|
||||||
NOTE: Using a variable reference (i.e. {v_name}) is only allowed if
|
NOTE: Using a variable reference (i.e. {v_name}) is only allowed if
|
||||||
the documentation of the corresponding command explicitly says it is.
|
the documentation of the corresponding command explicitly says it is.
|
||||||
|
Otherwise, you will receive an error message of this kind:
|
||||||
|
|
||||||
|
ERROR: Expected floating point parameter instead of 'v_name' in input script or data file :pre
|
||||||
|
|
||||||
Generally, LAMMPS will print a message to the screen and logfile and
|
Generally, LAMMPS will print a message to the screen and logfile and
|
||||||
exit gracefully when it encounters a fatal error. Sometimes it will
|
exit gracefully when it encounters a fatal error. Sometimes it will
|
||||||
|
|
|
@ -934,20 +934,21 @@ void Force::boundsbig(const char *file, int line, char *str,
|
||||||
|
|
||||||
double Force::numeric(const char *file, int line, char *str)
|
double Force::numeric(const char *file, int line, char *str)
|
||||||
{
|
{
|
||||||
if (!str)
|
int n = 0;
|
||||||
error->all(file,line,"Expected floating point parameter "
|
|
||||||
"in input script or data file");
|
if (str) n = strlen(str);
|
||||||
int n = strlen(str);
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
error->all(file,line,"Expected floating point parameter "
|
error->all(file,line,"Expected floating point parameter instead of"
|
||||||
"in input script or data file");
|
" NULL or empty string in input script or data file");
|
||||||
|
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
if (isdigit(str[i])) continue;
|
if (isdigit(str[i])) continue;
|
||||||
if (str[i] == '-' || str[i] == '+' || str[i] == '.') continue;
|
if (str[i] == '-' || str[i] == '+' || str[i] == '.') continue;
|
||||||
if (str[i] == 'e' || str[i] == 'E') continue;
|
if (str[i] == 'e' || str[i] == 'E') continue;
|
||||||
error->all(file,line,"Expected floating point parameter "
|
char msg[256];
|
||||||
"in input script or data file");
|
snprintf(msg,256,"Expected floating point parameter instead of "
|
||||||
|
"'%s' in input script or data file",str);
|
||||||
|
error->all(file,line,msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return atof(str);
|
return atof(str);
|
||||||
|
@ -961,18 +962,19 @@ double Force::numeric(const char *file, int line, char *str)
|
||||||
|
|
||||||
int Force::inumeric(const char *file, int line, char *str)
|
int Force::inumeric(const char *file, int line, char *str)
|
||||||
{
|
{
|
||||||
if (!str)
|
int n = 0;
|
||||||
error->all(file,line,
|
|
||||||
"Expected integer parameter in input script or data file");
|
if (str) n = strlen(str);
|
||||||
int n = strlen(str);
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
error->all(file,line,
|
error->all(file,line,"Expected integer parameter instead of "
|
||||||
"Expected integer parameter in input script or data file");
|
"NULL or empty string in input script or data file");
|
||||||
|
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
if (isdigit(str[i]) || str[i] == '-' || str[i] == '+') continue;
|
if (isdigit(str[i]) || str[i] == '-' || str[i] == '+') continue;
|
||||||
error->all(file,line,
|
char msg[256];
|
||||||
"Expected integer parameter in input script or data file");
|
snprintf(msg,256,"Expected integer parameter instead of "
|
||||||
|
"'%s' in input script or data file",str);
|
||||||
|
error->all(file,line,msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return atoi(str);
|
return atoi(str);
|
||||||
|
@ -986,18 +988,19 @@ int Force::inumeric(const char *file, int line, char *str)
|
||||||
|
|
||||||
bigint Force::bnumeric(const char *file, int line, char *str)
|
bigint Force::bnumeric(const char *file, int line, char *str)
|
||||||
{
|
{
|
||||||
if (!str)
|
int n = 0;
|
||||||
error->all(file,line,
|
|
||||||
"Expected integer parameter in input script or data file");
|
if (str) n = strlen(str);
|
||||||
int n = strlen(str);
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
error->all(file,line,
|
error->all(file,line,"Expected integer parameter instead of "
|
||||||
"Expected integer parameter in input script or data file");
|
"NULL or empty string in input script or data file");
|
||||||
|
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
if (isdigit(str[i]) || str[i] == '-' || str[i] == '+') continue;
|
if (isdigit(str[i]) || str[i] == '-' || str[i] == '+') continue;
|
||||||
error->all(file,line,
|
char msg[256];
|
||||||
"Expected integer parameter in input script or data file");
|
snprintf(msg,256,"Expected integer parameter instead of "
|
||||||
|
"'%s' in input script or data file",str);
|
||||||
|
error->all(file,line,msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ATOBIGINT(str);
|
return ATOBIGINT(str);
|
||||||
|
@ -1011,18 +1014,19 @@ bigint Force::bnumeric(const char *file, int line, char *str)
|
||||||
|
|
||||||
tagint Force::tnumeric(const char *file, int line, char *str)
|
tagint Force::tnumeric(const char *file, int line, char *str)
|
||||||
{
|
{
|
||||||
if (!str)
|
int n = 0;
|
||||||
error->all(file,line,
|
|
||||||
"Expected integer parameter in input script or data file");
|
if (str) n = strlen(str);
|
||||||
int n = strlen(str);
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
error->all(file,line,
|
error->all(file,line,"Expected integer parameter instead of "
|
||||||
"Expected integer parameter in input script or data file");
|
"NULL or empty string in input script or data file");
|
||||||
|
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
if (isdigit(str[i]) || str[i] == '-' || str[i] == '+') continue;
|
if (isdigit(str[i]) || str[i] == '-' || str[i] == '+') continue;
|
||||||
error->all(file,line,
|
char msg[256];
|
||||||
"Expected integer parameter in input script or data file");
|
snprintf(msg,256,"Expected integer parameter instead of "
|
||||||
|
"'%s' in input script or data file",str);
|
||||||
|
error->all(file,line,msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ATOTAGINT(str);
|
return ATOTAGINT(str);
|
||||||
|
|
Loading…
Reference in New Issue