[lammps-users] mask[i] & groupbit

Hello,

I'm writing some extensions similar to compute_stress_atom.cpp for Lammps to be used in our simulations. When I was reading this program, what I don't feel clear is why we have to test two flags mask[i]&groupbit and mask[j]&groupbit (line 162 and 167 in compute_stress_atom.cpp, for instance); can anyone tell me what do they imply here?

Thanks and regards!

Xiang Gu

Xiang Gu,

LAMMPS allows you define groups using the 'group' command in input scripts
(see documentation). This command functions through assigning a designated
bit to the defined group. All these bits are stored on a per atom basis in
atom->mask[]. Commands like 'compute' and 'stress' allow you to operate on
a subset of atoms defined by 'group'. This subset is translated to the
variable groupbit within these modules. Thus, the check on flags assures
the operation of that particular module on the selected group.

Pieter

The test on the 2 mask values insures both atoms in the pair
are in the compute group, which is the only atom pairs
for which the stress is accumulated.

Steve