« home

Basis + Lattice

Creator: Stefan Bringuier

crystalssymmetrysolid state physicscetztikz

Operation illustrating combination of a motif/basis with a point lattice to generate a crystal structure.


Basis + Lattice

  Download

PNGPDF

  Code

  LaTeX

basis-plus-lattice.tex (50 lines)

\documentclass[tikz,border=5pt]{standalone}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}
    % Define shaded atom style
    \tikzset{atom/.style={circle, shading=ball, ball color=#1, minimum size=15pt}}

    % Define motif/basis
    \node (motif) at (0,0) {
        \begin{tikzpicture}
            \node[atom=blue] (atom1) at (0,0) {};
            \node[atom=red] (atom2) at (0.5,0.5) {};
        \end{tikzpicture}
    };
    \node at ($(motif.east) + (0.5,0)$) [right] {+};

    % Define point lattice
    \node (lattice) at (4,0) {
        \begin{tikzpicture}
            \foreach \x in {0,1,2}
                \foreach \y in {0,1,2}
                    \draw (\x,\y) node[circle,fill,inner sep=2pt]{};
        \end{tikzpicture}
    };
    \node at ($(lattice.east) + (0.5,0)$) [right] {=};

    % Define combined structure with unit cell outline
    \node (crystal) at (8,0) {
        \begin{tikzpicture}
            % Draw unit cell outline
            \draw[black, thick] (0,0) rectangle (1,1);

            % Draw atoms
            \foreach \x in {0,1,2}
                \foreach \y in {0,1,2} {
                    \node[atom=blue] at (\x,\y) {};
                    \node[atom=red] at ($(\x,\y)+(0.5,0.5)$) {};
                }
        \end{tikzpicture}
    };

    % Labels
    \node at (motif.south) [below] {Motif/Basis};
    \node at (lattice.south) [below] {Point Lattice};
    \node at (crystal.south) [below] {Crystal Structure};

\end{tikzpicture}
\end{document}

  Typst

basis-plus-lattice.typ (60 lines)

#import "@preview/cetz:0.3.2": canvas, draw
#import draw: content, circle, group, rect

#set page(width: auto, height: auto, margin: 8pt)

#let atom(pos, color) = {
  circle(pos, radius: 0.25, fill: color.lighten(20%), stroke: 0.3pt)
}

#canvas({
  // Constants for layout
  let spacing = 4
  let motif-x = 1
  let lattice-x = spacing
  let crystal-x = 2 * spacing

  // Draw motif/basis
  group({
    atom((motif-x, 0.8), blue)
    atom((motif-x + .5, 1.3), red)
  })
  content((motif-x, -1), text(size: 10pt)[Motif/Basis])

  // Plus sign
  content((motif-x + 0.45 * spacing, 1), text(size: 22pt)[+])

  // Draw point lattice
  group({
    for x in range(3) {
      for y in range(3) {
        circle(
          (x + lattice-x, y),
          radius: 0.1,
          fill: black,
          stroke: none,
        )
      }
    }
  })
  content((lattice-x + 1, -1), text(size: 10pt)[Point Lattice])

  // Equals sign
  content((lattice-x + 0.72 * spacing, 1), text(size: 22pt)[=])

  // Draw crystal structure
  group({
    // Draw unit cell outline
    rect((crystal-x, 0), (crystal-x + 1, 1), stroke: black + 1pt)

    // Draw atoms
    for x in range(3) {
      for y in range(3) {
        atom((x + crystal-x, y), blue)
        atom((x + crystal-x + 0.5, y + 0.5), red)
      }
    }
  })
  content((crystal-x + 1.5, -1), text(size: 10pt)[Crystal Structure])
})