Page MenuHomec4science

group.html
No OneTemporary

File Metadata

Created
Fri, Jul 5, 05:02

group.html

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>group command &mdash; LAMMPS documentation</title>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/sphinxcontrib-images/LightBox2/lightbox2/css/lightbox.css" type="text/css" />
<link rel="top" title="LAMMPS documentation" href="index.html"/>
<link rel="up" title="Commands" href="commands.html"/>
<link rel="next" title="group2ndx command" href="group2ndx.html"/>
<link rel="prev" title="fix_modify command" href="fix_modify.html"/>
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-nav-search">
<a href="Manual.html" class="icon icon-home"> LAMMPS
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption"><span class="caption-text">User Documentation</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="Section_intro.html">1. Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_start.html">2. Getting Started</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_commands.html">3. Commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_packages.html">4. Packages</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_accelerate.html">5. Accelerating LAMMPS performance</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_howto.html">6. How-to discussions</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_example.html">7. Example problems</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_perf.html">8. Performance &amp; scalability</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_tools.html">9. Additional tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_modify.html">10. Modifying &amp; extending LAMMPS</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_python.html">11. Python interface to LAMMPS</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_errors.html">12. Errors</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_history.html">13. Future and history</a></li>
</ul>
<p class="caption"><span class="caption-text">Index</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="tutorials.html">Tutorials</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="commands.html">Commands</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="angle_coeff.html">angle_coeff command</a></li>
<li class="toctree-l2"><a class="reference internal" href="angle_style.html">angle_style command</a></li>
<li class="toctree-l2"><a class="reference internal" href="atom_modify.html">atom_modify command</a></li>
<li class="toctree-l2"><a class="reference internal" href="atom_style.html">atom_style command</a></li>
<li class="toctree-l2"><a class="reference internal" href="balance.html">balance command</a></li>
<li class="toctree-l2"><a class="reference internal" href="bond_coeff.html">bond_coeff command</a></li>
<li class="toctree-l2"><a class="reference internal" href="bond_style.html">bond_style command</a></li>
<li class="toctree-l2"><a class="reference internal" href="bond_write.html">bond_write command</a></li>
<li class="toctree-l2"><a class="reference internal" href="boundary.html">boundary command</a></li>
<li class="toctree-l2"><a class="reference internal" href="box.html">box command</a></li>
<li class="toctree-l2"><a class="reference internal" href="change_box.html">change_box command</a></li>
<li class="toctree-l2"><a class="reference internal" href="clear.html">clear command</a></li>
<li class="toctree-l2"><a class="reference internal" href="comm_modify.html">comm_modify command</a></li>
<li class="toctree-l2"><a class="reference internal" href="comm_style.html">comm_style command</a></li>
<li class="toctree-l2"><a class="reference internal" href="compute.html">compute command</a></li>
<li class="toctree-l2"><a class="reference internal" href="compute_modify.html">compute_modify command</a></li>
<li class="toctree-l2"><a class="reference internal" href="create_atoms.html">create_atoms command</a></li>
<li class="toctree-l2"><a class="reference internal" href="create_bonds.html">create_bonds command</a></li>
<li class="toctree-l2"><a class="reference internal" href="create_box.html">create_box command</a></li>
<li class="toctree-l2"><a class="reference internal" href="delete_atoms.html">delete_atoms command</a></li>
<li class="toctree-l2"><a class="reference internal" href="delete_bonds.html">delete_bonds command</a></li>
<li class="toctree-l2"><a class="reference internal" href="dielectric.html">dielectric command</a></li>
<li class="toctree-l2"><a class="reference internal" href="dihedral_coeff.html">dihedral_coeff command</a></li>
<li class="toctree-l2"><a class="reference internal" href="dihedral_style.html">dihedral_style command</a></li>
<li class="toctree-l2"><a class="reference internal" href="dimension.html">dimension command</a></li>
<li class="toctree-l2"><a class="reference internal" href="displace_atoms.html">displace_atoms command</a></li>
<li class="toctree-l2"><a class="reference internal" href="dump.html">dump command</a></li>
<li class="toctree-l2"><a class="reference internal" href="dump.html#dump-custom-vtk-command"><code class="docutils literal"><span class="pre">dump</span> <span class="pre">custom/vtk</span></code> command</a></li>
<li class="toctree-l2"><a class="reference internal" href="dump.html#dump-h5md-command"><code class="docutils literal"><span class="pre">dump</span> <span class="pre">h5md</span></code> command</a></li>
<li class="toctree-l2"><a class="reference internal" href="dump.html#dump-image-command"><code class="docutils literal"><span class="pre">dump</span> <span class="pre">image</span></code> command</a></li>
<li class="toctree-l2"><a class="reference internal" href="dump.html#dump-movie-command"><code class="docutils literal"><span class="pre">dump</span> <span class="pre">movie</span></code> command</a></li>
<li class="toctree-l2"><a class="reference internal" href="dump.html#dump-molfile-command"><code class="docutils literal"><span class="pre">dump</span> <span class="pre">molfile</span></code> command</a></li>
<li class="toctree-l2"><a class="reference internal" href="dump_custom_vtk.html">dump custom/vtk command</a></li>
<li class="toctree-l2"><a class="reference internal" href="dump_h5md.html">dump h5md command</a></li>
<li class="toctree-l2"><a class="reference internal" href="dump_image.html">dump image command</a></li>
<li class="toctree-l2"><a class="reference internal" href="dump_image.html#dump-movie-command">dump movie command</a></li>
<li class="toctree-l2"><a class="reference internal" href="dump_modify.html">dump_modify command</a></li>
<li class="toctree-l2"><a class="reference internal" href="dump_molfile.html">dump molfile command</a></li>
<li class="toctree-l2"><a class="reference internal" href="echo.html">echo command</a></li>
<li class="toctree-l2"><a class="reference internal" href="fix.html">fix command</a></li>
<li class="toctree-l2"><a class="reference internal" href="fix_modify.html">fix_modify command</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">group command</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#syntax">Syntax</a></li>
<li class="toctree-l3"><a class="reference internal" href="#examples">Examples</a></li>
<li class="toctree-l3"><a class="reference internal" href="#description">Description</a></li>
<li class="toctree-l3"><a class="reference internal" href="#restrictions">Restrictions</a></li>
<li class="toctree-l3"><a class="reference internal" href="#related-commands">Related commands</a></li>
<li class="toctree-l3"><a class="reference internal" href="#default">Default</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="group2ndx.html">group2ndx command</a></li>
<li class="toctree-l2"><a class="reference internal" href="group2ndx.html#ndx2group-command">ndx2group command</a></li>
<li class="toctree-l2"><a class="reference internal" href="if.html">if command</a></li>
<li class="toctree-l2"><a class="reference internal" href="improper_coeff.html">improper_coeff command</a></li>
<li class="toctree-l2"><a class="reference internal" href="improper_style.html">improper_style command</a></li>
<li class="toctree-l2"><a class="reference internal" href="include.html">include command</a></li>
<li class="toctree-l2"><a class="reference internal" href="info.html">info command</a></li>
<li class="toctree-l2"><a class="reference internal" href="jump.html">jump command</a></li>
<li class="toctree-l2"><a class="reference internal" href="kspace_modify.html">kspace_modify command</a></li>
<li class="toctree-l2"><a class="reference internal" href="kspace_style.html">kspace_style command</a></li>
<li class="toctree-l2"><a class="reference internal" href="label.html">label command</a></li>
<li class="toctree-l2"><a class="reference internal" href="lattice.html">lattice command</a></li>
<li class="toctree-l2"><a class="reference internal" href="log.html">log command</a></li>
<li class="toctree-l2"><a class="reference internal" href="mass.html">mass command</a></li>
<li class="toctree-l2"><a class="reference internal" href="min_modify.html">min_modify command</a></li>
<li class="toctree-l2"><a class="reference internal" href="min_style.html">min_style command</a></li>
<li class="toctree-l2"><a class="reference internal" href="minimize.html">minimize command</a></li>
<li class="toctree-l2"><a class="reference internal" href="molecule.html">molecule command</a></li>
<li class="toctree-l2"><a class="reference internal" href="neb.html">neb command</a></li>
<li class="toctree-l2"><a class="reference internal" href="neigh_modify.html">neigh_modify command</a></li>
<li class="toctree-l2"><a class="reference internal" href="neighbor.html">neighbor command</a></li>
<li class="toctree-l2"><a class="reference internal" href="newton.html">newton command</a></li>
<li class="toctree-l2"><a class="reference internal" href="next.html">next command</a></li>
<li class="toctree-l2"><a class="reference internal" href="package.html">package command</a></li>
<li class="toctree-l2"><a class="reference internal" href="pair_coeff.html">pair_coeff command</a></li>
<li class="toctree-l2"><a class="reference internal" href="pair_modify.html">pair_modify command</a></li>
<li class="toctree-l2"><a class="reference internal" href="pair_style.html">pair_style command</a></li>
<li class="toctree-l2"><a class="reference internal" href="pair_write.html">pair_write command</a></li>
<li class="toctree-l2"><a class="reference internal" href="partition.html">partition command</a></li>
<li class="toctree-l2"><a class="reference internal" href="prd.html">prd command</a></li>
<li class="toctree-l2"><a class="reference internal" href="print.html">print command</a></li>
<li class="toctree-l2"><a class="reference internal" href="processors.html">processors command</a></li>
<li class="toctree-l2"><a class="reference internal" href="python.html">python command</a></li>
<li class="toctree-l2"><a class="reference internal" href="quit.html">quit command</a></li>
<li class="toctree-l2"><a class="reference internal" href="read_data.html">read_data command</a></li>
<li class="toctree-l2"><a class="reference internal" href="read_dump.html">read_dump command</a></li>
<li class="toctree-l2"><a class="reference internal" href="read_restart.html">read_restart command</a></li>
<li class="toctree-l2"><a class="reference internal" href="region.html">region command</a></li>
<li class="toctree-l2"><a class="reference internal" href="replicate.html">replicate command</a></li>
<li class="toctree-l2"><a class="reference internal" href="rerun.html">rerun command</a></li>
<li class="toctree-l2"><a class="reference internal" href="reset_timestep.html">reset_timestep command</a></li>
<li class="toctree-l2"><a class="reference internal" href="restart.html">restart command</a></li>
<li class="toctree-l2"><a class="reference internal" href="run.html">run command</a></li>
<li class="toctree-l2"><a class="reference internal" href="run_style.html">run_style command</a></li>
<li class="toctree-l2"><a class="reference internal" href="set.html">set command</a></li>
<li class="toctree-l2"><a class="reference internal" href="shell.html">shell command</a></li>
<li class="toctree-l2"><a class="reference internal" href="special_bonds.html">special_bonds command</a></li>
<li class="toctree-l2"><a class="reference internal" href="suffix.html">suffix command</a></li>
<li class="toctree-l2"><a class="reference internal" href="tad.html">tad command</a></li>
<li class="toctree-l2"><a class="reference internal" href="temper.html">temper command</a></li>
<li class="toctree-l2"><a class="reference internal" href="thermo.html">thermo command</a></li>
<li class="toctree-l2"><a class="reference internal" href="thermo_modify.html">thermo_modify command</a></li>
<li class="toctree-l2"><a class="reference internal" href="thermo_style.html">thermo_style command</a></li>
<li class="toctree-l2"><a class="reference internal" href="timer.html">timer command</a></li>
<li class="toctree-l2"><a class="reference internal" href="timestep.html">timestep command</a></li>
<li class="toctree-l2"><a class="reference internal" href="uncompute.html">uncompute command</a></li>
<li class="toctree-l2"><a class="reference internal" href="undump.html">undump command</a></li>
<li class="toctree-l2"><a class="reference internal" href="unfix.html">unfix command</a></li>
<li class="toctree-l2"><a class="reference internal" href="units.html">units command</a></li>
<li class="toctree-l2"><a class="reference internal" href="variable.html">variable command</a></li>
<li class="toctree-l2"><a class="reference internal" href="velocity.html">velocity command</a></li>
<li class="toctree-l2"><a class="reference internal" href="write_coeff.html">write_coeff command</a></li>
<li class="toctree-l2"><a class="reference internal" href="write_data.html">write_data command</a></li>
<li class="toctree-l2"><a class="reference internal" href="write_dump.html">write_dump command</a></li>
<li class="toctree-l2"><a class="reference internal" href="write_restart.html">write_restart command</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="fixes.html">Fixes</a></li>
<li class="toctree-l1"><a class="reference internal" href="computes.html">Computes</a></li>
<li class="toctree-l1"><a class="reference internal" href="pairs.html">Pair Styles</a></li>
<li class="toctree-l1"><a class="reference internal" href="bonds.html">Bond Styles</a></li>
<li class="toctree-l1"><a class="reference internal" href="angles.html">Angle Styles</a></li>
<li class="toctree-l1"><a class="reference internal" href="dihedrals.html">Dihedral Styles</a></li>
<li class="toctree-l1"><a class="reference internal" href="impropers.html">Improper Styles</a></li>
</ul>
</div>
&nbsp;
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="Manual.html">LAMMPS</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="Manual.html">Docs</a> &raquo;</li>
<li><a href="commands.html">Commands</a> &raquo;</li>
<li>group command</li>
<li class="wy-breadcrumbs-aside">
<a href="http://lammps.sandia.gov">Website</a>
<a href="Section_commands.html#comm">Commands</a>
</li>
</ul>
<hr/>
<div class="rst-footer-buttons" style="margin-bottom: 1em" role="navigation" aria-label="footer navigation">
<a href="group2ndx.html" class="btn btn-neutral float-right" title="group2ndx command" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="fix_modify.html" class="btn btn-neutral" title="fix_modify command" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="group-command">
<span id="index-0"></span><h1>group command</h1>
<div class="section" id="syntax">
<h2>Syntax</h2>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">group</span> <span class="n">ID</span> <span class="n">style</span> <span class="n">args</span>
</pre></div>
</div>
<ul>
<li><p class="first">ID = user-defined name of the group</p>
</li>
<li><p class="first">style = <em>delete</em> or <em>region</em> or <em>type</em> or <em>id</em> or <em>molecule</em> or <em>variable</em> or <em>include</em> or <em>subtract</em> or <em>union</em> or <em>intersect</em> or <em>dynamic</em> or <em>static</em></p>
<pre class="literal-block">
<em>delete</em> = no args
<em>clear</em> = no args
<em>region</em> args = region-ID
<em>type</em> or <em>id</em> or <em>molecule</em>
args = list of one or more atom types, atom 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 = &quot;&lt;&quot; or &quot;&lt;=&quot; or &quot;&gt;&quot; or &quot;&gt;=&quot; or &quot;==&quot; or &quot;!=&quot;
value = an atom type or atom ID or molecule ID (depending on <em>style</em>)
args = logical value1 value2
logical = &quot;&lt;&gt;&quot;
value1,value2 = atom types or atom IDs or molecule IDs (depending on <em>style</em>)
<em>variable</em> args = variable-name
<em>include</em> args = molecule
molecule = add atoms to group with same molecule ID as atoms already in group
<em>subtract</em> args = two or more group IDs
<em>union</em> args = one or more group IDs
<em>intersect</em> args = two or more group IDs
<em>dynamic</em> args = parent-ID keyword value ...
one or more keyword/value pairs may be appended
keyword = <em>region</em> or <em>var</em> or <em>every</em>
<em>region</em> value = region-ID
<em>var</em> value = name of variable
<em>every</em> value = N = update group every this many timesteps
<em>static</em> = no args
</pre>
</li>
</ul>
</div>
<div class="section" id="examples">
<h2>Examples</h2>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">group</span> <span class="n">edge</span> <span class="n">region</span> <span class="n">regstrip</span>
<span class="n">group</span> <span class="n">water</span> <span class="nb">type</span> <span class="mi">3</span> <span class="mi">4</span>
<span class="n">group</span> <span class="n">sub</span> <span class="nb">id</span> <span class="mi">10</span> <span class="mi">25</span> <span class="mi">50</span>
<span class="n">group</span> <span class="n">sub</span> <span class="nb">id</span> <span class="mi">10</span> <span class="mi">25</span> <span class="mi">50</span> <span class="mi">500</span><span class="p">:</span><span class="mi">1000</span>
<span class="n">group</span> <span class="n">sub</span> <span class="nb">id</span> <span class="mi">100</span><span class="p">:</span><span class="mi">10000</span><span class="p">:</span><span class="mi">10</span>
<span class="n">group</span> <span class="n">sub</span> <span class="nb">id</span> <span class="o">&lt;=</span> <span class="mi">150</span>
<span class="n">group</span> <span class="n">polyA</span> <span class="n">molecule</span> <span class="o">&lt;&gt;</span> <span class="mi">50</span> <span class="mi">250</span>
<span class="n">group</span> <span class="n">hienergy</span> <span class="n">variable</span> <span class="n">eng</span>
<span class="n">group</span> <span class="n">hienergy</span> <span class="n">include</span> <span class="n">molecule</span>
<span class="n">group</span> <span class="n">boundary</span> <span class="n">subtract</span> <span class="nb">all</span> <span class="n">a2</span> <span class="n">a3</span>
<span class="n">group</span> <span class="n">boundary</span> <span class="n">union</span> <span class="n">lower</span> <span class="n">upper</span>
<span class="n">group</span> <span class="n">boundary</span> <span class="n">intersect</span> <span class="n">upper</span> <span class="n">flow</span>
<span class="n">group</span> <span class="n">boundary</span> <span class="n">delete</span>
<span class="n">group</span> <span class="n">mine</span> <span class="n">dynamic</span> <span class="nb">all</span> <span class="n">region</span> <span class="n">myRegion</span> <span class="n">every</span> <span class="mi">100</span>
</pre></div>
</div>
</div>
<div class="section" id="description">
<h2>Description</h2>
<p>Identify a collection of atoms as belonging to a group. The group ID
can then be used in other commands such as <a class="reference internal" href="fix.html"><span class="doc">fix</span></a>,
<a class="reference internal" href="compute.html"><span class="doc">compute</span></a>, <a class="reference internal" href="dump.html"><span class="doc">dump</span></a>, or <a class="reference internal" href="velocity.html"><span class="doc">velocity</span></a>
to act on those atoms together.</p>
<p>If the group ID already exists, the group command adds the specified
atoms to the group.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">By default groups are static, meaning the atoms are permanently
assigned to the group. For example, if the <em>region</em> style is used to
assign atoms to a group, the atoms will remain in the group even if
they later move out of the region. As explained below, the <em>dynamic</em>
style can be used to make a group dynamic so that a periodic
determination is made as to which atoms are in the group. Since many
LAMMPS commands operate on groups of atoms, you should think carefully
about whether making a group dynamic makes sense for your model.</p>
</div>
<p>A group with the ID <em>all</em> is predefined. All atoms belong to this
group. This group cannot be deleted, or made dynamic.</p>
<p>The <em>delete</em> style removes the named group and un-assigns all atoms
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
<em>delete</em> 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 <a class="reference internal" href="fix.html"><span class="doc">fix</span></a> or <a class="reference internal" href="compute.html"><span class="doc">compute</span></a>
or <a class="reference internal" href="dump.html"><span class="doc">dump</span></a>.</p>
<p>The <em>clear</em> style un-assigns all atoms that were assigned to that
group. This may be dangerous to do during a simulation run,
e.g. using the <a class="reference internal" href="run.html"><span class="doc">run every</span></a> command if a fix or compute or
other operation expects the atoms in the group to remain constant, but
LAMMPS does not check for this.</p>
<p>The <em>region</em> style puts all atoms in the region volume into the group.
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
the region volume.</p>
<p>The <em>type</em>, <em>id</em>, and <em>molecule</em> styles put all atoms with the
specified atom types, atom IDs, or molecule IDs into the group. These
3 styles can use arguments specified in one of two formats.</p>
<p>The first format is a list of values (types or IDs). For example, the
2nd command in the examples above puts all atoms of type 3 or 4 into
the group named <em>water</em>. 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 &#8220;sequence&#8221; generates a sequence of values (types or IDs),
with an optional increment. The first example with 500:1000 has the
default increment of 1 and would add all atom 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 atoms IDs
100,110,120, ... 9990,10000 to the group sub.</p>
<p>The second format is a <em>logical</em> followed by one or two values (type
or ID). The 7 valid logicals are listed above. All the logicals
except &lt;&gt; take a single argument. The 3rd example above adds all
atoms with IDs from 1 to 150 to the group named <em>sub</em>. The logical &lt;&gt;
means &#8220;between&#8221; and takes 2 arguments. The 4th example above adds all
atoms belonging to molecules with IDs from 50 to 250 (inclusive) to
the group named polyA.</p>
<p>The <em>variable</em> style evaluates a variable to determine which atoms to
add to the group. It must be an <a class="reference internal" href="variable.html"><span class="doc">atom-style variable</span></a>
previously defined in the input script. If the variable evaluates
to a non-zero value for a particular atom, then that atom is added
to the specified group.</p>
<p>Atom-style variables can specify formulas that include thermodynamic
quantities, per-atom values such as atom coordinates, or per-atom
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
<em>variable</em> style, is a general way to flag specific atoms to include
or exclude from a group.</p>
<p>For example, these lines define a variable &#8220;eatom&#8221; that calculates the
potential energy of each atom and includes it in the group if its
potential energy is above the threshhold value -3.0.</p>
<pre class="literal-block">
compute 1 all pe/atom
compute 2 all reduce sum c_1
thermo_style custom step temp pe c_2
run 0
</pre>
<pre class="literal-block">
variable eatom atom &quot;c_1 &gt; -3.0&quot;
group hienergy variable eatom
</pre>
<p>Note that these lines</p>
<pre class="literal-block">
compute 2 all reduce sum c_1
thermo_style custom step temp pe c_2
run 0
</pre>
<p>are necessary to insure that the &#8220;eatom&#8221; variable is current when the
group command invokes it. Because the eatom variable computes the
per-atom energy via the pe/atom compute, it will only be current if a
run has been performed which evaluated pairwise energies, and the
pe/atom compute was actually invoked during the run. Printing the
thermodyanmic info for compute 2 insures that this is the case, since
it sums the pe/atom compute values (in the reduce compute) to output
them to the screen. See the &#8220;Variable Accuracy&#8221; section of the
<a class="reference internal" href="variable.html"><span class="doc">variable</span></a> doc page for more details on insuring that
variables are current when they are evaluated between runs.</p>
<p>The <em>include</em> style with its arg <em>molecule</em> adds atoms to a group that
have the same molecule ID as atoms already in the group. The molecule
ID = 0 is ignored in this operation, since it is assumed to flag
isolated atoms that are not part of molecules. An example of where
this operation is useful is if the <em>region</em> style has been used
previously to add atoms to a group that are within a geometric region.
If molecules straddle the region boundary, then atoms outside the
region that are part of molecules with atoms inside the region will
not be in the group. Using the group command a 2nd time with <em>include
molecule</em> will add those atoms that are outside the region to the
group.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The <em>include molecule</em> operation is relatively expensive in a
parallel sense. This is because it requires communication of relevant
molecule IDs between all the processors and each processor to loop
over its atoms once per processor, to compare its atoms to the list of
molecule IDs from every other processor. Hence it scales as N, rather
than N/P as most of the group operations do, where N is the number of
atoms, and P is the number of processors.</p>
</div>
<p>The <em>subtract</em> style takes a list of two or more existing group names
as arguments. All atoms that belong to the 1st group, but not to any
of the other groups are added to the specified group.</p>
<p>The <em>union</em> style takes a list of one or more existing group names as
arguments. All atoms that belong to any of the listed groups are
added to the specified group.</p>
<p>The <em>intersect</em> 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.</p>
<hr class="docutils" />
<p>The <em>dynamic</em> style flags an existing or new group as dynamic. This
means atoms will be (re)assigned to the group periodically as a
simulation runs. This is in contrast to static groups where atoms are
permanently assigned to the group. The way the assignment occurs is
as follows. Only atoms in the group specified as the parent group via
the parent-ID are assigned to the dynamic group before the following
conditions are applied. If the <em>region</em> keyword is used, atoms not in
the specified region are removed from the dynamic group. If the <em>var</em>
keyword is used, the variable name must be an atom-style or
atomfile-style variable. The variable is evaluated and atoms whose
per-atom values are 0.0, are removed from the dynamic group.</p>
<p>The assignment of atoms to a dynamic group is done at the beginning of
each run and on every timestep that is a multiple of <em>N</em>, which is the
argument for the <em>every</em> keyword (N = 1 is the default). For an
energy minimization, via the <a class="reference internal" href="minimize.html"><span class="doc">minimize</span></a> command, an
assignment is made at the beginning of the minimization, but not
during the iterations of the minimizer.</p>
<p>The point in the timestep at which atoms are assigned to a dynamic
group is after the initial stage of velocity Verlet time integration
has been performed, and before neighbor lists or forces are computed.
This is the point in the timestep where atom positions have just
changed due to the time integration, so the region criterion should be
accurate, if applied.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If the <em>region</em> keyword is used to determine what atoms are in
the dynamic group, atoms can move outside of the simulation box
between reneighboring events. Thus if you want to include all atoms
on the left side of the simulation box, you probably want to set the
left boundary of the region to be outside the simulation box by some
reasonable amount (e.g. up to the cutoff of the potential), else they
may be excluded from the dynamic region.</p>
</div>
<p>Here is an example of using a dynamic group to shrink the set of atoms
being integrated by using a spherical region with a variable radius
(shrinking from 18 to 5 over the course of the run). This could be
used to model a quench of the system, freezing atoms outside the
shrinking sphere, then converting the remaining atoms to a static
group and running further.</p>
<pre class="literal-block">
variable nsteps equal 5000
variable rad equal 18-(step/v_nsteps)*(18-5)
region ss sphere 20 20 0 v_rad
group mobile dynamic all region ss
fix 1 mobile nve
run ${nsteps}
group mobile static
run ${nsteps}
</pre>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">All fixes and computes take a group ID as an argument, but they
do not all allow for use of a dynamic group. If you get an error
message that this is not allowed, but feel that it should be for the
fix or compute in question, then please post your reasoning to the
LAMMPS mail list and we can change it.</p>
</div>
<p>The <em>static</em> style removes the setting for a dynamic group, converting
it to a static group (the default). The atoms in the static group are
those currently in the dynamic group.</p>
</div>
<hr class="docutils" />
<div class="section" id="restrictions">
<h2>Restrictions</h2>
<p>There can be no more than 32 groups defined at one time, including
&#8220;all&#8221;.</p>
<p>The parent group of a dynamic group cannot itself be a dynamic group.</p>
</div>
<div class="section" id="related-commands">
<h2>Related commands</h2>
<p><a class="reference internal" href="dump.html"><span class="doc">dump</span></a>, <a class="reference internal" href="fix.html"><span class="doc">fix</span></a>, <a class="reference internal" href="region.html"><span class="doc">region</span></a>,
<a class="reference internal" href="velocity.html"><span class="doc">velocity</span></a></p>
</div>
<div class="section" id="default">
<h2>Default</h2>
<p>All atoms belong to the &#8220;all&#8221; group.</p>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="group2ndx.html" class="btn btn-neutral float-right" title="group2ndx command" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="fix_modify.html" class="btn btn-neutral" title="fix_modify command" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2013 Sandia Corporation.
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/sphinxcontrib-images/LightBox2/lightbox2/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="_static/sphinxcontrib-images/LightBox2/lightbox2/js/lightbox.min.js"></script>
<script type="text/javascript" src="_static/sphinxcontrib-images/LightBox2/lightbox2-customize/jquery-noconflict.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
});
</script>
</body>
</html>

Event Timeline