<p>Set or change the velocities of a group of atoms in one of several
styles. For each style, there are required arguments and optional
keyword/value parameters. Not all options are used by each style.
Each option has a default as listed below.</p>
<p>The <em>create</em> style generates an ensemble of velocities using a random
number generator with the specified seed as the specified temperature.</p>
<p>The <em>set</em> style sets the velocities of all atoms in the group to the
specified values. If any component is specified as NULL, then it is
not set. Any of the vx,vy,vz velocity components can be specified as
an equal-style or atom-style <a class="reference internal" href="variable.html"><span class="doc">variable</span></a>. If the value
is a variable, it should be specified as v_name, where name is the
variable name. In this case, the variable will be evaluated, and its
value used to determine the velocity component. Note that if a
variable is used, the velocity it calculates must be in box units, not
lattice units; see the discussion of the <em>units</em> keyword below.</p>
<p>Equal-style variables can specify formulas with various mathematical
functions, and include <a class="reference internal" href="thermo_style.html"><span class="doc">thermo_style</span></a> command
keywords for the simulation box parameters or other parameters.</p>
<p>Atom-style variables can specify the same formulas as equal-style
variables but can also include per-atom values, such as atom
coordinates. Thus it is easy to specify a spatially-dependent
velocity field.</p>
<p>The <em>scale</em> style computes the current temperature of the group of
atoms and then rescales the velocities to the specified temperature.</p>
<p>The <em>ramp</em> style is similar to that used by the <a class="reference internal" href="compute_temp_ramp.html"><span class="doc">compute temp/ramp</span></a> command. Velocities ramped
uniformly from vlo to vhi are applied to dimension vx, or vy, or vz.
The value assigned to a particular atom depends on its relative
coordinate value (in dim) from clo to chi. For the example above, an
atom with y-coordinate of 10 (1/4 of the way from 5 to 25), would be
assigned a x-velocity of 1.25 (1/4 of the way from 0.0 to 5.0). Atoms
outside the coordinate bounds (less than 5 or greater than 25 in this
case), are assigned velocities equal to vlo or vhi (0.0 or 5.0 in this
case).</p>
<p>The <em>zero</em> style adjusts the velocities of the group of atoms so that
the aggregate linear or angular momentum is zero. No other changes
are made to the velocities of the atoms. If the <em>rigid</em> option is
specified (see below), then the zeroing is performed on individual
rigid bodies, as defined by the <a class="reference internal" href="fix_rigid.html"><span class="doc">fix rigid or fix rigid/small</span></a> commands. In other words, zero linear
will set the linear momentum of each rigid body to zero, and zero
angular will set the angular momentum of each rigid body to zero.
This is done by adjusting the velocities of the atoms in each rigid
body.</p>
<p>All temperatures specified in the velocity command are in temperature
units; see the <a class="reference internal" href="units.html"><span class="doc">units</span></a> command. The units of velocities and
coordinates depend on whether the <em>units</em> keyword is set to <em>box</em> or
<em>lattice</em>, as discussed below.</p>
<p>For all styles, no atoms are assigned z-component velocities if the
simulation is 2d; see the <a class="reference internal" href="dimension.html"><span class="doc">dimension</span></a> command.</p>
<hr class="docutils" />
<p>The keyword/value options are used in the following ways by the
various styles.</p>
<p>The <em>dist</em> keyword is used by <em>create</em>. The ensemble of generated
velocities can be a <em>uniform</em> distribution from some minimum to
maximum value, scaled to produce the requested temperature. Or it can
be a <em>gaussian</em> distribution with a mean of 0.0 and a sigma scaled to
produce the requested temperature.</p>
<p>The <em>sum</em> keyword is used by all styles, except <em>zero</em>. The new
velocities will be added to the existing ones if sum = yes, or will
replace them if sum = no.</p>
<p>The <em>mom</em> and <em>rot</em> keywords are used by <em>create</em>. If mom = yes, the
linear momentum of the newly created ensemble of velocities is zeroed;
<p>where group-ID is the same ID used in the velocity command. i.e. the
group of atoms whose velocity is being altered. This compute is
deleted when the velocity command is finished. See the <a class="reference internal" href="compute_temp.html"><span class="doc">compute temp</span></a> command for details. If the calculated
temperature should have degrees-of-freedom removed due to fix
constraints (e.g. SHAKE or rigid-body constraints), then the
appropriate fix command must be specified before the velocity command
is issued.</p>
<p>The <em>bias</em> keyword with a <em>yes</em> setting is used by <em>create</em> and
<em>scale</em>, but only if the <em>temp</em> keyword is also used to specify a
<a class="reference internal" href="compute.html"><span class="doc">compute</span></a> that calculates temperature in a desired way.
If the temperature compute also calculates a velocity bias, the the
bias is subtracted from atom velocities before the <em>create</em> and
<em>scale</em> operations are performed. After the operations, the bias is
added back to the atom velocities. See <a class="reference internal" href="Section_howto.html#howto-15"><span class="std std-ref">Section howto 16</span></a> of the doc pages for more discussion
of temperature computes with biases. Note that the velocity bias is
only applied to atoms in the temperature compute specified with the
<em>temp</em> keyword.</p>
<p>As an example, assume atoms are currently streaming in a flow
direction (which could be separately initialized with the <em>ramp</em>
style), and you wish to initialize their thermal velocity to a desired
temperature. In this context thermal velocity means the per-particle
velocity that remains when the streaming velocity is subtracted. This
can be done using the <em>create</em> style with the <em>temp</em> keyword
specifying the ID of a <a class="reference internal" href="compute_temp_ramp.html"><span class="doc">compute temp/ramp</span></a> or
<a class="reference internal" href="compute_temp_profile.html"><span class="doc">compute temp/profile</span></a> command, and the
<em>bias</em> keyword set to a <em>yes</em> value.</p>
<hr class="docutils" />
<p>The <em>loop</em> keyword is used by <em>create</em> in the following ways.</p>
<p>If loop = all, then each processor loops over all atoms in the
simulation to create velocities, but only stores velocities for atoms
it owns. This can be a slow loop for a large simulation. If atoms
were read from a data file, the velocity assigned to a particular atom
will be the same, independent of how many processors are being used.
This will not be the case if atoms were created using the
<a class="reference internal" href="create_atoms.html"><span class="doc">create_atoms</span></a> command, since atom IDs will likely
be assigned to atoms differently.</p>
<p>If loop = local, then each processor loops over only its atoms to
produce velocities. The random number seed is adjusted to give a
different set of velocities on each processor. This is a fast loop,
but the velocity assigned to a particular atom will depend on which
processor owns it. Thus the results will always be different when a
simulation is run on a different number of processors.</p>
<p>If loop = geom, then each processor loops over only its atoms. For
each atom a unique random number seed is created, based on the atom’s
xyz coordinates. A velocity is generated using that seed. This is a
fast loop and the velocity assigned to a particular atom will be the
same, independent of how many processors are used. However, the set
of generated velocities may be more correlated than if the <em>all</em> or
<em>local</em> keywords are used.</p>
<p>Note that the <em>loop geom</em> keyword will not necessarily assign
identical velocities for two simulations run on different machines.
This is because the computations based on xyz coordinates are
sensitive to tiny differences in the double-precision value for a
coordinate as stored on a particular machine.</p>
<hr class="docutils" />
<p>The <em>rigid</em> keyword only has meaning when used with the <em>zero</em> style.
It allows specification of a fix-ID for one of the <a class="reference internal" href="fix_rigid.html"><span class="doc">rigid-body fix</span></a> variants which defines a set of rigid bodies. The
zeroing of linear or angular momentum is then performed for each rigid
body defined by the fix, as described above.</p>
<p>The <em>units</em> keyword is used by <em>set</em> and <em>ramp</em>. If units = box,
the velocities and coordinates specified in the velocity command are
in the standard units described by the <a class="reference internal" href="units.html"><span class="doc">units</span></a> command
(e.g. Angstroms/fmsec for real units). If units = lattice, velocities
are in units of lattice spacings per time (e.g. spacings/fmsec) and
coordinates are in lattice spacings. The <a class="reference internal" href="lattice.html"><span class="doc">lattice</span></a>
command must have been previously used to define the lattice spacing.</p>
</div>
<hr class="docutils" />
<div class="section" id="restrictions">
<h2>Restrictions</h2>
<p>Assigning a temperature via the <em>create</em> style to a system with <a class="reference internal" href="fix_rigid.html"><span class="doc">rigid bodies</span></a> or <a class="reference internal" href="fix_shake.html"><span class="doc">SHAKE constraints</span></a> may not
have the desired outcome for two reasons. First, the velocity command
can be invoked before all of the relevant fixes are created and
initialized and the number of adjusted degrees of freedom (DOFs) is
known. Thus it is not possible to compute the target temperature
correctly. Second, the assigned velocities may be partially canceled
when constraints are first enforced, leading to a different
temperature than desired. A workaround for this is to perform a <a class="reference internal" href="run.html"><span class="doc">run 0</span></a> command, which insures all DOFs are accounted for
properly, and then rescale the temperature to the desired value before
<span class="n">run</span> <span class="mi">0</span> <span class="c1"># temperature may not be 300K</span>
<span class="n">velocity</span> <span class="nb">all</span> <span class="n">scale</span> <span class="mf">300.0</span> <span class="c1"># now it should be</span>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.