add group style to create an empty group directly

This commit is contained in:
Axel Kohlmeyer
2018-02-13 14:54:30 +01:00
parent 63714c7079
commit 1a213363f1
2 changed files with 13 additions and 1 deletions

View File

@ -13,11 +13,13 @@ group command :h3
group ID style args :pre group ID style args :pre
ID = user-defined name of the group :ulb,l ID = user-defined name of the group :ulb,l
style = {delete} or {region} or {type} or {id} or {molecule} or {variable} or \ style = {delete} or {clear} or {empty} or {region} or \
{type} or {id} or {molecule} or {variable} or \
{include} or {subtract} or {union} or {intersect} or \ {include} or {subtract} or {union} or {intersect} or \
{dynamic} or {static} :l {dynamic} or {static} :l
{delete} = no args {delete} = no args
{clear} = no args {clear} = no args
{empty} = no args
{region} args = region-ID {region} args = region-ID
{type} or {id} or {molecule} {type} or {id} or {molecule}
args = list of one or more atom types, atom IDs, or molecule IDs args = list of one or more atom types, atom IDs, or molecule IDs
@ -99,6 +101,10 @@ e.g. using the "run every"_run.html command if a fix or compute or
other operation expects the atoms in the group to remain constant, but other operation expects the atoms in the group to remain constant, but
LAMMPS does not check for this. LAMMPS does not check for this.
The {empty} style creates an empty group, which is useful for commands
like "fix gcmc"_fix_gcmc.html or with complex scripts that add atoms
to a group.
The {region} style puts all atoms in the region volume into the group. The {region} style puts all atoms in the region volume into the group.
Note that this is a static one-time assignment. The atoms remain Note that this is a static one-time assignment. The atoms remain
assigned (or not assigned) to the group even in they later move out of assigned (or not assigned) to the group even in they later move out of

View File

@ -188,6 +188,12 @@ void Group::assign(int narg, char **arg)
if (domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2])) if (domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2]))
mask[i] |= bit; mask[i] |= bit;
// create an empty group
} else if (strcmp(arg[1],"empty") == 0) {
; // nothing to do here
// style = type, molecule, id // style = type, molecule, id
// add to group if atom matches type/molecule/id or condition // add to group if atom matches type/molecule/id or condition