I am relatively new to Mathematica, and I am trying to build a 3D polyhedron model filled with points in a face-centered cubic (fcc) pattern that shall represent atoms. I am running on Mathematica 11.3.

First I generate the fcc lattice points (excluding the centre):

fcc = Select[Tuples[Range[-5, 5], {3}], EvenQ[Total[#]] &];
list = Select[fcc, Norm[#] > 0 &];

Then the boundary of a polyhedron is discretized using:

bnd = BoundaryDiscretizeGraphics @ PolyhedronData["Dodecahedron"];
reg = RegionMember @ bnd;

And lastly, only points are picked which are in the specified region.

atoms = Pick[list, reg @ list, True]

But the list created at this step remains empty. Initially, I thought it might be caused by the fixed size PolyhedronData assigns to Dodecahedron. Besides the fact the BoundaryDiscretizeGraphics does not accept scaled polyhedra, it still seems not to work if one would try to go with:


Anyone an idea what is happening?

  • $\begingroup$ Who or what is "fcc"? Please explain. Maybe you mean a face-centered cubic lattice? $\endgroup$ – Henrik Schumacher Apr 2 '19 at 10:39
  • 1
    $\begingroup$ Did you know you could just use PolyhedronData["Dodecahedron", "RegionFunction"]? $\endgroup$ – J. M.'s discontentment Apr 2 '19 at 10:43
  • $\begingroup$ fcc means face-centered cubic structure, a Bravais-lattice used to describe solid matter crystallographically, such as metals. Sorry for not explaining that point directly. $\endgroup$ – Jeff71 Apr 2 '19 at 10:44
  • 1
    $\begingroup$ You just have to scale the lattice like so: fcc = 0.125 Select[Tuples[Range[-20, 20], {3}], EvenQ[Total[#]] &]; and then continue as before. $\endgroup$ – Henrik Schumacher Apr 2 '19 at 10:47
  • $\begingroup$ Thank you @J.M. for that suggestion, indeed I have overseen that in the documentation. $\endgroup$ – Jeff71 Apr 2 '19 at 13:17

For the sake of summarizing the solutions and suggestions provided in the comments, and using your definitions of fcc, list, reg, then either of the following would work:

atoms = Select[list/2, reg]
atoms = Pick[list/2, reg[list/2]]

Without having to discretize, you can extract a region membership criterion directly from PolyhedronData, as suggested by @JM:

atoms = Select[list/2, Apply@PolyhedronData["Dodecahedron", "RegionFunction"]]

I want to point out a seeming inconsistency here; I would have expected PolyhedronData["Dodecahedron", "RegionFunction"] to return an object that behaves like a RegionMemberFunction (call it rmf), which would take lists as arguments, e.g. rmf[{x, y, z}]. However, PolyhedronData returns a pure function that expects coordinate arguments as a sequence instead, i.e. rmf[x, y, z]. Hence the need for the Apply in the Select expression above.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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