# [lammps-users] Question about Lattice command in LAMMPS?

Dear Steve,

I am very interested in LAMMPS for MD simulation.

When I am using lattice command to construct a fcc (or bcc) structure, I met a problem with <11-2> orientation as follows.

Using the following command,

lattice fcc 3.615 orient z 1 1 1 orient x 1 -1 0 orient y 1 1 -2 origin 0 0 0
region domCu block 0 2 0 2 0 2 units lattice

The print results in screen or log.lammps is

Lattice spacing in x,y,z = 5.11238 5.90327 6.26136
Created orthogonal box = (0 0 0) to (10.2248 11.8065 12.5227)

It is clear that the lattice spacing (5.90327) along y direction is WRONG!
The correct spacing along y direction should be 3.615*(1+1+4)^0.5=8.8549.

I checked the output atomic structure which does not show correct periodic along y direction.

Could you please kindly consider this matter? Your kind reply is much appreciated!

Best regards,
Ruifeng

Lattice spacing> It is clear that the lattice spacing (5.90327) along y direction is WRONG!
The correct spacing along y direction should be 3.615*(1+1+4)^0.5=8.8549.

it's not wrong; it's just different than you expect. The doc page
clearly states
that the lattice spacing LAMMPS computes is not guaranteed to be a
periodic repeat
distance: (from the doc page):

IMPORTANT NOTE: For non-orthogonal unit cells and/or when a rotation
is applied via the orient keyword, then the lattice spacings may be
less intuitive. In particular, in these cases, there is no guarantee
that the lattice spacing is an integer multiple of the periodicity of
the lattice in that direction. Thus, if you create an orthogonal
periodic simulation box whose size in a dimension is a multiple of the
lattice spacing, and then fill it with atoms via the create_atoms
command, you will NOT necessarily create a periodic system. I.e. atoms
may overlap incorrectly at the faces of the simulation box.

Your formula would not give a periodic repeat distance for a non-cubic
or non-orthogonal unit cell, once
is was rotated, so LAMMPS does this instead (from the manual);

If the spacing option is not specified, the lattice spacings are
computed by LAMMPS in the following way. A unit cell of the lattice is
mapped into the simulation box (scaled, shifted, rotated), so that it
now has (perhaps) a modified size and orientation. The lattice spacing
in X is defined as the difference between the min/max extent of the x
coordinates of the 8 corner points of the modified unit cell.
Similarly, the Y and Z lattice spacings are defined as the difference
in the min/max of the y and z coordinates.

If you don't like the value this produces, then it is just a number.
You can change it using the spacing
option of the lattice command: (from the manual), and set it to your
formula if you like:

The spacing option sets the 3 lattice spacings directly. All must be
non-zero (use 1.0 for dz in a 2d simulation). The specified values are
multiplied by the multiplicative factor described above that is
associated with the scale factor. Thus a spacing of 1.0 means one unit
cell independent of the scale factor. This option can be useful if the
spacings LAMMPS computes are inconvenient to use in subsequent
commands, which can be the case for non-orthogonal or rotated
lattices.

Steve

Dear Steve,

Many thanks for your kind reply together with clear clarification!

Based on the defination of “The lattice spacing in X is defined as the difference between the min/max extent of the x
coordinates of the 8 corner points of the modified unit cell.”, it is understandble for the lattice space along [11-2], which is different from “periodic repeating lattice spacing”.
Thanks again!

Have a nice weekend!
Best regards,
Ruifeng