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

373 lines
32 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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>8.3.2. Use chunks to calculate system properties &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/Howto_chunk.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="8.3.3. Using distributed grids" href="Howto_grid.html" />
<link rel="prev" title="8.3.1. Output from LAMMPS (thermo, dumps, computes, fixes, variables)" href="Howto_output.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 class="current">
<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 current"><a class="reference internal" href="Howto.html">8. Howto discussions</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="Howto.html#general-howto">8.1. General howto</a></li>
<li class="toctree-l2"><a class="reference internal" href="Howto.html#settings-howto">8.2. Settings howto</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="Howto.html#analysis-howto">8.3. Analysis howto</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="Howto_output.html">8.3.1. Output from LAMMPS (thermo, dumps, computes, fixes, variables)</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">8.3.2. Use chunks to calculate system properties</a></li>
<li class="toctree-l3"><a class="reference internal" href="Howto_grid.html">8.3.3. Using distributed grids</a></li>
<li class="toctree-l3"><a class="reference internal" href="Howto_temperature.html">8.3.4. Calculate temperature</a></li>
<li class="toctree-l3"><a class="reference internal" href="Howto_elastic.html">8.3.5. Calculate elastic constants</a></li>
<li class="toctree-l3"><a class="reference internal" href="Howto_kappa.html">8.3.6. Calculate thermal conductivity</a></li>
<li class="toctree-l3"><a class="reference internal" href="Howto_viscosity.html">8.3.7. Calculate viscosity</a></li>
<li class="toctree-l3"><a class="reference internal" href="Howto_diffusion.html">8.3.8. Calculate diffusion coefficients</a></li>
<li class="toctree-l3"><a class="reference internal" href="Howto_structured_data.html">8.3.9. Output structured data from LAMMPS</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="Howto.html#force-fields-howto">8.4. Force fields howto</a></li>
<li class="toctree-l2"><a class="reference internal" href="Howto.html#packages-howto">8.5. Packages howto</a></li>
<li class="toctree-l2"><a class="reference internal" href="Howto.html#tutorials-howto">8.6. Tutorials howto</a></li>
</ul>
</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>
<li class="toctree-l1"><a class="reference internal" href="commands_list.html">Commands</a></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="Howto.html"><span class="section-number">8. </span>Howto discussions</a></li>
<li class="breadcrumb-item active"><span class="section-number">8.3.2. </span>Use chunks to calculate system properties</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="Howto_output.html" class="btn btn-neutral float-left" title="8.3.1. Output from LAMMPS (thermo, dumps, computes, fixes, variables)" accesskey="p"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="Howto_grid.html" class="btn btn-neutral float-right" title="8.3.3. Using distributed grids" 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="use-chunks-to-calculate-system-properties">
<h1><span class="section-number">8.3.2. </span>Use chunks to calculate system properties<a class="headerlink" href="#use-chunks-to-calculate-system-properties" title="Link to this heading"></a></h1>
<p>In LAMMPS, “chunks” are collections of atoms, as defined by the
<a class="reference internal" href="compute_chunk_atom.html"><span class="doc">compute chunk/atom</span></a> command, which assigns
each atom to a chunk ID (or to no chunk at all). The number of chunks
and the assignment of chunk IDs to atoms can be static or change over
time. Examples of “chunks” are molecules or spatial bins or atoms
with similar values (e.g. coordination number or potential energy).</p>
<p>The per-atom chunk IDs can be used as input to two other kinds of
commands, to calculate various properties of a system:</p>
<ul class="simple">
<li><p><a class="reference internal" href="fix_ave_chunk.html"><span class="doc">fix ave/chunk</span></a></p></li>
<li><p>any of the <a class="reference internal" href="compute.html"><span class="doc">compute */chunk</span></a> commands</p></li>
</ul>
<p>Here a brief overview for each of the 4 kinds of chunk-related commands
is provided. Then some examples are given of how to compute different
properties with chunk commands.</p>
<section id="compute-chunk-atom-command">
<h2>Compute chunk/atom command:<a class="headerlink" href="#compute-chunk-atom-command" title="Link to this heading"></a></h2>
<p>This compute can assign atoms to chunks of various styles. Only atoms
in the specified group and optional specified region are assigned to a
chunk. Here are some possible chunk definitions:</p>
<table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p>atoms in same molecule</p></td>
<td><p>chunk ID = molecule ID</p></td>
</tr>
<tr class="row-even"><td><p>atoms of same atom type</p></td>
<td><p>chunk ID = atom type</p></td>
</tr>
<tr class="row-odd"><td><p>all atoms with same atom property (charge, radius, etc)</p></td>
<td><p>chunk ID = output of compute property/atom</p></td>
</tr>
<tr class="row-even"><td><p>atoms in same cluster</p></td>
<td><p>chunk ID = output of <a class="reference internal" href="compute_cluster_atom.html"><span class="doc">compute cluster/atom</span></a> command</p></td>
</tr>
<tr class="row-odd"><td><p>atoms in same spatial bin</p></td>
<td><p>chunk ID = bin ID</p></td>
</tr>
<tr class="row-even"><td><p>atoms in same rigid body</p></td>
<td><p>chunk ID = molecule ID used to define rigid bodies</p></td>
</tr>
<tr class="row-odd"><td><p>atoms with similar potential energy</p></td>
<td><p>chunk ID = output of <a class="reference internal" href="compute_pe_atom.html"><span class="doc">compute pe/atom</span></a></p></td>
</tr>
<tr class="row-even"><td><p>atoms with same local defect structure</p></td>
<td><p>chunk ID = output of <a class="reference internal" href="compute_centro_atom.html"><span class="doc">compute centro/atom</span></a> or <a class="reference internal" href="compute_coord_atom.html"><span class="doc">compute coord/atom</span></a> command</p></td>
</tr>
</tbody>
</table>
<p>Note that chunk IDs are integer values, so for atom properties or
computes that produce a floating point value, they will be truncated
to an integer. You could also use the compute in a variable that
scales the floating point value to spread it across multiple integers.</p>
<p>Spatial bins can be of various kinds, e.g. 1d bins = slabs, 2d bins =
pencils, 3d bins = boxes, spherical bins, cylindrical bins.</p>
<p>This compute also calculates the number of chunks <em>Nchunk</em>, which is
used by other commands to tally per-chunk data. <em>Nchunk</em> can be a
static value or change over time (e.g. the number of clusters). The
chunk ID for an individual atom can also be static (e.g. a molecule
ID), or dynamic (e.g. what spatial bin an atom is in as it moves).</p>
<p>Note that this compute allows the per-atom output of other
<a class="reference internal" href="compute.html"><span class="doc">computes</span></a>, <a class="reference internal" href="fix.html"><span class="doc">fixes</span></a>, and <a class="reference internal" href="variable.html"><span class="doc">variables</span></a> to be used to define chunk IDs for each atom. This means
you can write your own compute or fix to output a per-atom quantity to
use as chunk ID. See the <a class="reference internal" href="Modify.html"><span class="doc">Modify</span></a> doc pages for info on
how to do this. You can also define a <a class="reference internal" href="variable.html"><span class="doc">per-atom variable</span></a> in the input script that uses a formula to generate a chunk
ID for each atom.</p>
</section>
<section id="fix-ave-chunk-command">
<h2>Fix ave/chunk command:<a class="headerlink" href="#fix-ave-chunk-command" title="Link to this heading"></a></h2>
<p>This fix takes the ID of a <a class="reference internal" href="compute_chunk_atom.html"><span class="doc">compute chunk/atom</span></a> command as input. For each chunk, it then sums
one or more specified per-atom values over the atoms in each chunk. The
per-atom values can be any atom property, such as velocity, force,
charge, potential energy, kinetic energy, stress, etc. Additional
keywords are defined for per-chunk properties like density and
temperature. More generally any per-atom value generated by other
<a class="reference internal" href="compute.html"><span class="doc">computes</span></a>, <a class="reference internal" href="fix.html"><span class="doc">fixes</span></a>, and <a class="reference internal" href="variable.html"><span class="doc">per-atom
variables</span></a>, can be summed over atoms in each chunk.</p>
<p>Similar to other averaging fixes, this fix allows the summed per-chunk
values to be time-averaged in various ways, and output to a file. The
fix produces a global array as output with one row of values per chunk.</p>
</section>
<section id="compute-chunk-commands">
<h2>Compute */chunk commands:<a class="headerlink" href="#compute-chunk-commands" title="Link to this heading"></a></h2>
<p>The following computes operate on chunks of atoms to produce per-chunk
values. Any compute whose style name ends in “/chunk” is in this
category:</p>
<ul class="simple">
<li><p><a class="reference internal" href="compute_com_chunk.html"><span class="doc">compute com/chunk</span></a></p></li>
<li><p><a class="reference internal" href="compute_gyration_chunk.html"><span class="doc">compute gyration/chunk</span></a></p></li>
<li><p><a class="reference internal" href="compute_inertia_chunk.html"><span class="doc">compute inertia/chunk</span></a></p></li>
<li><p><a class="reference internal" href="compute_msd_chunk.html"><span class="doc">compute msd/chunk</span></a></p></li>
<li><p><a class="reference internal" href="compute_property_chunk.html"><span class="doc">compute property/chunk</span></a></p></li>
<li><p><a class="reference internal" href="compute_temp_chunk.html"><span class="doc">compute temp/chunk</span></a></p></li>
<li><p><a class="reference internal" href="compute_vcm_chunk.html"><span class="doc">compute torque/chunk</span></a></p></li>
<li><p><a class="reference internal" href="compute_vcm_chunk.html"><span class="doc">compute vcm/chunk</span></a></p></li>
</ul>
<p>They each take the ID of a <a class="reference internal" href="compute_chunk_atom.html"><span class="doc">compute chunk/atom</span></a> command as input. As their names indicate, they
calculate the center-of-mass, radius of gyration, moments of inertia,
mean-squared displacement, temperature, torque, and velocity of
center-of-mass for each chunk of atoms. The <a class="reference internal" href="compute_property_chunk.html"><span class="doc">compute
property/chunk</span></a> command can tally the count of
atoms in each chunk and extract other per-chunk properties.</p>
<p>The reason these various calculations are not part of the <a class="reference internal" href="fix_ave_chunk.html"><span class="doc">fix
ave/chunk command</span></a>, is that each requires a more
complicated operation than simply summing and averaging over per-atom
values in each chunk. For example, many of them require calculation of
a center of mass, which requires summing mass*position over the atoms
and then dividing by summed mass.</p>
<p>All of these computes produce a global vector or global array as
output, with one or more values per chunk. The output can be used in
various ways:</p>
<ul class="simple">
<li><p>As input to the <a class="reference internal" href="fix_ave_time.html"><span class="doc">fix ave/time</span></a> command, which can
write the values to a file and optionally time average them.</p></li>
<li><p>As input to the <a class="reference internal" href="fix_ave_histo.html"><span class="doc">fix ave/histo</span></a> command to
histogram values across chunks. E.g. a histogram of cluster sizes or
molecule diffusion rates.</p></li>
<li><p>As input to special functions of <a class="reference internal" href="variable.html"><span class="doc">equal-style variables</span></a>, like sum() and max() and ave(). E.g. to find the largest
cluster or fastest diffusing molecule or average radius-of-gyration of
a set of molecules (chunks).</p></li>
</ul>
</section>
<section id="other-chunk-commands">
<h2>Other chunk commands:<a class="headerlink" href="#other-chunk-commands" title="Link to this heading"></a></h2>
<ul class="simple">
<li><p><a class="reference internal" href="compute_chunk_spread_atom.html"><span class="doc">compute chunk/spread/atom</span></a></p></li>
<li><p><a class="reference internal" href="compute_reduce_chunk.html"><span class="doc">compute reduce/chunk</span></a></p></li>
</ul>
<p>The <a class="reference internal" href="compute_chunk_spread_atom.html"><span class="doc">compute chunk/spread/atom</span></a> command
spreads per-chunk values to each atom in the chunk, producing per-atom
values as its output. This can be useful for outputting per-chunk
values to a per-atom <a class="reference internal" href="dump.html"><span class="doc">dump file</span></a>. Or for using an atoms
associated chunk value in an <a class="reference internal" href="variable.html"><span class="doc">atom-style variable</span></a>. Or
as input to the <a class="reference internal" href="fix_ave_chunk.html"><span class="doc">fix ave/chunk</span></a> command to
spatially average per-chunk values calculated by a per-chunk compute.</p>
<p>The <a class="reference internal" href="compute_reduce_chunk.html"><span class="doc">compute reduce/chunk</span></a> command reduces a
peratom value across the atoms in each chunk to produce a value per
chunk. When used with the <a class="reference internal" href="compute_chunk_spread_atom.html"><span class="doc">compute chunk/spread/atom</span></a> command it can create peratom values that
induce a new set of chunks with a second <a class="reference internal" href="compute_chunk_atom.html"><span class="doc">compute chunk/atom</span></a> command.</p>
</section>
<section id="example-calculations-with-chunks">
<h2>Example calculations with chunks<a class="headerlink" href="#example-calculations-with-chunks" title="Link to this heading"></a></h2>
<p>Here are examples using chunk commands to calculate various
properties:</p>
<ol class="arabic simple">
<li><p>Average velocity in each of 1000 2d spatial bins:</p></li>
</ol>
<div class="highlight-LAMMPS notranslate"><div class="highlight"><pre><span></span><span class="k">compute </span><span class="nv nv-Identifier">cc1</span><span class="w"> </span><span class="nv nv-Identifier">all</span><span class="w"> </span><span class="n">chunk</span><span class="o">/</span><span class="n">atom</span><span class="w"> </span><span class="n">bin</span><span class="o">/</span><span class="m">2</span><span class="n">d</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="m">0.0</span><span class="w"> </span><span class="m">0.1</span><span class="w"> </span><span class="n">y</span><span class="w"> </span><span class="n">lower</span><span class="w"> </span><span class="m">0.01</span><span class="w"> </span><span class="n">units</span><span class="w"> </span><span class="n">reduced</span>
<span class="k">fix </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">ave</span><span class="o">/</span><span class="n">chunk</span><span class="w"> </span><span class="m">100</span><span class="w"> </span><span class="m">10</span><span class="w"> </span><span class="m">1000</span><span class="w"> </span><span class="n">cc1</span><span class="w"> </span><span class="n">vx</span><span class="w"> </span><span class="n">vy</span><span class="w"> </span><span class="n">file</span><span class="w"> </span><span class="n">tmp.out</span>
</pre></div>
</div>
<p>2. Temperature in each spatial bin, after subtracting a flow
velocity:</p>
<div class="highlight-LAMMPS notranslate"><div class="highlight"><pre><span></span><span class="k">compute </span><span class="nv nv-Identifier">cc1</span><span class="w"> </span><span class="nv nv-Identifier">all</span><span class="w"> </span><span class="n">chunk</span><span class="o">/</span><span class="n">atom</span><span class="w"> </span><span class="n">bin</span><span class="o">/</span><span class="m">2</span><span class="n">d</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="m">0.0</span><span class="w"> </span><span class="m">0.1</span><span class="w"> </span><span class="n">y</span><span class="w"> </span><span class="n">lower</span><span class="w"> </span><span class="m">0.1</span><span class="w"> </span><span class="n">units</span><span class="w"> </span><span class="n">reduced</span>
<span class="k">compute </span><span class="nv nv-Identifier">vbias</span><span class="w"> </span><span class="nv nv-Identifier">all</span><span class="w"> </span><span class="n">temp</span><span class="o">/</span><span class="n">profile</span><span class="w"> </span><span class="m">1</span><span class="w"> </span><span class="m">0</span><span class="w"> </span><span class="m">0</span><span class="w"> </span><span class="n">y</span><span class="w"> </span><span class="m">10</span>
<span class="k">fix </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">ave</span><span class="o">/</span><span class="n">chunk</span><span class="w"> </span><span class="m">100</span><span class="w"> </span><span class="m">10</span><span class="w"> </span><span class="m">1000</span><span class="w"> </span><span class="n">cc1</span><span class="w"> </span><span class="n">temp</span><span class="w"> </span><span class="n">bias</span><span class="w"> </span><span class="n">vbias</span><span class="w"> </span><span class="n">file</span><span class="w"> </span><span class="n">tmp.out</span>
</pre></div>
</div>
<ol class="arabic simple" start="3">
<li><p>Center of mass of each molecule:</p></li>
</ol>
<div class="highlight-LAMMPS notranslate"><div class="highlight"><pre><span></span><span class="k">compute </span><span class="nv nv-Identifier">cc1</span><span class="w"> </span><span class="nv nv-Identifier">all</span><span class="w"> </span><span class="n">chunk</span><span class="o">/</span><span class="n">atom</span><span class="w"> </span><span class="n">molecule</span>
<span class="k">compute </span><span class="nv nv-Identifier">myChunk</span><span class="w"> </span><span class="nv nv-Identifier">all</span><span class="w"> </span><span class="n">com</span><span class="o">/</span><span class="n">chunk</span><span class="w"> </span><span class="n">cc1</span>
<span class="k">fix </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">ave</span><span class="o">/</span><span class="n">time</span><span class="w"> </span><span class="m">100</span><span class="w"> </span><span class="m">1</span><span class="w"> </span><span class="m">100</span><span class="w"> </span><span class="n">c_myChunk[</span><span class="o">*</span><span class="n">]</span><span class="w"> </span><span class="n">file</span><span class="w"> </span><span class="n">tmp.out</span><span class="w"> </span><span class="n">mode</span><span class="w"> </span><span class="n">vector</span>
</pre></div>
</div>
<ol class="arabic simple" start="4">
<li><p>Total force on each molecule and ave/max across all molecules:</p></li>
</ol>
<div class="highlight-LAMMPS notranslate"><div class="highlight"><pre><span></span><span class="k">compute </span><span class="nv nv-Identifier">cc1</span><span class="w"> </span><span class="nv nv-Identifier">all</span><span class="w"> </span><span class="n">chunk</span><span class="o">/</span><span class="n">atom</span><span class="w"> </span><span class="n">molecule</span>
<span class="k">fix </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">ave</span><span class="o">/</span><span class="n">chunk</span><span class="w"> </span><span class="m">1000</span><span class="w"> </span><span class="m">1</span><span class="w"> </span><span class="m">1000</span><span class="w"> </span><span class="n">cc1</span><span class="w"> </span><span class="n">fx</span><span class="w"> </span><span class="n">fy</span><span class="w"> </span><span class="n">fz</span><span class="w"> </span><span class="n">file</span><span class="w"> </span><span class="n">tmp.out</span>
<span class="k">variable </span><span class="nv nv-Identifier">xave</span><span class="w"> </span><span class="n">equal</span><span class="w"> </span><span class="n">ave</span><span class="nv">(f_1[2])</span>
<span class="k">variable </span><span class="nv nv-Identifier">xmax</span><span class="w"> </span><span class="n">equal</span><span class="w"> </span><span class="n">max</span><span class="nv">(f_1[2])</span>
<span class="k">thermo</span><span class="w"> </span><span class="m">1000</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">v_xave</span><span class="w"> </span><span class="n">v_xmax</span>
</pre></div>
</div>
<ol class="arabic simple" start="5">
<li><p>Histogram of cluster sizes:</p></li>
</ol>
<div class="highlight-LAMMPS notranslate"><div class="highlight"><pre><span></span><span class="k">compute </span><span class="nv nv-Identifier">cluster</span><span class="w"> </span><span class="nv nv-Identifier">all</span><span class="w"> </span><span class="n">cluster</span><span class="o">/</span><span class="n">atom</span><span class="w"> </span><span class="m">1.0</span>
<span class="k">compute </span><span class="nv nv-Identifier">cc1</span><span class="w"> </span><span class="nv nv-Identifier">all</span><span class="w"> </span><span class="n">chunk</span><span class="o">/</span><span class="n">atom</span><span class="w"> </span><span class="n">c_cluster</span><span class="w"> </span><span class="n">compress</span><span class="w"> </span><span class="n">yes</span>
<span class="k">compute </span><span class="nv nv-Identifier">size</span><span class="w"> </span><span class="nv nv-Identifier">all</span><span class="w"> </span><span class="n">property</span><span class="o">/</span><span class="n">chunk</span><span class="w"> </span><span class="n">cc1</span><span class="w"> </span><span class="n">count</span>
<span class="k">fix </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">ave</span><span class="o">/</span><span class="n">histo</span><span class="w"> </span><span class="m">100</span><span class="w"> </span><span class="m">1</span><span class="w"> </span><span class="m">100</span><span class="w"> </span><span class="m">0</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="n">c_size</span><span class="w"> </span><span class="n">mode</span><span class="w"> </span><span class="n">vector</span><span class="w"> </span><span class="n">ave</span><span class="w"> </span><span class="n">running</span><span class="w"> </span><span class="n">beyond</span><span class="w"> </span><span class="n">ignore</span><span class="w"> </span><span class="n">file</span><span class="w"> </span><span class="n">tmp.histo</span>
</pre></div>
</div>
<p>6. An example for using a per-chunk value to apply per-atom forces to
compress individual polymer chains (molecules) in a mixture, is
explained on the <a class="reference internal" href="compute_chunk_spread_atom.html"><span class="doc">compute chunk/spread/atom</span></a> command doc page.</p>
<p>7. An example for using one set of per-chunk values for molecule
chunks, to create a second set of micelle-scale chunks (clustered
molecules, due to hydrophobicity), is explained on the
<a class="reference internal" href="compute_reduce_chunk.html"><span class="doc">compute reduce/chunk</span></a> command doc page.</p>
<p>8. An example for using one set of per-chunk values (dipole moment
vectors) for molecule chunks, spreading the values to each atom in
each chunk, then defining a second set of chunks as spatial bins, and
using the <a class="reference internal" href="fix_ave_chunk.html"><span class="doc">fix ave/chunk</span></a> command to calculate an
average dipole moment vector for each bin. This example is explained
on the <a class="reference internal" href="compute_chunk_spread_atom.html"><span class="doc">compute chunk/spread/atom</span></a>
command doc page.</p>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="Howto_output.html" class="btn btn-neutral float-left" title="8.3.1. Output from LAMMPS (thermo, dumps, computes, fixes, variables)" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="Howto_grid.html" class="btn btn-neutral float-right" title="8.3.3. Using distributed grids" 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>