group command

Warning

This command is deprecated, please use define_group and/or the delete_group instead

Syntax

group ID style args
  • ID = user-defined name of the group

  • style = delete or region or type or material or id or molecule or variable or subtract or union or intersect or initialize or update_every_time

delete = no args
region args = region-ID
  all_in = yes or no
type or material or id or molecule
  args = list of one or more particle types, material, particle IDs, or molecule IDs
    any entry in list can be a sequence formatted as A:B or A:B:C where
    A = starting index, B = ending index,
    C = increment between indices, 1 if not specified
  args = logical value
    logical = "<" or "<=" or ">" or ">=" or "==" or "!="
    value = a particle type, material or particle ID or molecule ID (depending on style)
  args = logical value1 value2
    logical = "<>"
    value1,value2 = particle types, materials or particle IDs or molecule IDs (depending on style)
variable args  = variable-ID
subtract args = two or more group IDs
union args = one or more group IDs
intersect args = two or more group IDs
initialize args = no args
update_every_time args = period
    period = time interval between two consecutive group updates

Examples

group edge region regstrip
group edge region edge_reg all_in yes
group water material fluid wet_fluid
group sub id 10 25 50
group sub id 10 25 50 500:1000
group sub id 100:10000:10
group sub id <= 150
group polyA molecule <> 50 250
group hienergy variable eng
group boundary subtract all a2 a3
group boundary union lower upper
group boundary intersect upper flow
group boundary delete
group groupA initialize
group tempGroup variable tempFlag update_every_time 0.01

Description

Identify a collection of particles as belonging to a group. The group ID can then be used in other commands such as fix, compute, dump, or velocity to act on those particles together.

If the group ID already exists, the group command adds the specified particles to the group.

The delete style removes the named group and un-assigns all particles that were assigned to that group. Since there is a restriction (see below) that no more than 32 groups can be defined at any time, the delete style allows you to remove groups that are no longer needed, so that more can be specified. You cannot delete a group if it has been used to define a current fix or compute or dump.

If the update_every_time is set, the group will dynamically be updated with the given time frequency. Note that this might lead to unexpected results when a command expects the group to remain static during the simulation. By default a group is created by a static one-time assignment.

The region style puts all particles in the region volume into the group. If the group is static, the particles remain assigned (or not assigned) to the group even in they later move out of the region volume. region also accepts an optional all_in keyword. This keyword controls whether only the particle center (all_in off, default) or the whole particle (all_in yes) needs to be inside the region in order to be added to the group.

The type, material, id, and molecule styles put all particles with the specified particle types, materials, particle IDs, or molecule IDs into the group. These four styles can use arguments specified in one of two formats.

The first format is a list of values (materials or IDs). For example, the 2nd command in the examples above puts all particles with materials fluid and wet_fluid into the group named water. Each entry in the list can be a colon-separated sequence A:B or A:B:C, as in two of the examples above. A “sequence” generates a sequence of values (materials or IDs), with an optional increment. The first example with 500:1000 has the default increment of 1 and would add all particle IDs from 500 to 1000 (inclusive) to the group sub, along with 10,25,50 since they also appear in the list of values. The second example with 100:10000:10 uses an increment of 10 and would thus would add particles IDs 100,110,120, … 9990,10000 to the group sub.

The second format is a logical followed by one or two values (material or ID). The 7 valid logicals are listed above. All the logicals except <> take a single argument. The 3rd example above adds all particles with IDs from 1 to 150 to the group named sub. The logical <> means “between” and takes 2 arguments. The 4th example above adds all particles belonging to molecules with IDs from 50 to 250 (inclusive) to the group named polyA.

The variable style evaluates a variable to determine which particles to add to the group. It must be an atom-style variable previously defined in the input script. If the variable evaluates to a non-zero value for a particular particle, then that particle is added to the specified group.

Atom-style variables can specify formulas that include thermodynamic quantities, per-particle values such as particle coordinates, or per-particle quantities calculated by computes, fixes, or other variables. They can also include Boolean logic where 2 numeric values are compared to yield a 1 or 0 (effectively a true or false). Thus using the variable style, is a general way to flag specific particles to include or exclude from a group.

For example, these lines define a variable mag_vx that calculates the absolute value of the x velocity. and includes it in the group if its value is greater than 3.

variable        mag_vx atom "abs(vx) > 3"
group           high_vx variable mag_vx

The subtract style takes a list of two or more existing group names as arguments. All particles that belong to the 1st group, but not to any of the other groups are added to the specified group.

The union style takes a list of one or more existing group names as arguments. All particles that belong to any of the listed groups are added to the specified group.

The intersect style takes a list of two or more existing group names as arguments. Atoms that belong to every one of the listed groups are added to the specified group.

The initialize style creates a new empty group if it does not already exist. This is in particular useful in combination with particletemplates to allow separate integrators for different groups.

A group with the ID all is predefined. All particles belong to this group. This group cannot be deleted.

Restrictions

There can be no more than 32 groups defined at one time, including “all”.

Default

All particles belong to the “all” group.