add get_bitmask_by_id() accessor to Group class
This commit is contained in:
@ -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
|
||||
|
||||
@ -31,11 +31,13 @@ class Group : protected Pointers {
|
||||
|
||||
Group(class LAMMPS *);
|
||||
~Group() override;
|
||||
|
||||
void assign(int, char **); // assign atoms to a group
|
||||
void assign(const std::string &); // convenience function
|
||||
void create(const std::string &, int *); // add flagged atoms to a group
|
||||
int find(const std::string &); // lookup name in list of groups
|
||||
int find_or_create(const char *); // lookup name or create new group
|
||||
int get_bitmask_by_id(const std::string &, int, const std::string &, const std::string &);
|
||||
void write_restart(FILE *);
|
||||
void read_restart(FILE *);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user