Ian Jauslin
summaryrefslogtreecommitdiff
blob: 40ffd031c8c36049290b972c0db7ad92c1a52b2f (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
%%
%% Macros to draw graphene lattices
%%

% numerical values
% sqrt(3)/2
\def\sqrttt{0.866}
% sqrt(3)
\def\sqrtt {1.732}

%l1
\def\lo{(1.5,\sqrttt)}
%l2
\def\lt{(1.5,-\sqrttt)}
%-l1
\def\mlo{(-1.5,-\sqrttt)}
%-l2
\def\mlt{(-1.5,\sqrttt)}

% shapes
\def\square#1#2#3{\draw[#3]#1++(-#2,-#2)--++(#2,0)--++(#2,0)--++(0,#2)--++(0,#2)--++(-#2,0)--++(-#2,0)--++(0,-#2)--++(0,-#2);}
\def\fullsquare#1#2#3{\fill[#3]#1++(-#2,-#2)--++(#2,0)--++(#2,0)--++(0,#2)--++(0,#2)--++(-#2,0)--++(-#2,0)--++(0,-#2)--++(0,-#2);}

% atoms
\def\a#1#2{\fill[#2]#1circle(.1);}
\def\b#1#2{\fullsquare{#1}{.1}{#2}}
\def\at#1#2{\fill[color=white]#1circle(.1);\draw[#2]#1circle(.1);}
\def\bt#1#2{\fullsquare{#1}{.17}{color=white}\square{#1}{.17}{#2}}


% draw a hexagon
\def\hexagon#1#2{
  % draw the lines one at a time (so that dashes overlap if the line is dashed)
  \draw[#2]#1++(1,0)--++(120:1);
  \draw[#2]#1++(-120:1)--++(120:1);
  \draw[#2]#1++(60:1)--++(-1,0);
  \draw[#2]#1++(-60:1)--++(-1,0);
  \draw[#2]#1++(120:1)--++(-120:1);
  \draw[#2]#1++(1,0)--++(-120:1);
}

% draw the atoms around a hexagon
\def\as#1#2{
  \a{#1++(1,0)}{#2}
  \a{#1++(120:1)}{#2}
  \a{#1++(-120:1)}{#2}
}
\def\ats#1#2{
  \at{#1++(1,0)}{#2}
  \at{#1++(120:1)}{#2}
  \at{#1++(-120:1)}{#2}
}
\def\bs#1#2{
  \b{#1++(-1,0)}{#2}
  \b{#1++(60:1)}{#2}
  \b{#1++(-60:1)}{#2}
}
\def\bts#1#2{
  \bt{#1++(-1,0)}{#2}
  \bt{#1++(60:1)}{#2}
  \bt{#1++(-60:1)}{#2}
}

% base lattice
\def\graphene#1#2{
  \hexagon{#1}{#2}
  \hexagon{#1++\lo}{#2}
  \hexagon{#1++\lt}{#2}
  \hexagon{#1++\mlo}{#2}
  \hexagon{#1++\mlt}{#2}
  \hexagon{#1++\lo++\mlt}{#2}
  \hexagon{#1++\lo++\mlt++\lo}{#2}
  \hexagon{#1++\lo++\mlt++\mlt}{#2}
}

% base lattice of sites
\def\sitelattice#1#2#3{
  \csname #1s\endcsname{#2}{#3}
  \csname #1s\endcsname{#2++\lo}{#3}
  \csname #1s\endcsname{#2++\lt}{#3}
  \csname #1s\endcsname{#2++\mlo}{#3}
  \csname #1s\endcsname{#2++\mlt}{#3}
  \csname #1s\endcsname{#2++\lo++\mlt}{#3}
  \csname #1s\endcsname{#2++\lo++\mlt++\lo}{#3}
  \csname #1s\endcsname{#2++\lo++\mlt++\mlt}{#3}
}