lammps/doc/set.html

176 lines
8.1 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>set command
</H3>
<P><B>Syntax:</B>
</P>
<PRE>set style ID keyword value ...
</PRE>
<UL><LI>style = <I>atom</I> or <I>group</I> or <I>region</I>
<LI>ID = atom ID or group ID or region ID
<LI>one or more keyword/value pairs may be appended to the args
<LI>keyword = <I>type</I> or <I>type/fraction</I> or <I>mol</I> or <I>x</I> or <I>y</I> or <I>z</I> or <I>vx</I> or <I>vy</I> or <I>vz</I> or <I>charge</I> or <I>dipole</I> or <I>dipole/random</I> or <I>quat/random</I> or <I>bond</I> or <I>angle</I> or <I>dihedral</I> or <I>improper</I>
<PRE> <I>type</I> value = atom type
<I>type/fraction</I> values = type fraction seed
type = new atom type
fraction = fraction of selected atoms to set to new atom type
seed = random # seed (8 digits or less)
<I>mol</I> value = molecule ID
<I>x</I>,<I>y</I>,<I>z</I> value = atom coordinate (distance units)
<I>vx</I>,<I>vy</I>,<I>vz</I> value = velocity component (velocity units)
<I>charge</I> value = atomic charge (charge units)
<I>dipole</I> values = x y z
x,y,z = orientation of dipole moment vector
<I>dipole/random</I> value = seed
seed = random # seed (8 digits or less) for dipole moment orientations
<I>quat</I> values = a b c theta
a,b,c = unit vector to rotate particle around via right-hand rule
theta = rotation angle in degrees
<I>quat/random</I> value = seed
seed = random # seed (8 digits or less) for quaternion orientations
<I>bond</I> value = bond type for all bonds between selected atoms
<I>angle</I> value = angle type for all angles bewteen selected atoms
<I>dihedral</I> value = dihedral type for all dihedrals between selected atoms
<I>improper</I> value = improper type for all impropers between selected atoms
</PRE>
</UL>
<P><B>Examples:</B>
</P>
<PRE>set group solvent type 2
set group solvent type/fraction 2 0.5 12393
set group edge bond 4
set region half charge 0.5
set atom 100 x 0.5 vx 1.0
set atom 1492 type 3
</PRE>
<P><B>Description:</B>
</P>
<P>Set one or more properties of one or more atoms. Since atom
properties are initially assigned by the <A HREF = "read_data.html">read_data</A>,
<A HREF = "read_restart.html">read_restart</A> or <A HREF = "create_atoms.html">create_atoms</A>
commands, this command changes those assignments. This can be useful
for overriding the default values assigned by the
<A HREF = "create_atoms.html">create_atoms</A> command (e.g. charge = 0.0). It can
be useful for altering pairwise and molecular force interactions,
since force-field coefficients are defined in terms of types. It can
be used to change the labeling of atoms by atom type when they are
output in <A HREF = "dump.html">dump</A> files. It can be useful for debugging
purposes; i.e. positioning an atom at a precise location to compute
subsequent forces or energy.
</P>
<P>The style <I>atom</I> selects a single atom. The style <I>group</I> selects the
entire group of atoms. The style <I>region</I> selects all atoms in the
geometric region. The associated ID for each of these styles is
either the unique atom ID (typically a number from 1 to N = the number
of atoms in the simulation), the group ID, or the region ID. See the
<A HREF = "group.html">group</A> and <A HREF = "region.html">region</A> commands for details of
how to specify a group or region.
</P>
<HR>
<P>Keyword <I>type</I> sets the atom type for all selected atoms. The
specified value must be from 1 to ntypes, where ntypes was set by the
<A HREF = "create_box.html">create_box</A> command or the <I>atom types</I> field in the
header of the data file read by the <A HREF = "read_data.html">read_data</A>
command.
</P>
<P>Keyword <I>type/fraction</I> sets the atom type for a fraction of the
selected atoms. The actual number of atoms changed is not guaranteed
to be exactly the requested fraction, but should be statisticaly
close. Random numbers are used in such a way that a particular atom
is changed or not changed, regardless of how many processors are being
used.
</P>
<P>Keyword <I>mol</I> sets the molecule ID for all selected atoms. The <A HREF = "atom_style.html">atom
style</A> being used must support the use of molecule
IDs.
</P>
<P>Keywords <I>x</I>, <I>y</I>, <I>z</I>, <I>vx</I>, <I>vy</I>, <I>vz</I>, and <I>charge</I> set the
coordinates, velocity, or charge of all selected atoms. For <I>charge</I>,
the <A HREF = "atom_style.html">atom style</A> being used must support the use of
atomic charge.
</P>
<P>Keyword <I>dipole</I> uses the specified x,y,z values as components of a
vector to set as the orientation of the dipole moment vectors of the
selected atoms. The magnitude of the dipole moment for each atom is
set by the <A HREF = "dipole.html">dipole</A> command.
</P>
<P>Keyword <I>dipole/random</I> randomizes the orientation of the dipole
moment vectors of the selected atoms. The magnitude of the dipole
moment for each atom is set by the <A HREF = "dipole.html">dipole</A> command. For
2d systems, the z component of the orientation is set to 0.0. Random
numbers are used in such a way that the orientation of a particular
atom is the same, regardless of how many processors are being used.
</P>
<P>Keyword <I>quat</I> uses the specified values to create a quaternion
(4-vector) that represents the orientation of the selected atoms.
Note that the <A HREF = "shape.html">shape</A> command is used to specify the aspect
ratios of an ellipsoidal particle, which is oriented by default with
its x-axis along the simulation box's x-axis, and similarly for y and
z. If this body is rotated (via the right-hand rule) by an angle
theta around a unit rotation vector (a,b,c), then the quaternion that
represents its new orientation is given by (cos(theta/2),
a*sin(theta/2), b*sin(theta/2), c*sin(theta/2)). The theta and a,b,c
values are the arguments to the <I>quat</I> keyword. LAMMPS normalizes the
quaternion in case (a,b,c) was not specified as a unit vector. For 2d
systems, the a,b,c values are ignored, since a rotation vector of
(0,0,1) is the only valid choice.
</P>
<P>Keyword <I>quat/random</I> randomizes the orientation of the quaternion of
the selected atoms. Random numbers are used in such a way that the
orientation of a particular atom is the same, regardless of how many
processors are being used. For 2d systems, only orientations in the
xy plane are generated.
</P>
<P>For the <I>dipole</I> and <I>quat</I> keywords, the <A HREF = "atom_style.html">atom style</A>
being used must support the use of dipoles or quaternions.
</P>
<P>Keywords <I>bond</I>, <I>angle</I>, <I>dihedral</I>, and <I>improper</I>, set the bond
type (angle type, etc) of all bonds (angles, etc) of selected atoms to
the specified value from 1 to nbondtypes (nangletypes, etc). All
atoms in a particular bond (angle, etc) must be selected atoms in
order for the change to be made. The value of nbondtype (nangletypes,
etc) was set by the <I>bond types</I> (<I>angle types</I>, etc) field in the
header of the data file read by the <A HREF = "read_data.html">read_data</A>
command.
</P>
<P><B>Restrictions:</B>
</P>
<P>You cannot set an atom attribute (e.g. <I>mol</I> or <I>q</I>) if the
<A HREF = "atom_style.html">atom_style</A> does not have that attribute.
</P>
<P>This command requires inter-processor communication to coordinate the
setting of bond types (angle types, etc). This means that your system
must be ready to perform a simulation before using one of these
keywords (force fields set, atom mass set, etc). This is not
necessary for other keywords.
</P>
<P>Using the <I>region</I> style with the bond (angle, etc) keywords can give
unpredictable results if there are bonds (angles, etc) that straddle
periodic boundaries. This is because the region may only extend up to
the boundary and partner atoms in the bond (angle, etc) may have
coordinates outside the simulation box if they are ghost atoms.
</P>
<P><B>Related commands:</B>
</P>
<P><A HREF = "create_box.html">create_box</A>, <A HREF = "create_atoms.html">create_atoms</A>,
<A HREF = "read_data.html">read_data</A>
</P>
<P><B>Default:</B> none
</P>
</HTML>