# Question about lattice spacing

Hello all,
I have a question about lattice spacing, for example, I use:

lattice fcc 3.6149 orient x -1 0 1 orient y 1 1 1 orient z -1 2 -1

then Ithe LAMMPS print:

Lattice spacing in x,y,z = 5.11224 6.26119 5.90311

This make me puzzled. Then I read the manual, but I still do not know how it is calculated.

This followed is my guess:

3.6149*((-1)^2+0^2+1^2)^(0.5)=5.11224
3.6149*(1^2+1^2+1^2)^(0.5)=6.26119
How to get the 5.90311? Anyone who can give me a explanation?

Hi,Qitao Liu
which style of units you used for simulation? is lj units?

best

Xuepeng

units metal

What I use is "metal".

Best Regard.

The lattice doc page explains it:

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 spacing LAMMPS uses, you can set it

yourself with the spacing keyword of the lattice command.

Steve

Regardless of which unit style you use, the interplanar spacing d is always: d = sqrt(a^2/(h^2+k^2+l^2)). So that:

dx = sqrt(3.6149^2/(1+1)) = 2.556
dy = sqrt(3.6149^2/(1+1+1)) = 2.087

dz = sqrt(3.6149^2/(1+4+1)) = 1.475

Combined with the doc page, LAMMPS chose lattice spacing in x, y, and z to be 2dx, 3dy, and 4*dz.

Cheers,
Ray

Dear Steve,
In fact, I had read the manual many times, but I still do not understand, I ask.
You said “If you don’t like the spacing LAMMPS uses, you can set it yourself with the spacing keyword of the lattice command”, I have a question, the lattice spacing the LAMMPS uses can be set at my will? For example, I use

lattice fcc 3.6149 orient x -1 0 1 orient y 1 -2 1 orient z 1 1 1 spacing 2 2 2

Then the lattice spacing could be 2 2 2, but this 2 2 2 could be reasonable?
All in one, the lattice spacing I set at my will could be always reasonable? Does is affect my simulation results?
Best Regard
Qitao LIU

Dear Ray,
I think you have solved my question. A little quesion, why lattice spacing in x, y, and z could be 2dx, 3dy, and 4*dz? Or it is just set by LAMMPS Developer at their will? All in all, I know how to calculate the lattice spacing, Thanks for your reply very much.
Best Regard
Qitao LIU

Qitao,

No, of course not “at their will”. There is always a rule, a formula, or a convention. The paragraph Steve cites already hinted the answer, “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”.

Take X for example, when you rotate the lattice so that  now aligns with [-101], the min and max extent of the x coordinates now encompass TWO [-101] interplannar spacings - hence the 2dx. Same for Y, when you rotate so that  now aligns with , the min/max of the y coordinates now encompass THREE  interplannar spacings - hence the 3dy. Similar for Z, which is a little more complicated. Programs such as VMD, Avagadro, or AtomEye will help the visualization.

Ray

The “lattice spacing” is not used by LAMMPS to define the lattice.
It is only used to define a length scale used by some other commands,
always as units box vs lattice. For units lattice, the length scale
for that command is in multiples of the lattice spacing, rather than

e.g. Angstroms (for metal units). So you can set that alternate
length scale to what you want it to be, if you don’t like the way

LAMMPS chooses to do it. This is all explained on the lattice
doc page.

Steve

Thanks for you reply, I want to know how LAMMPS calculate the lattice spacing, because I want to know how big the simulation box created.
I use

lattice fcc 3.6149 orient x 1 0 0 orient y 0 1 0 orient z 0 0 1
region box block -15 15 -100 10 -50 10

and

lattice fcc 3.6149 orient x -1 0 1 orient y 1 1 1 orient z -1 2 -1
region box block -15 15 -100 10 -50 10

then the boxes are not the same. I read the manual, but I still do not understand, then ask. Sometimes I can not express my ideas clearly in English. Thank you for your kind understanding.

Ray Shan gives me a lot help, Thanks very much.
Best regards.
Qitao LIU

They will not have the same box dimensions since the lattice spacings are different.

Ray

Thanks for you reply, I want to know how LAMMPS calculate the lattice
spacing, because I want to know how big the simulation box created.
I use

lattice fcc 3.6149 orient x 1 0 0 orient y 0 1 0 orient z 0 0 1
region box block -15 15 -100 10 -50 10

and

lattice fcc 3.6149 orient x -1 0 1 orient y 1 1 1 orient z -1 2 -1
region box block -15 15 -100 10 -50 10

then the boxes are not the same. I read the manual, but I still do not
understand, then ask. Sometimes I can not express my ideas clearly in
English. Thank you for your kind understanding.

this is not a problem of english, but a problem of thinking. it is
*extremely* easy to just use the "write_dump" command and write out
one frame of the current system and look at the box bounds output in
it. no more guessing and pointless asking needed. just plain common
sense again. Thanks all, Now I have know how to solve my problem.
Thanks again.
Best Regards,
Qitao LIU