LatticeData["SimpleCubic", "Image"]
The above line gives me a single cube (2 lattice points in each direction).
But I want a lattice with 4 lattice points in each direction. How do I generate that?
LatticeData["SimpleCubic", "Image"]
The above line gives me a single cube (2 lattice points in each direction).
But I want a lattice with 4 lattice points in each direction. How do I generate that?
It is easy to generate coordinates for these using Tuples
:
coords = Tuples[Range[4], 3]
Graphics3D@Point[coords]
If you need the grid lines too, you can generate a 2D lattice for each face in a similar way and extrude them into lines.
Sphere[#, radius]&
in place of Point
. For the lines you need to generate a 2D grid for each face.
$\endgroup$
The comments I got for this post are about speed basically. I improved it greatly because I removed opacity objects (which are nice visually but cause slow down). So let me just show the final result of fast and much more complicated (Tetrahedral) lattice than yours (which means your simple cubic will work too but with a bonus). So get your data
cell = LatticeData["TetrahedralPacking", "Image"];
Build extended lattice:
Graphics3D[Translate[DeleteCases[cell, {_, _, Polygon[_]}, Infinity][[1]],
2 Tuples[Range[3], 3]], Boxed -> False]
Now, let me go back in time and explain from the very beginning how it works. A brute force approach. Here is a single lattice cell:
cell = LatticeData["SimpleCubic", "Image"];
Now use Translate:
Graphics3D[Translate[cell[[1]], 2 Tuples[Range[4], 3]], Boxed -> False]
Even so the method is a bit wasteful (you repeating overlapping spheres), it is very simple and works for much more complicated crystal structures where creating custom grid is tedious - plus the style of lattice data is nice:
cell = LatticeData["TetrahedralPacking", "Image"]
Graphics3D[Translate[cell[[1]], 2 Tuples[Range[2], 3]], Boxed -> False]