1
$\begingroup$

I am confused with lattice parameter and the basis. The structure I generated is not HCP. To verify this, one could use this plotting function from the answer to Can a LatticeData image be displayed in a space filled fashion:

volumetricPlot[latticeType_] := 
 Module[{img = LatticeData[latticeType, "Image"], 
   r = LatticeData[latticeType, "PackingRadius"]}, 
  Show[img /. Sphere[pt_, r_] :> {}, 
   Map[RegionPlot3D[(EuclideanDistance[{x, y, z}, #] < r), {x, -1, 
       1}, {y, -1, 1}, {z, -1, 1}, Mesh -> False, 
      PlotStyle -> Opacity[.5]] &, 
    Cases[img, Sphere[pos_, _] :> pos, Infinity]]]]

volumetricPlot["HexagonalClosePacking"]

plot

The structure should be close-packed, so the bottom row of spheres should be touching the ones above it. But this is clearly not the case.

$\endgroup$
2
  • $\begingroup$ This could be made into a valid question by adding the code to reproduce it. I'll just do that because I already did it before... $\endgroup$
    – Jens
    Feb 6, 2016 at 22:42
  • $\begingroup$ added bug tag because of the previous post that's now linked in the question. It's probably OK to have this question for reference. $\endgroup$
    – Jens
    Feb 6, 2016 at 22:47

1 Answer 1

2
$\begingroup$

Indeed, there is a bug, as I noted in a related answer, and a bug report has been submitted by @Peeter Joot in 2013.

As a temporary fix for the issue (hoping that the bug will get resolved in the near future after more than two years), you could use the following modification of the plotting function in the question:

volumetricPlot[latticeType_] := Module[
  {pts,
   img = LatticeData[latticeType, "Image"],
   r = LatticeData[latticeType, "PackingRadius"]},      
  If[latticeType == "HexagonalClosePacking", 
   pts = {{-1, 0, Sqrt[2/3]}, {-(1/2), Sqrt[3]/2, Sqrt[2/
      3]}, {-(1/2), -(Sqrt[3]/2), Sqrt[2/3]}, {0, 0, Sqrt[2/3]}, {1/2,
       Sqrt[3]/2, Sqrt[2/3]}, {1/2, -(Sqrt[3]/2), Sqrt[2/3]}, {1, 0, 
      Sqrt[2/3]}, {-(1/2), 1/(2 Sqrt[3]), 0}, {0, 
      1/(2 Sqrt[3]) - Sqrt[3]/2, 0}, {1/2, 1/(2 Sqrt[3]), 0}, {-1, 
      0, -Sqrt[(2/3)]}, {-(1/2), Sqrt[3]/
      2, -Sqrt[(2/3)]}, {-(1/2), -(Sqrt[3]/2), -Sqrt[(2/3)]}, {0, 
      0, -Sqrt[(2/3)]}, {1/2, Sqrt[3]/2, -Sqrt[(2/3)]}, {1/
      2, -(Sqrt[3]/2), -Sqrt[(2/3)]}, {1, 0, -Sqrt[(2/3)]}},
   pts = Cases[img, Sphere[pos_, _] :> pos, Infinity]]; 
  Show[img /. Sphere[pt_, r_] :> {}, 
   Map[RegionPlot3D[(EuclideanDistance[{x, y, z}, #] < r), {x, -1, 
       1}, {y, -1, 1}, {z, -1, 1}, Mesh -> False, 
      PlotStyle -> Opacity[.5]] &, pts]]]

volumetricPlot["HexagonalClosePacking"]

hcp corrected

This has the gaps corrected by shifting the z coordinates appropriately to make the center lie at the origin. The function volumetricPlot should be able to look up the data for all desired lattices, but handles the HCP case separately.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.