Page MenuHomec4science

velocity.html
No OneTemporary

File Metadata

Created
Mon, Dec 2, 19:41

velocity.html

<HTML>
<CENTER><A HREF = "http://lammps.sandia.gov">LAMMPS WWW Site</A> - <A HREF = "Manual.html">LAMMPS Documentation</A> - <A HREF = "Section_commands.html#comm">LAMMPS Commands</A>
</CENTER>
<HR>
<H3>velocity command
</H3>
<P><B>Syntax:</B>
</P>
<PRE>velocity group-ID style args keyword value ...
</PRE>
<UL><LI>group-ID = ID of group of atoms whose velocity will be changed
<LI>style = <I>create</I> or <I>set</I> or <I>scale</I> or <I>ramp</I> or <I>zero</I>
<PRE> <I>create</I> args = temp seed
temp = temperature value (temperature units)
seed = random # seed (8 digits or less)
<I>set</I> args = vx vy vz
vx,vy,vz = velocity value or NULL (velocity units)
<I>scale</I> arg = temp
temp = temperature value (temperature units)
<I>ramp</I> args = vdim vlo vhi dim clo chi
vdim = <I>vx</I> or <I>vy</I> or <I>vz</I>
vlo,vhi = lower and upper velocity value (velocity units)
dim = <I>x</I> or <I>y</I> or <I>z</I>
clo,chi = lower and upper coordinate bound (distance units)
<I>zero</I> arg = <I>linear</I> or <I>angular</I>
<I>linear</I> = zero the linear momentum
<I>angular</I> = zero the angular momentum
</PRE>
<LI>zero or more keyword/value pairs may be appended to the args
<LI>keyword = <I>dist</I> or <I>sum</I> or <I>mom</I> or <I>rot</I> or <I>temp</I> or <I>loop</I> or <I>units</I>
<PRE> <I>dist</I> value = <I>uniform</I> or <I>gaussian</I>
<I>sum</I> value = <I>no</I> or <I>yes</I>
<I>mom</I> value = <I>no</I> or <I>yes</I>
<I>rot</I> value = <I>no</I> or <I>yes</I>
<I>temp</I> value = temperature ID
<I>loop</I> value = <I>all</I> or <I>local</I> or <I>geom</I>
<I>units</I> value = <I>box</I> or <I>lattice</I>
</PRE>
</UL>
<P><B>Examples:</B>
</P>
<PRE>velocity all create 300.0 4928459 rot yes dist gaussian
velocity border set NULL 4.0 3.0 sum yes units box
velocity flow scale 300.0
velocity flow ramp lattice vx 0.0 5.0 y 5 20 temp mytemp
velocity all zero linear
</PRE>
<P><B>Description:</B>
</P>
<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 <I>create</I> style generates an ensemble of velocities using a random
number generator with the specified seed as the specified temperature.
</P>
<P>The <I>set</I> 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.
</P>
<P>The <I>scale</I> style computes the current temperature of the group of
atoms and then rescales the velocities to the specified temperature.
</P>
<P>The <I>ramp</I> style is similar to that used by the
<A HREF = "temperature.html">temperature</A> ramp 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 20), 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 20 in this
case), are assigned velocities equal to vlo or vhi (0.0 or 5.0 in this
case).
</P>
<P>The <I>zero</I> 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.
</P>
<P>All temperatures specified in the velocity command are in temperature
units; see the <A HREF = "units.html">units</A> command. The units of velocities and
coordinates depend on whether the <I>units</I> keyword is set to <I>box</I> or
<I>lattice</I>, as discussed below.
</P>
<P>For all styles, no atoms are assigned z-component velocities if the
simulation is 2d; see the <A HREF = "dimension.html">dimension</A> command.
</P>
<HR>
<P>The keyword/value option pairs are used in the following ways by the
various styles.
</P>
<P>The <I>dist</I> option is used by <I>create</I>. The ensemble of generated
velocities can be a <I>uniform</I> distribution from some minimum to
maximum value, scaled to produce the requested temperature. Or it can
be a <I>gaussian</I> distribution with a mean of 0.0 and a sigma scaled to
produce the requested temperature.
</P>
<P>The <I>sum</I> option is used by all styles, except <I>zero</I>. The new
velocities will be added to the existing ones if sum = yes, or will
replace them if sum = no.
</P>
<P>The <I>mom</I> and <I>rot</I> options are used by <I>create</I>. If mom = yes, the
linear momentum of the newly created ensemble of velocities is zeroed;
if rot = yes, the angular momentum is zeroed.
</P>
<P>The <I>temp</I> option is used by <I>create</I> and <I>scale</I> to specify a
user-defined way of computing temperature. If this option is not
used, <I>create</I> and <I>scale</I> compute temperature with the style "full"
for the group of atoms whose velocity is being altered. See the
<A HREF = "temperature.html">temperature</A> command for details. If the computed
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>
<HR>
<P>The <I>loop</I> option is used by <I>create</I> 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, regardless of how many processors are being used.
This will not be the case if atoms were created using the
<A HREF = "create_atoms.html">create_atoms</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 will always give the same set of velocities, independent
of how many processors are used. However, the generated velocities
may be more correlated than if the <I>all</I> or <I>local</I> options are used.
</P>
<P>Note that the <I>loop geom</I> option 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>
<P>The <I>units</I> option is used by <I>set</I> and <I>ramp</I>. If units = box,
the velocities and coordinates specified in the velocity command are
in the standard units described by the <A HREF = "units.html">units</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 HREF = "lattice.html">lattice</A>
command must have been previously used to define the lattice spacing.
</P>
<P><B>Restrictions:</B> none
</P>
<P><B>Related commands:</B>
</P>
<P><A HREF = "fix_shake.html">fix shake</A>, <A HREF = "lattice.html">lattice</A>
</P>
<P><B>Default:</B>
</P>
<P>The option defaults are dist = uniform, sum = no, mom = yes, rot = no,
temp = full style on group-ID, loop = all, and units = lattice.
</P>
</HTML>

Event Timeline