valid numeric type strings can include *

This commit is contained in:
Jacob Gissinger
2021-01-26 22:55:19 -05:00
parent 5d2e3b3ecb
commit 0b4256e67a
2 changed files with 7 additions and 2 deletions

View File

@ -662,12 +662,15 @@ void Input::substitute(char *&str, char *&str2, int &max, int &max2, int flag)
/* ----------------------------------------------------------------------
substitute type labels with numeric value
reallocate str to hold expanded version if necessary
if type already starts with a number, do not modify
if type is a valid numerical string (can include *), do not modify
------------------------------------------------------------------------- */
void Input::readtype(char *&str, int mode)
{
if (isdigit(str[0])) return;
int numflag = 1;
for (int i = 0; i < strlen(str); i++)
if (!isdigit(str[i]) && str[i] != '*') numflag = 0;
if (numflag) return;
if (!atom->labelmapflag) error->all(FLERR,fmt::format("Invalid type {}",str));
int type,max,max2;

View File

@ -219,6 +219,8 @@ int LabelMap::find(std::string mylabel, int mode)
if (mode == IMPROPER)
return search(mylabel,itypelabel,nimpropertypes);
return -1;
}
/* ----------------------------------------------------------------------