<spanid="index-0"></span><h1>compute heat/flux command<aclass="headerlink"href="#compute-heat-flux-command"title="Permalink to this headline">¶</a></h1>
<divclass="section"id="syntax">
<h2>Syntax<aclass="headerlink"href="#syntax"title="Permalink to this headline">¶</a></h2>
<divclass="highlight-python"><divclass="highlight"><pre>compute ID group-ID heat/flux ke-ID pe-ID stress-ID
</pre></div>
</div>
<ulclass="simple">
<li>ID, group-ID are documented in <aclass="reference internal"href="compute.html"><em>compute</em></a> command</li>
<li>heat/flux = style name of this compute command</li>
<li>ke-ID = ID of a compute that calculates per-atom kinetic energy</li>
<li>pe-ID = ID of a compute that calculates per-atom potential energy</li>
<li>stress-ID = ID of a compute that calculates per-atom stress</li>
</ul>
</div>
<divclass="section"id="examples">
<h2>Examples<aclass="headerlink"href="#examples"title="Permalink to this headline">¶</a></h2>
<divclass="highlight-python"><divclass="highlight"><pre>compute myFlux all heat/flux myKE myPE myStress
</pre></div>
</div>
</div>
<divclass="section"id="description">
<h2>Description<aclass="headerlink"href="#description"title="Permalink to this headline">¶</a></h2>
<p>Define a computation that calculates the heat flux vector based on
contributions from atoms in the specified group. This can be used by
itself to measure the heat flux into or out of a reservoir of atoms,
or to calculate a thermal conductivity using the Green-Kubo formalism.</p>
<p>See the <aclass="reference internal"href="fix_thermal_conductivity.html"><em>fix thermal/conductivity</em></a>
command for details on how to compute thermal conductivity in an
alternate way, via the Muller-Plathe method. See the <aclass="reference internal"href="fix_heat.html"><em>fix heat</em></a> command for a way to control the heat added or
subtracted to a group of atoms.</p>
<p>The compute takes three arguments which are IDs of other
<aclass="reference internal"href="compute.html"><em>computes</em></a>. One calculates per-atom kinetic energy
(<em>ke-ID</em>), one calculates per-atom potential energy (<em>pe-ID)</em>, and the
third calcualtes per-atom stress (<em>stress-ID</em>). These should be
defined for the same group used by compute heat/flux, though LAMMPS
does not check for this.</p>
<p>The Green-Kubo formulas relate the ensemble average of the
auto-correlation of the heat flux J to the thermal conductivity kappa:</p>
<p>Ei in the first term of the equation for J is the per-atom energy
(potential and kinetic). This is calculated by the computes <em>ke-ID</em>
and <em>pe-ID</em>. Si in the second term of the equation for J is the
per-atom stress tensor calculated by the compute <em>stress-ID</em>. The
tensor multiplies Vi as a 3x3 matrix-vector multiply to yield a
vector. Note that as discussed below, the 1/V scaling factor in the
equation for J is NOT included in the calculation performed by this
compute; you need to add it for a volume appropriate to the atoms
included in the calculation.</p>
<divclass="admonition note">
<pclass="first admonition-title">Note</p>
<pclass="last">The <aclass="reference internal"href="compute_pe_atom.html"><em>compute pe/atom</em></a> and <aclass="reference internal"href="compute_stress_atom.html"><em>compute stress/atom</em></a> commands have options for which
terms to include in their calculation (pair, bond, etc). The heat
flux calculation will thus include exactly the same terms. Normally
you should use <aclass="reference internal"href="compute_stress_atom.html"><em>compute stress/atom virial</em></a>
so as not to include a kinetic energy term in the heat flux.</p>
</div>
<p>This compute calculates 6 quantities and stores them in a 6-component
vector. The first 3 components are the x, y, z components of the full
heat flux vector, i.e. (Jx, Jy, Jz). The next 3 components are the x,
y, z components of just the convective portion of the flux, i.e. the
first term in the equation for J above.</p>
<hrclass="docutils"/>
<p>The heat flux can be output every so many timesteps (e.g. via the
<aclass="reference internal"href="thermo_style.html"><em>thermo_style custom</em></a> command). Then as a
post-processing operation, an autocorrelation can be performed, its
integral estimated, and the Green-Kubo formula above evaluated.</p>
<p>The <aclass="reference internal"href="fix_ave_correlate.html"><em>fix ave/correlate</em></a> command can calclate
the autocorrelation. The trap() function in the
<aclass="reference internal"href="variable.html"><em>variable</em></a> command can calculate the integral.</p>
<p>An example LAMMPS input script for solid Ar is appended below. The
result should be: average conductivity ~0.29 in W/mK.</p>
<hrclass="docutils"/>
<p><strong>Output info:</strong></p>
<p>This compute calculates a global vector of length 6 (total heat flux
vector, followed by convective heat flux vector), which can be
accessed by indices 1-6. These values can be used by any command that
uses global vector values from a compute as input. See <aclass="reference internal"href="Section_howto.html#howto-15"><span>this section</span></a> for an overview of LAMMPS output
options.</p>
<p>The vector values calculated by this compute are “extensive”, meaning
they scale with the number of atoms in the simulation. They can be
divided by the appropriate volume to get a flux, which would then be
an “intensive” value, meaning independent of the number of atoms in
the simulation. Note that if the compute is “all”, then the
appropriate volume to divide by is the simulation box volume.
However, if a sub-group is used, it should be the volume containing
those atoms.</p>
<p>The vector values will be in energy*velocity <aclass="reference internal"href="units.html"><em>units</em></a>. Once
divided by a volume the units will be that of flux, namely
Built with <ahref="http://sphinx-doc.org/">Sphinx</a> using a <ahref="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <ahref="https://readthedocs.org">Read the Docs</a>.