<h2>Description<a class="headerlink" href="#description" title="Permalink to this headline">¶</a></h2>
<p>This command creates atoms (or molecules) on a lattice, or a single
atom (or molecule), or a random collection of atoms (or molecules), as
an alternative to reading in their coordinates explicitly via a
<a class="reference internal" href="read_data.html"><em>read_data</em></a> or <a class="reference internal" href="read_restart.html"><em>read_restart</em></a>
command. A simulation box must already exist, which is typically
created via the <a class="reference internal" href="create_box.html"><em>create_box</em></a> command. Before using
this command, a lattice must also be defined using the
<a class="reference internal" href="lattice.html"><em>lattice</em></a> command, unless you specify the <em>single</em> style
with units = box or the <em>random</em> style. For the remainder of this doc
page, a created atom or molecule is referred to as a “particle”.</p>
<p>If created particles are individual atoms, they are assigned the
specified atom <em>type</em>, though this can be altered via the <em>basis</em>
keyword as discussed below. If molecules are being created, the type
of each atom in the created molecule is specified in the file read by
the <a class="reference internal" href="molecule.html"><em>molecule</em></a> command, and those values are added to
the specified atom <em>type</em>. E.g. if <em>type</em> = 2, and the file specifies
atom types 1,2,3, then each created molecule will have atom types
3,4,5.</p>
<p>For the <em>box</em> style, the create_atoms command fills the entire
simulation box with particles on the lattice. If your simulation box
is periodic, you should insure its size is a multiple of the lattice
spacings, to avoid unwanted atom overlaps at the box boundaries. If
your box is periodic and a multiple of the lattice spacing in a
particular dimension, LAMMPS is careful to put exactly one particle at
the boundary (on either side of the box), not zero or two.</p>
<p>For the <em>region</em> style, a geometric volume is filled with particles on
the lattice. This volume what is inside the simulation box and is
also consistent with the region volume. See the <a class="reference internal" href="region.html"><em>region</em></a>
command for details. Note that a region can be specified so that its
“volume” is either inside or outside a geometric boundary. Also note
that if your region is the same size as a periodic simulation box (in
some dimension), LAMMPS does not implement the same logic described
above as for the <em>box</em> style, to insure exactly one particle at
periodic boundaries. if this is what you desire, you should either
use the <em>box</em> style, or tweak the region size to get precisely the
particles you want.</p>
<p>For the <em>single</em> style, a single particle is added to the system at
the specified coordinates. This can be useful for debugging purposes
or to create a tiny system with a handful of particles at specified
positions.</p>
<p>For the <em>random</em> style, N particles are added to the system at
randomly generated coordinates, which can be useful for generating an
amorphous system. The particles are created one by one using the
speficied random number <em>seed</em>, resulting in the same set of particles
coordinates, independent of how many processors are being used in the
simulation. If the <em>region-ID</em> argument is specified as NULL, then
the created particles will be anywhere in the simulation box. If a
<em>region-ID</em> is specified, a geometric volume is filled which is both
inside the simulation box and is also consistent with the region
volume. See the <a class="reference internal" href="region.html"><em>region</em></a> command for details. Note that
a region can be specified so that its “volume” is either inside or
outside a geometric boundary.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">Particles generated by the <em>random</em> style will
typically be highly overlapped which will cause many interatomic
potentials to compute large energies and forces. Thus you should
either perform an <a class="reference internal" href="minimize.html"><em>energy minimization</em></a> or run dynamics
with <a class="reference internal" href="fix_nve_limit.html"><em>fix nve/limit</em></a> to equilibrate such a system,
before running normal dynamics.</p>
</div>
<p>Note that this command adds particles to those that already exist.
This means it can be used to add particles to a system previously read
in from a data or restart file. Or the create_atoms command can be
used multiple times, to add multiple sets of particles to the
simulation. For example, grain boundaries can be created, by
interleaving create_atoms with <a class="reference internal" href="lattice.html"><em>lattice</em></a> commands
specifying different orientations. By using the create_atoms command
in conjunction with the <a class="reference internal" href="delete_atoms.html"><em>delete_atoms</em></a> command,
reasonably complex geometries can be created, or a protein can be
solvated with a surrounding box of water molecules.</p>
<p>In all these cases, care should be taken to insure that new atoms do
not overlap existing atoms inappropriately, especially if molecules
are being added. The <a class="reference internal" href="delete_atoms.html"><em>delete_atoms</em></a> command can be
used to remove overlapping atoms or molecules.</p>
<hr class="docutils" />
<p>Individual atoms are inserted by this command, unless the <em>mol</em>
keyword is used. It specifies a <em>template-ID</em> previously defined
using the <a class="reference internal" href="molecule.html"><em>molecule</em></a> command, which reads a file that
defines the molecule. The coordinates, atom types, charges, etc, as
well as any bond/angle/etc and special neighbor information for the
molecule can be specified in the molecule file. See the
<a class="reference internal" href="molecule.html"><em>molecule</em></a> command for details. The only settings
required to be in this file are the coordinates and types of atoms in
the molecule.</p>
<p>Using a lattice to add molecules, e.g. via the <em>box</em> or <em>region</em> or
<em>single</em> styles, is exactly the same as adding atoms on lattice
points, except that entire molecules are added at each point, i.e. on
the point defined by each basis atom in the unit cell as it tiles the
simulation box or region. This is done by placing the geometric
center of the molecule at the lattice point, and giving the molecule a
random orientation about the point. The random <em>seed</em> specified with
the <em>mol</em> keyword is used for this operation, and the random numbers
generated by each processor are different. This means the coordinates
of individual atoms (in the molecules) will be different when running
on different numbers of processors, unlike when atoms are being
created in parallel.</p>
<p>Also note that because of the random rotations, it may be important to
use a lattice with a large enough spacing that adjacent molecules will
not overlap, regardless of their relative orientations.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">If the <a class="reference internal" href="create_box.html"><em>create_box</em></a> command is used to
create the simulation box, followed by the create_atoms command with
its <em>mol</em> option for adding molecules, then you typically need to use
the optional keywords allowed by the <a class="reference internal" href="create_box.html"><em>create_box</em></a>
command for extra bonds (angles,etc) or extra special neighbors. This
is because by default, the <a class="reference internal" href="create_box.html"><em>create_box</em></a> command sets
up a non-molecular system which doesn’t allow molecules to be added.</p>
</div>
<hr class="docutils" />
<p>This is the meaning of the other allowed keywords.</p>
<p>The <em>basis</em> keyword is only used when atoms (not molecules) are being
created. It specifies an atom type that will be assigned to specific
basis atoms as they are created. See the <a class="reference internal" href="lattice.html"><em>lattice</em></a>
command for specifics on how basis atoms are defined for the unit cell
of the lattice. By default, all created atoms are assigned the
argument <em>type</em> as their atom type.</p>
<p>The <em>remap</em> keyword only applies to the <em>single</em> style. If it is set
to <em>yes</em>, then if the specified position is outside the simulation
box, it will mapped back into the box, assuming the relevant
dimensions are periodic. If it is set to <em>no</em>, no remapping is done
and no particle is created if its position is outside the box.</p>
<p>The <em>var</em> and <em>set</em> keywords can be used to provide a criterion for
accepting or rejecting the addition of an individual atom, based on
its coordinates. The <em>vname</em> specified for the <em>var</em> keyword is the
name of an <a class="reference internal" href="variable.html"><em>equal-style variable</em></a> which should evaluate
to a zero or non-zero value based on one or two or three variables
which will store the x, y, or z coordinates of an atom (one variable
per coordinate). These other variables must be <a class="reference internal" href="variable.html"><em>equal-style variables</em></a> defined in the input script, but their
formula can by anything. The <em>set</em> keyword is used to identify the
names of these other variables, one variable for the x-coordinate of a
created atom, one for y, and one for z.</p>
<p>When an atom is created, its x, y, or z coordinates override the
formula for any <em>set</em> variable that is defined. The <em>var</em> variable is
then evaluated. If the returned value is 0.0, the atom is not
created. If it is non-zero, the atom is created. After all atoms are
created, the formulas defined for all of the <em>set</em> variables are
restored to their original strings.</p>
<p>As an example, these commands can be used in a 2d simulation, to
create a sinusoidal surface. Note that the surface is “rough” due to
individual lattice points being “above” or “below” the mathematical
expression for the sinusoidal curve. If a finer lattice were used,
the sinusoid would appear to be “smoother”. Also note the use of the
“xlat” and “ylat” <a class="reference internal" href="thermo_style.html"><em>thermo_style</em></a> keywords which
converts lattice spacings to distance. Click on the image for a
larger version.</p>
<div class="highlight-python"><div class="highlight"><pre>variable x equal 100
variable y equal 25
lattice hex 0.8442
region box block 0 $x 0 $y -0.5 0.5
create_box 1 box
</pre></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>variable xx equal 0.0
</a><p>The <em>rotate</em> keyword can be used with the <em>single</em> style, when adding
a single molecule to specify the orientation at which the molecule is
inserted. The axis of rotation is determined by the rotation vector
(Rx,Ry,Rz) that goes through the insertion point. The specified
<em>theta</em> determines the angle of rotation around that axis. Note that
the direction of rotation for the atoms around the rotation axis is
consistent with the right-hand rule: if your right-hand’s thumb points
along <em>R</em>, then your fingers wrap around the axis in the direction of
rotation.</p>
<p>The <em>units</em> keyword determines the meaning of the distance units used
to specify the coordinates of the one particle created by the <em>single</em>
style. A <em>box</em> value selects standard distance units as defined by
the <a class="reference internal" href="units.html"><em>units</em></a> command, e.g. Angstroms for units = real or
metal. A <em>lattice</em> value means the distance units are in lattice
spacings.</p>
<hr class="docutils" />
<p>Atom IDs are assigned to created atoms in the following way. The
collection of created atoms are assigned consecutive IDs that start
immediately following the largest atom ID existing before the
create_atoms command was invoked. When a simulation is performed on
different numbers of processors, there is no guarantee a particular
created atom will be assigned the same ID. If molecules are being
created, molecule IDs are assigned to created molecules in a similar
fashion.</p>
<p>Aside from their ID, atom type, and xyz position, other properties of
created atoms are set to default values, depending on which quantities
are defined by the chosen <a class="reference internal" href="atom_style.html"><em>atom style</em></a>. See the <a class="reference internal" href="atom_style.html"><em>atom style</em></a> command for more details. See the
<a class="reference internal" href="set.html"><em>set</em></a> and <a class="reference internal" href="velocity.html"><em>velocity</em></a> commands for info on how
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>.