simplify; make certain nmax is always initialized
This commit is contained in:
@ -1005,8 +1005,6 @@ int utils::expand_type_int(const char *file, int line, const std::string &str, i
|
|||||||
char *typestr = expand_type(file, line, str, mode, lmp);
|
char *typestr = expand_type(file, line, str, mode, lmp);
|
||||||
int type = inumeric(file, line, typestr ? typestr : str, false, lmp);
|
int type = inumeric(file, line, typestr ? typestr : str, false, lmp);
|
||||||
if (verify) {
|
if (verify) {
|
||||||
int errorflag = 0;
|
|
||||||
if (type <= 0) errorflag = 1;
|
|
||||||
int nmax;
|
int nmax;
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case Atom::ATOM:
|
case Atom::ATOM:
|
||||||
@ -1024,10 +1022,12 @@ int utils::expand_type_int(const char *file, int line, const std::string &str, i
|
|||||||
case Atom::IMPROPER:
|
case Atom::IMPROPER:
|
||||||
nmax = lmp->atom->nimpropertypes;
|
nmax = lmp->atom->nimpropertypes;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
nmax = 0;
|
||||||
}
|
}
|
||||||
if (type > nmax) errorflag = 1;
|
if ((type <= 0) || (type > nmax))
|
||||||
if (errorflag) lmp->error->all(file, line, "{} type {} is out of bounds ({}-{})",
|
lmp->error->all(file, line, "{} type {} is out of bounds ({}-{})", labeltypes[mode], type, 1,
|
||||||
labeltypes[mode], type, 1, nmax);
|
nmax);
|
||||||
}
|
}
|
||||||
delete[] typestr;
|
delete[] typestr;
|
||||||
return type;
|
return type;
|
||||||
|
|||||||
Reference in New Issue
Block a user