add find_type function

find integer type from type label
This commit is contained in:
Jacob Gissinger
2020-12-16 17:39:07 -05:00
parent a0911b7563
commit 767584df36
2 changed files with 14 additions and 0 deletions

View File

@ -1754,6 +1754,19 @@ void Atom::allocate_type_labels()
delete [] char_type;
}
/* ----------------------------------------------------------------------
find integer type given a type label
return -1 if type not yet defined
------------------------------------------------------------------------- */
int Atom::find_type(char *typelabel, char **typelabelarray, int num_types)
{
for (int i = 0; i < num_types; i++) {
if (typelabelarray[i] && strcmp(typelabel,typelabelarray[i]) == 0) return i+1;
}
return -1;
}
/* ----------------------------------------------------------------------
set a mass and flag it as set
called from reading of data file