1 "LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c
3 :link(lws,http://lammps.sandia.gov)
5 :link(lc,Section_commands.html#comm)
13 group ID style args :pre
15 ID = user-defined name of the group :ulb,l
16 style = {delete} or {region} or {type} or {id} or {molecule} or {variable} or \
17 {include} or {subtract} or {union} or {intersect} or \
18 {dynamic} or {static} :l
21 {region} args = region-ID
22 {type} or {id} or {molecule}
23 args = list of one or more atom types, atom IDs, or molecule IDs
24 any entry in list can be a sequence formatted as A:B or A:B:C where
25 A = starting index, B = ending index,
26 C = increment between indices, 1 if not specified
28 logical = "<" or "<=" or ">" or ">=" or "==" or "!="
29 value = an atom type or atom ID or molecule ID (depending on {style})
30 args = logical value1 value2
32 value1,value2 = atom types or atom IDs or molecule IDs (depending on {style})
33 {variable} args = variable-name
34 {include} args = molecule
35 molecule = add atoms to group with same molecule ID as atoms already in group
36 {subtract} args = two or more group IDs
37 {union} args = one or more group IDs
38 {intersect} args = two or more group IDs
39 {dynamic} args = parent-ID keyword value ...
40 one or more keyword/value pairs may be appended
41 keyword = {region} or {var} or {every}
42 {region} value = region-ID
43 {var} value = name of variable
44 {every} value = N = update group every this many timesteps
45 {static} = no args :pre
50 group edge region regstrip
53 group sub id 10 25 50 500:1000
54 group sub id 100:10000:10
56 group polyA molecule <> 50 250
57 group hienergy variable eng
58 group hienergy include molecule
59 group boundary subtract all a2 a3
60 group boundary union lower upper
61 group boundary intersect upper flow
63 group mine dynamic all region myRegion every 100 :pre
68 Identify a collection of atoms as belonging to a group. The group ID
69 can then be used in other commands such as "fix"_fix.html,
70 "compute"_compute.html, "dump"_dump.html, or "velocity"_velocity.html
71 to act on those atoms together.
73 If the group ID already exists, the group command adds the specified
76 NOTE: By default groups are static, meaning the atoms are permanently
77 assigned to the group. For example, if the {region} style is used to
78 assign atoms to a group, the atoms will remain in the group even if
79 they later move out of the region. As explained below, the {dynamic}
80 style can be used to make a group dynamic so that a periodic
81 determination is made as to which atoms are in the group. Since many
82 LAMMPS commands operate on groups of atoms, you should think carefully
83 about whether making a group dynamic makes sense for your model.
85 A group with the ID {all} is predefined. All atoms belong to this
86 group. This group cannot be deleted, or made dynamic.
88 The {delete} style removes the named group and un-assigns all atoms
89 that were assigned to that group. Since there is a restriction (see
90 below) that no more than 32 groups can be defined at any time, the
91 {delete} style allows you to remove groups that are no longer needed,
92 so that more can be specified. You cannot delete a group if it has
93 been used to define a current "fix"_fix.html or "compute"_compute.html
96 The {clear} style un-assigns all atoms that were assigned to that
97 group. This may be dangerous to do during a simulation run,
98 e.g. using the "run every"_run.html command if a fix or compute or
99 other operation expects the atoms in the group to remain constant, but
100 LAMMPS does not check for this.
102 The {region} style puts all atoms in the region volume into the group.
103 Note that this is a static one-time assignment. The atoms remain
104 assigned (or not assigned) to the group even in they later move out of
107 The {type}, {id}, and {molecule} styles put all atoms with the
108 specified atom types, atom IDs, or molecule IDs into the group. These
109 3 styles can use arguments specified in one of two formats.
111 The first format is a list of values (types or IDs). For example, the
112 2nd command in the examples above puts all atoms of type 3 or 4 into
113 the group named {water}. Each entry in the list can be a
114 colon-separated sequence A:B or A:B:C, as in two of the examples
115 above. A "sequence" generates a sequence of values (types or IDs),
116 with an optional increment. The first example with 500:1000 has the
117 default increment of 1 and would add all atom IDs from 500 to 1000
118 (inclusive) to the group sub, along with 10,25,50 since they also
119 appear in the list of values. The second example with 100:10000:10
120 uses an increment of 10 and would thus would add atoms IDs
121 100,110,120, ... 9990,10000 to the group sub.
123 The second format is a {logical} followed by one or two values (type
124 or ID). The 7 valid logicals are listed above. All the logicals
125 except <> take a single argument. The 3rd example above adds all
126 atoms with IDs from 1 to 150 to the group named {sub}. The logical <>
127 means "between" and takes 2 arguments. The 4th example above adds all
128 atoms belonging to molecules with IDs from 50 to 250 (inclusive) to
129 the group named polyA.
131 The {variable} style evaluates a variable to determine which atoms to
132 add to the group. It must be an "atom-style variable"_variable.html
133 previously defined in the input script. If the variable evaluates
134 to a non-zero value for a particular atom, then that atom is added
135 to the specified group.
137 Atom-style variables can specify formulas that include thermodynamic
138 quantities, per-atom values such as atom coordinates, or per-atom
139 quantities calculated by computes, fixes, or other variables. They
140 can also include Boolean logic where 2 numeric values are compared to
141 yield a 1 or 0 (effectively a true or false). Thus using the
142 {variable} style, is a general way to flag specific atoms to include
143 or exclude from a group.
145 For example, these lines define a variable "eatom" that calculates the
146 potential energy of each atom and includes it in the group if its
147 potential energy is above the threshhold value -3.0.
149 compute 1 all pe/atom
150 compute 2 all reduce sum c_1
151 thermo_style custom step temp pe c_2
154 variable eatom atom "c_1 > -3.0"
155 group hienergy variable eatom :pre
157 Note that these lines
159 compute 2 all reduce sum c_1
160 thermo_style custom step temp pe c_2
163 are necessary to insure that the "eatom" variable is current when the
164 group command invokes it. Because the eatom variable computes the
165 per-atom energy via the pe/atom compute, it will only be current if a
166 run has been performed which evaluated pairwise energies, and the
167 pe/atom compute was actually invoked during the run. Printing the
168 thermodyanmic info for compute 2 insures that this is the case, since
169 it sums the pe/atom compute values (in the reduce compute) to output
170 them to the screen. See the "Variable Accuracy" section of the
171 "variable"_variable.html doc page for more details on insuring that
172 variables are current when they are evaluated between runs.
174 The {include} style with its arg {molecule} adds atoms to a group that
175 have the same molecule ID as atoms already in the group. The molecule
176 ID = 0 is ignored in this operation, since it is assumed to flag
177 isolated atoms that are not part of molecules. An example of where
178 this operation is useful is if the {region} style has been used
179 previously to add atoms to a group that are within a geometric region.
180 If molecules straddle the region boundary, then atoms outside the
181 region that are part of molecules with atoms inside the region will
182 not be in the group. Using the group command a 2nd time with {include
183 molecule} will add those atoms that are outside the region to the
186 NOTE: The {include molecule} operation is relatively expensive in a
187 parallel sense. This is because it requires communication of relevant
188 molecule IDs between all the processors and each processor to loop
189 over its atoms once per processor, to compare its atoms to the list of
190 molecule IDs from every other processor. Hence it scales as N, rather
191 than N/P as most of the group operations do, where N is the number of
192 atoms, and P is the number of processors.
194 The {subtract} style takes a list of two or more existing group names
195 as arguments. All atoms that belong to the 1st group, but not to any
196 of the other groups are added to the specified group.
198 The {union} style takes a list of one or more existing group names as
199 arguments. All atoms that belong to any of the listed groups are
200 added to the specified group.
202 The {intersect} style takes a list of two or more existing group names
203 as arguments. Atoms that belong to every one of the listed groups are
204 added to the specified group.
208 The {dynamic} style flags an existing or new group as dynamic. This
209 means atoms will be (re)assigned to the group periodically as a
210 simulation runs. This is in contrast to static groups where atoms are
211 permanently assigned to the group. The way the assignment occurs is
212 as follows. Only atoms in the group specified as the parent group via
213 the parent-ID are assigned to the dynamic group before the following
214 conditions are applied. If the {region} keyword is used, atoms not in
215 the specified region are removed from the dynamic group. If the {var}
216 keyword is used, the variable name must be an atom-style or
217 atomfile-style variable. The variable is evaluated and atoms whose
218 per-atom values are 0.0, are removed from the dynamic group.
220 The assignment of atoms to a dynamic group is done at the beginning of
221 each run and on every timestep that is a multiple of {N}, which is the
222 argument for the {every} keyword (N = 1 is the default). For an
223 energy minimization, via the "minimize"_minimize.html command, an
224 assignment is made at the beginning of the minimization, but not
225 during the iterations of the minimizer.
227 The point in the timestep at which atoms are assigned to a dynamic
228 group is after the initial stage of velocity Verlet time integration
229 has been performed, and before neighbor lists or forces are computed.
230 This is the point in the timestep where atom positions have just
231 changed due to the time integration, so the region criterion should be
232 accurate, if applied.
234 NOTE: If the {region} keyword is used to determine what atoms are in
235 the dynamic group, atoms can move outside of the simulation box
236 between reneighboring events. Thus if you want to include all atoms
237 on the left side of the simulation box, you probably want to set the
238 left boundary of the region to be outside the simulation box by some
239 reasonable amount (e.g. up to the cutoff of the potential), else they
240 may be excluded from the dynamic region.
242 Here is an example of using a dynamic group to shrink the set of atoms
243 being integrated by using a spherical region with a variable radius
244 (shrinking from 18 to 5 over the course of the run). This could be
245 used to model a quench of the system, freezing atoms outside the
246 shrinking sphere, then converting the remaining atoms to a static
247 group and running further.
249 variable nsteps equal 5000
250 variable rad equal 18-(step/v_nsteps)*(18-5)
251 region ss sphere 20 20 0 v_rad
252 group mobile dynamic all region ss
258 NOTE: All fixes and computes take a group ID as an argument, but they
259 do not all allow for use of a dynamic group. If you get an error
260 message that this is not allowed, but feel that it should be for the
261 fix or compute in question, then please post your reasoning to the
262 LAMMPS mail list and we can change it.
264 The {static} style removes the setting for a dynamic group, converting
265 it to a static group (the default). The atoms in the static group are
266 those currently in the dynamic group.
272 There can be no more than 32 groups defined at one time, including
275 The parent group of a dynamic group cannot itself be a dynamic group.
279 "dump"_dump.html, "fix"_fix.html, "region"_region.html,
280 "velocity"_velocity.html
284 All atoms belong to the "all" group.