49 lines
1.2 KiB
Plaintext
49 lines
1.2 KiB
Plaintext
|
% 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)}
|
||
|
}
|
||
|
}
|
||
|
}
|