Ian Jauslin
summaryrefslogtreecommitdiff
blob: 4f044ae30119170db66d889f5984931d20125eb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
% sqrt(3)/2
\def\sqrtThOT{0.866}
% sqrt(3)
\def\sqrtTh{1.732}
% pi
\def\pival{3.14159}

% base vectorsj
\def\Lo{(1.5,\sqrtThOT)}
\def\Lt{(1.5,-\sqrtThOT)}
\def\mLo{(-1.5,-\sqrtThOT)}
\def\mLt{(-1.5,\sqrtThOT)}

% filled square at #1 of side-length #2
\def\fullsquare#1#2{\fill#1++(-#2,-#2)--++(#2,0)--++(#2,0)--++(0,#2)--++(0,#2)--++(-#2,0)--++(-#2,0)--++(0,-#2)--++(0,-#2);}
% in color
\def\fullsquarecolor#1#2#3{\fill[color=#3]#1++(-#2,-#2)--++(#2,0)--++(#2,0)--++(0,#2)--++(0,#2)--++(-#2,0)--++(-#2,0)--++(0,-#2)--++(0,-#2);}

% type-a site at #1
\def\asite#1{\fill#1circle(.1);}
% in color
\def\asitec#1#2{\fill[color=#2]#1circle(.1);}
% type-b site at #1
\def\bsite#1{\fullsquare{#1}{.1}}
% in color
\def\bsitec#1#2{\fullsquarecolor{#1}{.1}{#2}}

% base cell with a site at #1
\def\cell#1{
  \draw#1--++(0:1);
  \draw#1--++(120:1);
  \draw#1--++(240:1);
  \asite{#1}
  \draw#1++(1,0)--++(0:-1);
  \draw#1++(1,0)--++(120:-1);
  \draw#1++(1,0)--++(240:-1);
  \bsite{#1++(1,0)}
}

% grpahene grid at #1 of width #2 and height #3
\def\graphene#1#2#3{
  \foreach \i in {0,...,#2}{
    \foreach \j in {0,...,#3}{
      \cell{#1++(\i*3,-2*\j*\sqrtThOT)}
      \cell{#1++(\i*3+1.5,\sqrtThOT-2*\j*\sqrtThOT)}
    }
  }
}