\newcommand\tikzPnJunction[7]{ \begin{tikzpicture}[scale=1.0] \pgfmathsetmacro{\tkW}{8} % Total width \pgfmathsetmacro{\tkH}{5} % Total height % left \pgfmathsetmacro{\tkLx}{0} % Start \pgfmathsetmacro{\tkLW}{\tkW*#1} % Width \pgfmathsetmacro{\tkLyshift}{#2} % y-shift \pgfmathsetmacro{\tkLBendH}{#3} % Band bending height \pgfmathsetmacro{\tkLBendW}{\tkLW/4} % Band bending width \pgfmathsetmacro{\tkLEv}{0.7+\tkLyshift}% Valence band energy \pgfmathsetmacro{\tkLEc}{2.3+\tkLyshift}% Conduction band energy \pgfmathsetmacro{\tkLEV}{4.0+\tkLyshift}% Vacuum energy \pgfmathsetmacro{\tkLEf}{1.1+\tkLyshift}% Fermi level energy % right \pgfmathsetmacro{\tkRx}{\tkW*(1-#4)} % Start \pgfmathsetmacro{\tkRW}{\tkW*#4} % Width \pgfmathsetmacro{\tkRyshift}{#5} % y-shift \pgfmathsetmacro{\tkRBendH}{#6} % Band bending height \pgfmathsetmacro{\tkRBendW}{\tkRW/4} % Band bending width \pgfmathsetmacro{\tkREv}{0.7+\tkRyshift}% Valence band energy \pgfmathsetmacro{\tkREc}{2.3+\tkRyshift}% Conduction band energy \pgfmathsetmacro{\tkREV}{4.0+\tkRyshift}% Vacuum energy \pgfmathsetmacro{\tkREf}{1.9+\tkRyshift}% Fermi level energy % materials \draw[sc p type] (0,0) rectangle (\tkLW,\tkH); \node at (\tkLW/2,\tkH-0.2) {\GT{p-type}}; \path[sc separate] (\tkRx,0) -- (\tkRx,\tkH); \path[sc n type] (\tkRx,0) rectangle (\tkW,\tkH); \node at (\tkRx+\tkRW/2,\tkH-0.2) {\GT{n-type}}; \path[sc separate] (\tkLW,0) -- (\tkLW,\tkH); \drawAxes % right bands \path[sc occupied] (\tkRx, 0) -- \rightBandAuto{}{\tkREv} -- (\tkW, 0) -- cycle; \draw[sc band con] \rightBandAuto{$\Econd$}{\tkREc}; \draw[sc band val] \rightBandAuto{$\Evalence$}{\tkREv}; \draw[sc band vac] \rightBandAuto{$\Evac$}{\tkREV}; \draw[sc fermi level] \rightBand{$\Efermi$}{\tkREf}; % left bands \path[sc occupied] (\tkLx, 0) -- \leftBandAuto{}{\tkLEv} -- (\tkLW, 0) -- cycle; \draw[sc band con] \leftBandAuto{$\Econd$}{\tkLEc}; \draw[sc band val] \leftBandAuto{$\Evalence$}{\tkLEv}; \draw[sc band vac] \leftBandAuto{$\Evac$}{\tkLEV}; \draw[sc fermi level] \leftBand{$\Efermi$}{\tkLEf}; % work functions \drawDArrow{\tkRx+\tkRW*2/3}{\tkREf}{\tkREV}{$e\Phi_\txn$} \drawDArrow{\tkRx+\tkRW*1/3}{\tkREc}{\tkREV}{$e\chi_\txn$} \drawDArrow{\tkLx+\tkLW*2/3}{\tkLEf}{\tkLEV}{$e\Phi_\txp$} \drawDArrow{\tkLx+\tkLW*1/3}{\tkLEc}{\tkLEV}{$e\chi_\txp$} % barrier height % \drawDArrow{\tkRx+\tkRBendW}{\tkREc}{\tkREc+\tkRBendH}{$eU_\text{Bias}$} % \drawDArrow{\tkRx}{\tkREf}{\tkREc+\tkRBendH}{$e\Phi_\txB$} #7 \end{tikzpicture} } % \tikzPnJunction{1/3}{0}{0}{1/3}{0}{0}{} % \tikzPnJunction{1/2}{0.4}{-0.4}{1/2}{-0.4}{0.4}{}