Files
lammps/doc/html/group.html
2025-01-13 14:55:48 +00:00

574 lines
45 KiB
HTML

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>group command &mdash; LAMMPS documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/sphinx-design.min.css" type="text/css" />
<link rel="stylesheet" href="_static/css/lammps.css" type="text/css" />
<link rel="shortcut icon" href="_static/lammps.ico"/>
<link rel="canonical" href="https://docs.lammps.org/group.html" />
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=5929fcd5"></script>
<script src="_static/doctools.js?v=9bcbadda"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/design-tabs.js?v=f930bc37"></script>
<script async="async" src="_static/mathjax/es5/tex-mml-chtml.js?v=cadf963e"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="group2ndx command" href="group2ndx.html" />
<link rel="prev" title="geturl command" href="geturl.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="Manual.html">
<img src="_static/lammps-logo.png" class="logo" alt="Logo"/>
</a>
<div class="lammps_version">Version: <b>19 Nov 2024</b></div>
<div class="lammps_release">git info: </div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="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="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">User Guide</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="Intro.html">1. Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="Install.html">2. Install LAMMPS</a></li>
<li class="toctree-l1"><a class="reference internal" href="Build.html">3. Build LAMMPS</a></li>
<li class="toctree-l1"><a class="reference internal" href="Run_head.html">4. Run LAMMPS</a></li>
<li class="toctree-l1"><a class="reference internal" href="Commands.html">5. Commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="Packages.html">6. Optional packages</a></li>
<li class="toctree-l1"><a class="reference internal" href="Speed.html">7. Accelerate performance</a></li>
<li class="toctree-l1"><a class="reference internal" href="Howto.html">8. Howto discussions</a></li>
<li class="toctree-l1"><a class="reference internal" href="Examples.html">9. Example scripts</a></li>
<li class="toctree-l1"><a class="reference internal" href="Tools.html">10. Auxiliary tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="Errors.html">11. Errors</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Programmer Guide</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="Library.html">1. LAMMPS Library Interfaces</a></li>
<li class="toctree-l1"><a class="reference internal" href="Python_head.html">2. Use Python with LAMMPS</a></li>
<li class="toctree-l1"><a class="reference internal" href="Modify.html">3. Modifying &amp; extending LAMMPS</a></li>
<li class="toctree-l1"><a class="reference internal" href="Developer.html">4. Information for Developers</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Command Reference</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="commands_list.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="angle_write.html">angle_write 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="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="dihedral_write.html">dihedral_write 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="dynamical_matrix.html">dynamical_matrix 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"><a class="reference internal" href="fitpod_command.html">fitpod command</a></li>
<li class="toctree-l2"><a class="reference internal" href="geturl.html">geturl 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="hyper.html">hyper 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="kim_commands.html">kim 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="labelmap.html">labelmap 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="mdi.html">mdi 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_spin.html">min_style spin command</a></li>
<li class="toctree-l2"><a class="reference internal" href="min_spin.html#min-style-spin-cg-command">min_style spin/cg command</a></li>
<li class="toctree-l2"><a class="reference internal" href="min_spin.html#min-style-spin-lbfgs-command">min_style spin/lbfgs command</a></li>
<li class="toctree-l2"><a class="reference internal" href="min_style.html">min_style cg command</a></li>
<li class="toctree-l2"><a class="reference internal" href="min_style.html#min-style-hftn-command">min_style hftn command</a></li>
<li class="toctree-l2"><a class="reference internal" href="min_style.html#min-style-sd-command">min_style sd command</a></li>
<li class="toctree-l2"><a class="reference internal" href="min_style.html#min-style-quickmin-command">min_style quickmin command</a></li>
<li class="toctree-l2"><a class="reference internal" href="min_style.html#min-style-fire-command">min_style fire command</a></li>
<li class="toctree-l2"><a class="reference internal" href="min_style.html#min-style-spin-command"><span class="xref std std-doc">min_style spin</span> command</a></li>
<li class="toctree-l2"><a class="reference internal" href="min_style.html#min-style-spin-cg-command"><span class="xref std std-doc">min_style spin/cg</span> command</a></li>
<li class="toctree-l2"><a class="reference internal" href="min_style.html#min-style-spin-lbfgs-command"><span class="xref std std-doc">min_style spin/lbfgs</span> 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="neb_spin.html">neb/spin 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="plugin.html">plugin 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_atoms.html">reset_atoms 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="temper_grem.html">temper/grem command</a></li>
<li class="toctree-l2"><a class="reference internal" href="temper_npt.html">temper/npt 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="third_order.html">third_order 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">Fix Styles</a></li>
<li class="toctree-l1"><a class="reference internal" href="computes.html">Compute Styles</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>
<li class="toctree-l1"><a class="reference internal" href="dumps.html">Dump Styles</a></li>
<li class="toctree-l1"><a class="reference internal" href="fix_modify_atc_commands.html">fix_modify AtC commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="Bibliography.html">Bibliography</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<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 style-external-links">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="Manual.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item"><a href="commands_list.html">Commands</a></li>
<li class="breadcrumb-item active">group command</li>
<li class="wy-breadcrumbs-aside">
<a href="https://www.lammps.org"><img src="_static/lammps-logo.png" width="64" height="16" alt="LAMMPS Homepage"></a> | <a href="Commands_all.html">Commands</a>
</li>
</ul><div class="rst-breadcrumbs-buttons" role="navigation" aria-label="Sequential page navigation">
<a href="geturl.html" class="btn btn-neutral float-left" title="geturl command" accesskey="p"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="group2ndx.html" class="btn btn-neutral float-right" title="group2ndx command" accesskey="n">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<p><span class="math notranslate nohighlight">\(\renewcommand{\AA}{\text{Å}}\)</span></p>
<section id="group-command">
<span id="index-0"></span><h1>group command<a class="headerlink" href="#group-command" title="Link to this heading"></a></h1>
<section id="syntax">
<h2>Syntax<a class="headerlink" href="#syntax" title="Link to this heading"></a></h2>
<div class="highlight-LAMMPS notranslate"><div class="highlight"><pre><span></span><span class="k">group </span><span class="nv nv-Identifier">ID</span><span class="w"> </span><span class="n">style</span><span class="w"> </span><span class="n">args</span>
</pre></div>
</div>
<ul>
<li><p>ID = user-defined name of the group</p></li>
<li><p>style = <em>delete</em> or <em>clear</em> or <em>empty</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>empty</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 (1-Ntypes or type label), atom IDs, or molecule IDs
any numeric 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 (1-Ntypes or type label) 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>property</em> or <em>every</em>
<em>region</em> value = region-ID
<em>var</em> value = name of variable
<em>property</em> value = name of custom integer or floating point vector
<em>every</em> value = N = update group every this many timesteps
<em>static</em> = no args</pre>
</li>
</ul>
</section>
<section id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Link to this heading"></a></h2>
<div class="highlight-LAMMPS notranslate"><div class="highlight"><pre><span></span><span class="k">group </span><span class="nv nv-Identifier">edge</span><span class="w"> </span><span class="k">region </span><span class="nv nv-Identifier">regstrip</span>
<span class="k">group </span><span class="nv nv-Identifier">water</span><span class="w"> </span><span class="n">type</span><span class="w"> </span><span class="m">3</span><span class="w"> </span><span class="m">4</span>
<span class="k">group </span><span class="nv nv-Identifier">water</span><span class="w"> </span><span class="n">type</span><span class="w"> </span><span class="n">OW</span><span class="w"> </span><span class="n">HT</span>
<span class="k">group </span><span class="nv nv-Identifier">sub</span><span class="w"> </span><span class="n">id</span><span class="w"> </span><span class="m">10</span><span class="w"> </span><span class="m">25</span><span class="w"> </span><span class="m">50</span>
<span class="k">group </span><span class="nv nv-Identifier">sub</span><span class="w"> </span><span class="n">id</span><span class="w"> </span><span class="m">10</span><span class="w"> </span><span class="m">25</span><span class="w"> </span><span class="m">50</span><span class="w"> </span><span class="m">500:1000</span>
<span class="k">group </span><span class="nv nv-Identifier">sub</span><span class="w"> </span><span class="n">id</span><span class="w"> </span><span class="m">100:10000:10</span>
<span class="k">group </span><span class="nv nv-Identifier">sub</span><span class="w"> </span><span class="n">id</span><span class="w"> </span><span class="o">&lt;=</span><span class="w"> </span><span class="m">150</span>
<span class="k">group </span><span class="nv nv-Identifier">polyA</span><span class="w"> </span><span class="n">molecule</span><span class="w"> </span><span class="o">&lt;&gt;</span><span class="w"> </span><span class="m">50</span><span class="w"> </span><span class="m">250</span>
<span class="k">group </span><span class="nv nv-Identifier">hienergy</span><span class="w"> </span><span class="k">variable </span><span class="nv nv-Identifier">eng</span>
<span class="k">group </span><span class="nv nv-Identifier">hienergy</span><span class="w"> </span><span class="n">include</span><span class="w"> </span><span class="n">molecule</span>
<span class="k">group </span><span class="nv nv-Identifier">boundary</span><span class="w"> </span><span class="n">subtract</span><span class="w"> </span><span class="n">all</span><span class="w"> </span><span class="n">a2</span><span class="w"> </span><span class="n">a3</span>
<span class="k">group </span><span class="nv nv-Identifier">boundary</span><span class="w"> </span><span class="n">union</span><span class="w"> </span><span class="n">lower</span><span class="w"> </span><span class="n">upper</span>
<span class="k">group </span><span class="nv nv-Identifier">boundary</span><span class="w"> </span><span class="n">intersect</span><span class="w"> </span><span class="n">upper</span><span class="w"> </span><span class="n">flow</span>
<span class="k">group </span><span class="nv nv-Identifier">boundary</span><span class="w"> </span><span class="n">delete</span>
<span class="k">group </span><span class="nv nv-Identifier">mine</span><span class="w"> </span><span class="n">dynamic</span><span class="w"> </span><span class="n">all</span><span class="w"> </span><span class="k">region </span><span class="nv nv-Identifier">myRegion</span><span class="w"> </span><span class="n">every</span><span class="w"> </span><span class="m">100</span>
</pre></div>
</div>
</section>
<section id="description">
<h2>Description<a class="headerlink" href="#description" title="Link to this heading"></a></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="admonition-title">Note</p>
<p>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>empty</em> style creates an empty group, which is useful for commands
like <a class="reference internal" href="fix_gcmc.html"><span class="doc">fix gcmc</span></a> or with complex scripts that add atoms
to a group.</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
three 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
second command in the examples above puts all atoms of type 3 or 4 into
the group named <em>water</em>. Each numeric entry in the list can be a
colon-separated sequence <code class="docutils literal notranslate"><span class="pre">A:B</span></code> or <code class="docutils literal notranslate"><span class="pre">A:B:C</span></code>, as in two of the examples
above. A “sequence” generates a sequence of values (types or IDs),
with an optional increment. The first example with <code class="docutils literal notranslate"><span class="pre">500:1000</span></code> 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, and 50 since they also
appear in the list of values. The second example with <code class="docutils literal notranslate"><span class="pre">100:10000:10</span></code>
uses an increment of 10 and would thus would add atoms IDs
<span class="math notranslate nohighlight">\(100, 110, 120, \dots, 9990, 10000\)</span> 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 <code class="docutils literal notranslate"><span class="pre">&lt;&gt;</span></code> take a single argument. The third example above adds all
atoms with IDs from 1 to 150 to the group named <em>sub</em>. The logical <code class="docutils literal notranslate"><span class="pre">&lt;&gt;</span></code>
means “between” and takes 2 arguments. The fourth example above adds all
atoms belonging to molecules with IDs from 50 to 250 (inclusive) to
the group named polyA. For the <em>type</em> style, type labels are converted into
numeric types before being evaluated.</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 two 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 “eatom” that calculates the
potential energy of each atom and includes it in the group if its
potential energy is above the threshold value <span class="math notranslate nohighlight">\(-3.0\)</span>.</p>
<div class="highlight-LAMMPS notranslate"><div class="highlight"><pre><span></span><span class="k">compute </span><span class="nv nv-Identifier">1</span><span class="w"> </span><span class="nv nv-Identifier">all</span><span class="w"> </span><span class="n">pe</span><span class="o">/</span><span class="n">atom</span>
<span class="k">compute </span><span class="nv nv-Identifier">2</span><span class="w"> </span><span class="nv nv-Identifier">all</span><span class="w"> </span><span class="n">reduce</span><span class="w"> </span><span class="n">sum</span><span class="w"> </span><span class="n">c_1</span>
<span class="k">thermo_style</span><span class="w"> </span><span class="n">custom</span><span class="w"> </span><span class="n">step</span><span class="w"> </span><span class="n">temp</span><span class="w"> </span><span class="n">pe</span><span class="w"> </span><span class="n">c_2</span>
<span class="k">run</span><span class="w"> </span><span class="m">0</span><span class="w"> </span><span class="n">post</span><span class="w"> </span><span class="n">no</span>
<span class="k">variable </span><span class="nv nv-Identifier">eatom</span><span class="w"> </span><span class="n">atom</span><span class="w"> </span><span class="s">&quot;c_1 &gt; -3.0&quot;</span>
<span class="k">group </span><span class="nv nv-Identifier">hienergy</span><span class="w"> </span><span class="k">variable </span><span class="nv nv-Identifier">eatom</span>
</pre></div>
</div>
<p>Note that these lines</p>
<div class="highlight-LAMMPS notranslate"><div class="highlight"><pre><span></span><span class="k">compute </span><span class="nv nv-Identifier">2</span><span class="w"> </span><span class="nv nv-Identifier">all</span><span class="w"> </span><span class="n">reduce</span><span class="w"> </span><span class="n">sum</span><span class="w"> </span><span class="n">c_1</span>
<span class="k">thermo_style</span><span class="w"> </span><span class="n">custom</span><span class="w"> </span><span class="n">step</span><span class="w"> </span><span class="n">temp</span><span class="w"> </span><span class="n">pe</span><span class="w"> </span><span class="n">c_2</span>
<span class="k">run</span><span class="w"> </span><span class="m">0</span><span class="w"> </span><span class="n">post</span><span class="w"> </span><span class="n">no</span>
</pre></div>
</div>
<p>are necessary to ensure that the “eatom” 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
thermodynamic info for compute 2 ensures 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 “Variable Accuracy” section of the
<a class="reference internal" href="variable.html"><span class="doc">variable</span></a> page for more details on ensuring 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 second 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="admonition-title">Note</p>
<p>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 first 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.</p>
<p>If the <em>region</em> keyword is used, atoms not in the specified region are
removed from the dynamic group.</p>
<p>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>If the <em>property</em> keyword is used, the name refers to a custom integer
or floating point per-atom vector defined via the <a class="reference internal" href="fix_property_atom.html"><span class="doc">fix
property/atom</span></a> command. This means the values in
the vector can be read as part of a data file with the <a class="reference internal" href="read_data.html"><span class="doc">read_data</span></a> command or specified with the <a class="reference internal" href="set.html"><span class="doc">set</span></a> command.
Or accessed and changed via the <a class="reference internal" href="Howto_library.html"><span class="doc">library interface to LAMMPS</span></a>, or by styles you add to LAMMPS (pair, fix, compute,
etc) which access the custom vector and modify its values. Which
means the values can be modified between or during simulations. Atoms
whose values in the custom vector are zero are removed from the
dynamic group. Note that the name of the custom per-atom vector is
specified just as <em>name</em>, not as <em>i_name</em> or <em>d_name</em> as it is for
other commands that use different kinds of custom atom vectors or
arrays as arguments.</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 (<span class="math notranslate nohighlight">\(N = 1\)</span> 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 interatomic forces have been computed, but before any
fixes which alter forces or otherwise update the system have been
invoked. This means that atom positions have been updated, neighbor
lists and ghost atoms are current, and both intermolecular and
intramolecular forces have been calculated based on the new
coordinates. Thus the region criterion, if applied, should be
accurate. Also, any computes invoked by an atom-style variable should
use updated information for that timestep (e.g., potential energy/atom
or coordination number/atom). Similarly, fixes or computes which are
invoked after that point in the timestep, should operate on the new
group of atoms.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>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>
<div class="highlight-LAMMPS notranslate"><div class="highlight"><pre><span></span><span class="k">variable </span><span class="nv nv-Identifier">nsteps</span><span class="w"> </span><span class="n">equal</span><span class="w"> </span><span class="m">5000</span>
<span class="k">variable </span><span class="nv nv-Identifier">rad</span><span class="w"> </span><span class="n">equal</span><span class="w"> </span><span class="m">18</span><span class="o">-</span><span class="nv">(step/v_nsteps)</span><span class="o">*</span><span class="nv">(18-5)</span>
<span class="k">region </span><span class="nv nv-Identifier">ss</span><span class="w"> </span><span class="n">sphere</span><span class="w"> </span><span class="m">20</span><span class="w"> </span><span class="m">20</span><span class="w"> </span><span class="m">0</span><span class="w"> </span><span class="n">v_rad</span>
<span class="k">group </span><span class="nv nv-Identifier">mobile</span><span class="w"> </span><span class="n">dynamic</span><span class="w"> </span><span class="n">all</span><span class="w"> </span><span class="k">region </span><span class="nv nv-Identifier">ss</span>
<span class="k">fix </span><span class="nv nv-Identifier">1</span><span class="w"> </span><span class="nv nv-Identifier">mobile</span><span class="w"> </span><span class="n">nve</span>
<span class="k">run</span><span class="w"> </span><span class="nv">${nsteps}</span>
<span class="k">group </span><span class="nv nv-Identifier">mobile</span><span class="w"> </span><span class="n">static</span>
<span class="k">run</span><span class="w"> </span><span class="nv">${nsteps}</span>
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>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
<a class="reference external" href="https://matsci.org/c/lammps-development/42">LAMMPS forum at MatSci</a>
and we can look into changing it. The same applies if you come
across inconsistent behavior when dynamic groups are allowed.</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>
</section>
<hr class="docutils" />
<section id="restrictions">
<h2>Restrictions<a class="headerlink" href="#restrictions" title="Link to this heading"></a></h2>
<p>There can be no more than 32 groups defined at one time, including
“all”.</p>
<p>The parent group of a dynamic group cannot itself be a dynamic group.</p>
</section>
<section id="related-commands">
<h2>Related commands<a class="headerlink" href="#related-commands" title="Link to this heading"></a></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>
</section>
<section id="default">
<h2>Default<a class="headerlink" href="#default" title="Link to this heading"></a></h2>
<p>All atoms belong to the “all” group.</p>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="geturl.html" class="btn btn-neutral float-left" title="geturl command" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="group2ndx.html" class="btn btn-neutral float-right" title="group2ndx command" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2003-2025 Sandia Corporation.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(false);
});
</script>
</body>
</html>