How to properly redefine lattice in HCP

Hi everyone,

Firstly, I read the lattice command very carefully and it truly explains a lot. However, the result is not what I expect so I have to post my question here.
For a general HCP crystal, the default x-axis can be treated as <2-1-10> and y-axis can be treated as <01-10> in LAMMPS. Now I want to select <11-20> as the x-axis and <-1100> as the y-axis. According to its geometrical calculation, the new x vector should be <1 sqrt(3) 0> and new y vector should be <-3 sqrt(3) 0>, while keep z-axis as the same. We know that values in orient option should be integer, and satisfy orthogonal condition. Thus after approximation, <1 sqrt(3) 0> —> <7 12 0>, and <-3 sqrt(3) 0> —> <-12 7 0>. i.e.,
lattice hcp a orient x 7 12 0 orient y -12 7 0 orient z 0 0 1
After a test, Lattice spacing in x = 2a ?!
In my opinion, lattice spacing in x should be still equal to a since I did not change any primitive vector components.
Thank you for the time to view my question.

Best regards,

Lattice spacing is just a scaling factor. Can you visualize the system and examine the actual spacing? Also note that your lattice may not be periodic with any arbitrary replications.

T. Ray Shan

The lattice doc page explains the 3 lattice spacing params in detail for
rotated lattices. You should read that carefully, as it may be non-intuitive.
However, as Ray said, it is just a length parameter, that is used by various
commands. It actually does not affect the positions of the lattice points themselves.


Thank you for the reply. If I understand properly, when I rotate the lattice of HCP, then I should also change a1,a2 and a3, which is described in the warning section of lattice doc?


I have applied rotation matrix to change those primitive vector components but I got an error:

lattice custom 3.234 orient x 7 12 0 orient y -12 7 0 orient z 0 0 1 a1 0.50 -0.8 0.0 a2 1.5 0.9375 0.0 a3 0.0 0.0 1.598 &
basis 0.0 0.0 0.0 &
basis 0.6838 -0.1799 0.0 &
basis 0.3959 -0.34789 0.5 &
basis 0.57588 0.3359 0.5

ERROR: Illegal lattice command (…/lattice.cpp:215)

By default, a1 a2 and a3 should be orthogonal and they are still valid after rotation. I cannot see why it does not work.


I figured out that basis values have limitations, must be 0~1.