# Creating 2d-HexagonalLattice and 3d-HexagonalClosePacking lattice with LatticeData function

I found here a solution by s0rce on how one can for example create a 3d FaceCenteredCubic lattice structure:

basis = LatticeData["FaceCenteredCubic", "Basis"];
points = Tuples[Range[-4, 4], 3].basis;
inside = Select[points, Norm[#] <= 4 &];
Graphics3D[Sphere[inside, 0.25]]


How can I build up a 2d lattice of HexagonalLattice structure and a 3d lattice of HexagonalClosePacking by using LatticeData and find the corresponding coordinates?

I tried the following:

1.

LatticeData[]

{"BaseCenteredMonoclinic", "BaseCenteredOrthorhombic", \
"BodyCenteredCubic", "BodyCenteredOrthorhombic", \
"CenteredTetragonal", "CoxeterTodd", "FaceCenteredCubic", \
"FaceCenteredOrthorhombic", "HexagonalClosePacking", \
"HexagonalLattice", "KorkineZolotarev", "Leech", "SimpleCubic", \
"SimpleHexagonal", "SimpleMonoclinic", "SimpleOrthorhombic", \
"SimpleTetragonal", "SimpleTriclinic", "SimpleTrigonal", \
"SquareLattice", "TetrahedralPacking"}

LatticeData["HexagonalClosePacking", "Properties"]

{"AlternateNames", "AutomorphismGroupOrder", "Basis", \
"CenterDensity", "Classes", "CoveringRadius", "CoxeterNumber", \
"Density", "Determinant", "Dimension", "Dual", "Even", "Extremal", \
"GeneratorMatrix", "Genus", "GlueVectors", "GramMatrix", \
"HermiteInvariant", "Image", "Integral", "KissingNumber", \
"MinimalNorm", "MinimalVectors", "ModularNumber", "Name", \
"Nonextremal", "Nonintegral", "Nonunimodular", "Notation", "Odd", \
"ThetaSeriesFunction", "Thickness", "Unimodular", "Volume"}

LatticeData["HexagonalClosePacking", "Basis"]

Missing["NotApplicable"]


Here I probably need the MinimalVectors to produce the crystal structure, but how?

2.

LatticeData["HexagonalLattice", "Basis"]

SparseArray[Automatic, {2, 2}, 0, {
1, {{0, 2, 3}, {{2}, {1}, {2}}}, {1, -1, -1}}]


How can I get the coordinates from the SparseArray?

Summary:

1.

list1 = LatticeData["HexagonalClosePacking", "Properties"]

Grid[{#, LatticeData["HexagonalClosePacking", #]} & /@ list1,
Frame -> All, Alignment -> Left]


2.

list2 = LatticeData["HexagonalClosePacking", "Properties"]

Grid[{#, LatticeData["HexagonalClosePacking", #]} & /@ list2,
Frame -> All, Alignment -> Left]


• mathematica.stackexchange.com/questions/61834/… Apr 1 '19 at 15:27
• @Alrubaie: Thank you. I would like to see a solution with LatticeData.
– lio
Apr 1 '19 at 15:29
• What do you try and with what results? You already know about LatticeData[]. Why did you fail to get good results? Apr 1 '19 at 22:21
• @ Somos: See above.
– lio
Apr 2 '19 at 9:14

My answer to MSE question 3100098 "Calculate cartesian coordinates from lattice points in hexagonal closest packing (HCP)" may be what you need.

Try $$\,\textrm{HCP}(i,j,k) = (i+(j+m)/2,\, (3j+m)/\sqrt{12},\, k\sqrt{2/3})\,$$ where $$\,m=\textrm{mod}(k,2)\,$$ and $$\,i,j,k\,$$ are any integers. Check this with the OEIS sequence A004012 "Theta series of hexagonal close-packing.". What the formula expresses with the use of $$\,m\,$$ the parity of $$\,k\,$$ is that HCP is not a lattice but the union of two lattices. The first is centered at the origin and the second is a shifted copy of the first.

However, LatticeData[] has much information about HCP missing so you need some other source of information about it. The MinimalVectors is not sufficient by itself. In the case of HexagonalLattice you can use:

LatticeData["HexagonalLattice", "Basis"] // Normal


which returns the result {{-1, 1}, {0, -1}}. The documentation of LatticeData[] has a section on Possible Issues and the first example advises to use Normal[] to get a matrix. However, since "HexagonalLattice" is a lattice, the result seems obscure. It should be something like

{{1, 0}, {-1/2, Sqrt[3]/2}}


instead which does generate the lattice. This lattice is also known as the $$A2$$ lattice of Eisenstein integers.