<spanid="index-0"></span><h1>fix thermal/conductivity command<aclass="headerlink"href="#fix-thermal-conductivity-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>fix ID group-ID thermal/conductivity N edim Nbin keyword value ...
</pre></div>
</div>
<ulclass="simple">
<li>ID, group-ID are documented in <aclass="reference internal"href="fix.html"><em>fix</em></a> command</li>
<li>thermal/conductivity = style name of this fix command</li>
<li>N = perform kinetic energy exchange every N steps</li>
<li>edim = <em>x</em> or <em>y</em> or <em>z</em> = direction of kinetic energy transfer</li>
<li>Nbin = # of layers in edim direction (must be even number)</li>
<li>zero or more keyword/value pairs may be appended</li>
<li>keyword = <em>swap</em></li>
</ul>
<preclass="literal-block">
<em>swap</em> value = Nswap = number of swaps to perform every N steps
</pre>
</div>
<divclass="section"id="examples">
<h2>Examples<aclass="headerlink"href="#examples"title="Permalink to this headline">¶</a></h2>
<divclass="highlight-python"><divclass="highlight"><pre>fix 1 all thermal/conductivity 100 z 20
fix 1 all thermal/conductivity 50 z 20 swap 2
</pre></div>
</div>
</div>
<divclass="section"id="description">
<h2>Description<aclass="headerlink"href="#description"title="Permalink to this headline">¶</a></h2>
<p>Use the Muller-Plathe algorithm described in <aclass="reference internal"href="fix_viscosity.html#muller-plathe"><span>this paper</span></a> to exchange kinetic energy between two particles
in different regions of the simulation box every N steps. This
induces a temperature gradient in the system. As described below this
enables the thermal conductivity of a material to be calculated. This
algorithm is sometimes called a reverse non-equilibrium MD (reverse
NEMD) approach to computing thermal conductivity. This is because the
usual NEMD approach is to impose a temperature gradient on the system
and measure the response as the resulting heat flux. In the
Muller-Plathe method, the heat flux is imposed, and the temperature
gradient is the system’s response.</p>
<p>See the <aclass="reference internal"href="compute_heat_flux.html"><em>compute heat/flux</em></a> command for details
on how to compute thermal conductivity in an alternate way, via the
Green-Kubo formalism.</p>
<p>The simulation box is divided into <em>Nbin</em> layers in the <em>edim</em>
direction, where the layer 1 is at the low end of that dimension and
the layer <em>Nbin</em> is at the high end. Every N steps, Nswap pairs of
atoms are chosen in the following manner. Only atoms in the fix group
are considered. The hottest Nswap atoms in layer 1 are selected.
Similarly, the coldest Nswap atoms in the “middle” layer (see below)
are selected. The two sets of Nswap atoms are paired up and their
velocities are exchanged. This effectively swaps their kinetic
energies, assuming their masses are the same. If the masses are
different, an exchange of velocities relative to center of mass motion
of the 2 atoms is performed, to conserve kinetic energy. Over time,
this induces a temperature gradient in the system which can be
measured using commands such as the following, which writes the
temperature profile (assuming z = edim) to the file tmp.profile:</p>
<divclass="highlight-python"><divclass="highlight"><pre>compute ke all ke/atom
variable temp atom c_ke/1.5
fix 3 all ave/spatial 10 100 1000 z lower 0.05 v_temp &
file tmp.profile units reduced
</pre></div>
</div>
<p>Note that by default, Nswap = 1, though this can be changed by the
optional <em>swap</em> keyword. Setting this parameter appropriately, in
conjunction with the swap rate N, allows the heat flux to be adjusted
across a wide range of values, and the kinetic energy to be exchanged
in large chunks or more smoothly.</p>
<p>The “middle” layer for velocity swapping is defined as the <em>Nbin</em>/2 +
1 layer. Thus if <em>Nbin</em> = 20, the two swapping layers are 1 and 11.
This should lead to a symmetric temperature profile since the two
layers are separated by the same distance in both directions in a
periodic sense. This is why <em>Nbin</em> is restricted to being an even
number.</p>
<p>As described below, the total kinetic energy transferred by these
swaps is computed by the fix and can be output. Dividing this
quantity by time and the cross-sectional area of the simulation box
yields a heat flux. The ratio of heat flux to the slope of the
temperature profile is proportional to the thermal conductivity of the
fluid, in appropriate units. See the <aclass="reference internal"href="fix_viscosity.html#muller-plathe"><span>Muller-Plathe paper</span></a> for details.</p>
<divclass="admonition note">
<pclass="first admonition-title">Note</p>
<pclass="last">If your system is periodic in the direction of the heat flux,
then the flux is going in 2 directions. This means the effective heat
flux in one direction is reduced by a factor of 2. You will see this
in the equations for thermal conductivity (kappa) in the Muller-Plathe
paper. LAMMPS is simply tallying kinetic energy which does not
account for whether or not your system is periodic; you must use the
value appropriately to yield a kappa for your system.</p>
</div>
<divclass="admonition note">
<pclass="first admonition-title">Note</p>
<pclass="last">After equilibration, if the temperature gradient you observe is
not linear, then you are likely swapping energy too frequently and are
not in a regime of linear response. In this case you cannot
accurately infer a thermal conductivity and should try increasing the
<h2>Restart, fix_modify, output, run start/stop, minimize info<aclass="headerlink"href="#restart-fix-modify-output-run-start-stop-minimize-info"title="Permalink to this headline">¶</a></h2>
<p>No information about this fix is written to <aclass="reference internal"href="restart.html"><em>binary restart files</em></a>. None of the <aclass="reference internal"href="fix_modify.html"><em>fix_modify</em></a> options
are relevant to this fix.</p>
<p>This fix computes a global scalar which can be accessed by various
<aclass="reference internal"href="Section_howto.html#howto-15"><span>output commands</span></a>. The scalar is the
cummulative kinetic energy transferred between the bottom and middle
of the simulation box (in the <em>edim</em> direction) is stored as a scalar
quantity by this fix. This quantity is zeroed when the fix is defined
and accumlates thereafter, once every N steps. The units of the
quantity are energy; see the <aclass="reference internal"href="units.html"><em>units</em></a> command for details.
The scalar value calculated by this fix is “intensive”.</p>
<p>No parameter of this fix can be used with the <em>start/stop</em> keywords of
the <aclass="reference internal"href="run.html"><em>run</em></a> command. This fix is not invoked during <aclass="reference internal"href="minimize.html"><em>energy minimization</em></a>.</p>
</div>
<divclass="section"id="restrictions">
<h2>Restrictions<aclass="headerlink"href="#restrictions"title="Permalink to this headline">¶</a></h2>
<p>This fix is part of the MISC package. It is only enabled if LAMMPS
was built with that package. See the <aclass="reference internal"href="Section_start.html#start-3"><span>Making LAMMPS</span></a> section for more info.</p>
<p>Swaps conserve both momentum and kinetic energy, even if the masses of
the swapped atoms are not equal. Thus you should not need to
thermostat the system. If you do use a thermostat, you may want to
apply it only to the non-swapped dimensions (other than <em>vdim</em>).</p>
<p>LAMMPS does not check, but you should not use this fix to swap the
kinetic energy of atoms that are in constrained molecules, e.g. via
<aclass="reference internal"href="fix_shake.html"><em>fix shake</em></a> or <aclass="reference internal"href="fix_rigid.html"><em>fix rigid</em></a>. This is
because application of the constraints will alter the amount of
transferred momentum. You should, however, be able to use flexible
molecules. See the <aclass="reference internal"href="pair_gran.html#zhang"><span>Zhang paper</span></a> for a discussion and results
of this idea.</p>
<p>When running a simulation with large, massive particles or molecules
in a background solvent, you may want to only exchange kinetic energy
bewteen solvent particles.</p>
</div>
<divclass="section"id="related-commands">
<h2>Related commands<aclass="headerlink"href="#related-commands"title="Permalink to this headline">¶</a></h2>
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>.