lammps/doc/velocity.html

223 lines
9.9 KiB
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 (positive integer)
<I>set</I> args = vx vy vz
vx,vy,vz = velocity value or NULL (velocity units)
any of vx,vy,vz van be a variable (see below)
<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
<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>rigid</I> value = fix-ID
fix-ID = ID of rigid body fix
<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 v_vz sum yes units box
velocity flow scale 300.0
velocity flow ramp vx 0.0 5.0 y 5 25 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. Any of the vx,vy,vz velocity components can be specified as
an equal-style or atom-style <A HREF = "variable.html">variable</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 <I>units</I> keyword below.
</P>
<P>Equal-style variables can specify formulas with various mathematical
functions, and include <A HREF = "thermo_style.html">thermo_style</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 <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 = "compute_temp_ramp.html">compute
temp/ramp</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 <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. If the <I>rigid</I> option is
specified (see below), then the zeroing is performed on individual
rigid bodies, as defined by the <A HREF = "fix_rigid.html">fix rigid or fix
rigid/small</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 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
<A HREF = "compute.html">compute</A> that calculates temperature in a desired way.
If this option is not specified, <I>create</I> and <I>scale</I> calculate
temperature using a compute that is defined as follows:
</P>
<PRE>compute velocity_temp group-ID temp
</PRE>
<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 HREF = "compute_temp.html">compute
temp</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, independent 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 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 <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>rigid</I> option only has meaning when used with the <I>zero</I> style.
It allows specification of a fix-ID for one of the <A HREF = "fix_rigid.html">rigid-body
fix</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 <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. The
rigid option is not defined by default.
</P>
</HTML>