Skip to content

Instantly share code, notes, and snippets.

@surt91
Last active December 30, 2015 06:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save surt91/7790122 to your computer and use it in GitHub Desktop.
Save surt91/7790122 to your computer and use it in GitHub Desktop.
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\newcommand*{\shear}{0.2}
\newcommand*{\height}{1.0}
\newcommand*{\radius}{0.1}
\newcommand*{\xspacing}{1}
\newcommand*{\yspacing}{0.5}
% two-dimensional lattice, with three dimensional basis
% decreasing counter, otherwise there will be lines through the circles
\foreach \x in {4,...,0}{
\foreach \y/\dx in {3,...,0}{
% primitive vectors
\draw (\x+\y*\shear-\xspacing/2 , \y*\yspacing )
-- (\x+\y*\shear+\xspacing/2, \y*\yspacing );
\draw (\x+\y*\shear-\shear/2 , \y*\yspacing-\yspacing/2)
-- (\x+\y*\shear+\shear/2 , \y*\yspacing+\yspacing/2);
\draw (\x+\y*\shear , \y*\yspacing )
-- (\x+\y*\shear , \y*\yspacing+\height );
% base
\fill[white] (\x+\y*\shear, \y*\yspacing ) circle(\radius);
\draw (\x+\y*\shear, \y*\yspacing ) circle(\radius);
\fill[gray] (\x+\y*\shear, \y*\yspacing+\height) circle(\radius);
\draw (\x+\y*\shear, \y*\yspacing+\height) circle(\radius);
}
}
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment