add get_bitmask_by_id() accessor to Group class

This commit is contained in:
Axel Kohlmeyer
2024-02-27 10:16:34 -05:00
parent 4d89741d8c
commit 3ffa5908ca
2 changed files with 17 additions and 0 deletions

View File

@ -623,6 +623,21 @@ int Group::find_unused()
return -1;
}
/* ----------------------------------------------------------------------
return group bitmask for given group id. Error out if group is not found.
------------------------------------------------------------------------- */
int Group::get_bitmask_by_id(const std::string &file, int line, const std::string &name,
const std::string &caller)
{
int igroup = 0;
while (igroup < MAX_GROUP)
if (names[igroup] && (name == names[igroup])) break;
if (igroup == MAX_GROUP)
error->all(file, line, "Group ID {} requested by {} does not exist", name, caller);
return bitmask[igroup];
}
/* ----------------------------------------------------------------------
add atoms to group that are in same molecules as atoms already in group
do not include molID = 0