add find_type function
find integer type from type label
This commit is contained in:
13
src/atom.cpp
13
src/atom.cpp
@ -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
|
||||
|
||||
Reference in New Issue
Block a user