# Creating a polyhedron filled with points in face-centered cubic structure

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:

0.5*list


Anyone an idea what is happening?

• Who or what is "fcc"? Please explain. Maybe you mean a face-centered cubic lattice? – Henrik Schumacher Apr 2 '19 at 10:39
• Did you know you could just use PolyhedronData["Dodecahedron", "RegionFunction"]? – J. M.'s discontentment Apr 2 '19 at 10:43
• 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. – Jeff71 Apr 2 '19 at 10:44
• 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. – Henrik Schumacher Apr 2 '19 at 10:47
• Thank you @J.M. for that suggestion, indeed I have overseen that in the documentation. – 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]

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.