Function Repository Resource:

LatticeUnitCellPlot3D

Source Notebook

Display specific unit cells in a 3D lattice

Contributed by: Radhika Prasad

ResourceFunction["LatticeUnitCellPlot3D"][{vx,vy,vz},{nx,ny,nz}]

plots cells of the lattice defined by the basis vectors vi with ni cells plotted along each basis direction.

Details and Options

The ni are natural numbers specifying the number of unit cells to be drawn along each of the basis vector directions vi.
The following options are supported:
"PositionCell"0list of indices specifying which unit cells to plot (highlight)
"BackgroundCell""UnitCellEdge"specifies how the remaining lattice points or unit cells (which are not highlighted) should appear
"PositionCell" is an option that is a list of indices specifying which unit cells to plot (highlight). The default is to highlight all the unit cells. It is a list having the same dimensions as {nx,ny,nz}, and the elements are either 0 or 1. The positions (indices) containing 1 are the unit cells that would be highlighted.
"BackgroundCell" is an option that specifies how the remaining lattice points or unit cells (which are not highlighted) should appear. The default value is "UnitCellEdge." It takes the following values:
"LatticePoints"plot only lattice points
"UnitCellEdge"plot only the edges of the unit cells
"PointsAndCell"plot the lattice points as well as the edges of the unit cells

Examples

Basic Examples (1) 

Plot the unit cells for the lattice defined by the basis vectors vi drawn ni times:

In[1]:=
ResourceFunction[
 "LatticeUnitCellPlot3D"][{{1, 1, 0}, {1, 0, 1}, {0, 1, 1}}, {2, 2, 2}]
Out[1]=

Options (5) 

PositionCell (1) 

Specify the indices of the unit cells to be highlighted by using the option "PositionCell":

In[2]:=
ResourceFunction[
 "LatticeUnitCellPlot3D"][{{1, 1, 0}, {1, 0, 1}, {0, 1, 1}}, {2, 2, 2}, "PositionCell" -> {{{1, 0}, {0, 1}}, {{0, 0}, {1, 1}}}]
Out[2]=

BackgroundCell (4) 

"BackgroundCell" is an option that specifies how the remaining lattice points or unit cells (which are not highlighted) should appear:

In[3]:=
ResourceFunction[
 "LatticeUnitCellPlot3D"][{{1, 1, 0}, {1, 0, 1}, {0, 1, 1}}, {2, 2, 2}, "BackgroundCell" -> "LatticePoints"]
Out[3]=

"LatticePoints" only highlights the lattice points for the background cells:

In[4]:=
ResourceFunction[
 "LatticeUnitCellPlot3D"][{{1, 1, 0}, {1, 0, 1}, {0, 1, 1}}, {2, 2, 2}, "PositionCell" -> {{{1, 0}, {0, 1}}, {{0, 0}, {1, 1}}}, "BackgroundCell" -> "LatticePoints"]
Out[4]=

"UnitCellEdge" only highlights the edges of the unit cells for the background cells:

In[5]:=
ResourceFunction[
 "LatticeUnitCellPlot3D"][{{1, 1, 0}, {1, 0, 1}, {0, 1, 1}}, {2, 2, 2}, "PositionCell" -> {{{1, 0}, {0, 1}}, {{0, 0}, {1, 1}}}, "BackgroundCell" -> "UnitCellEdge"]
Out[5]=

"PointsAndCell" highlights both the lattice points and the unit cell edges for the background cells:

In[6]:=
ResourceFunction[
 "LatticeUnitCellPlot3D"][{{1, 1, 0}, {1, 0, 1}, {0, 1, 1}}, {2, 2, 2}, "PositionCell" -> {{{1, 0}, {0, 1}}, {{0, 0}, {1, 1}}}, "BackgroundCell" -> "PointsAndCell"]
Out[6]=

Publisher

WolframSpecialProjects

Version History

  • 1.0.0 – 04 November 2020

Related Resources

License Information