Insight into sbmask()
Bitmask is a widely used technique to validate authority, often using the bitwise AND
operation for fast operations. A well-known example is the subnet mask, which operates on IP addresses in a network and yields the routing prefix. In the context of bonded atoms in LAMMPS, sbmask()
uses the same mechanism to identify whether a particle is linked by a special bond.
In order to analyze bitmask operations in the LAMMPS source code, we now return to the example LAMMPS script (test.in
) and pair_lj_cut.cpp
implemented as pair style lj/cut
. As described in Chapter 4, Accessing Information by Variables, Arrays, and Methods, the ilist
array represents a collection of central atoms to loop over, and the jlist
array represents the corresponding neighbors of each member of ilist
. Recall that in our example LAMMPS script, the cutoff radius is 5.5 units, so the first atom (i=0
) has five pairwise atoms (j
) interacting with it.
A short simulation run is performed and using...