CoCalc Shared FilesQMSE02-2018-01-16 / fcc.ipynb
Authors: Hal Snyder, William A. Stein
Views : 16
Description: simple face centered cubic 3D lattice figures

# Lattice Visualization

CoCalc lets you build 3D models of lattice structure that can be rotated to see periodicity along different vectors. The two figures in this worksheet provide simple movable examples of face centered cubic structures.

Face-centered cubic lattice is one of the 14 possible Bravais lattices in 3 dimensions.

References:

In [1]:
from sage.plot.plot3d.shapes import Sphere

In [2]:
def fcc(obj=Sphere(.7, color='red'), offset=None):
"""
return a list of 3D objects
for face centered cubic lattice
corner at origin
cube edge 10 units

offset is a triple offseting the lattice in x, y, z directions
"""
S = []
ofx = ofy = ofz = 0
if offset is not None:
ofx, ofy, ofz = offset
# corners
for ix in [0,10]:
for iy in [0,10]:
for iz in [0,10]:
S.append(obj.translate(ix, iy, iz))
# object at center of each of 6 faces
# for each axis, add object at 0 and 10 on that axis and 5,5 on other axes
S.append(obj.translate(0, 5, 5))
S.append(obj.translate(10, 5, 5))
S.append(obj.translate(5, 0, 5))
S.append(obj.translate(5, 10, 5))
S.append(obj.translate(5, 5, 0))
S.append(obj.translate(5, 5, 10))
return S

In [3]:
# Display part of a simple face-centered cubic lattice

# for zinc blende, the unit of the lattice is ZnS