Discovering the Group class
In this section, we will discuss the source code in group.cpp
that's responsible for controlling groups of atoms via the Group
class (see https://lammps.sandia.gov/doc/group.html).
Using groups, a set of atoms can be combined as one collective group, which facilitates uniform treatment of the group members when applying fixes. It also allows mathematical operations to be performed on the group.
Groups can be defined based on criteria such as the type and region of atoms, and atoms are registered to groups using the assign()
method. The following code snippet illustrates grouping atoms by region occupied:
By looping over all the atoms in the core (line 187), the atoms located in a given region with a region ID, iregion
, are selected via bitwise operation (line 189).
The following screenshot shows the union of multiple groups...