Skip to content
Snippets Groups Projects
semiconductors.py 1.78 KiB
import os

import matplotlib
matplotlib.use('agg')
from matplotlib import pyplot

import numpy as np
from scipy.optimize import curve_fit
from scipy.integrate import quad

import common
from common import draw_classic_axes

E_V, E_C, E_F = -1.2, 1.8, .4
E_D, E_A = E_C - .7, E_V + .5
m_h, m_e = 1, .5


def plot_dos():
    E = np.linspace(-3, 3, 1000)
    fig, ax = pyplot.subplots()

    n_F = 1/(np.exp(2*(E - E_F)) + 1)
    g_e = m_e * sqrt_plus(E - E_C)
    g_h = m_h * sqrt_plus(E_V - E)
    sqrt_plus = lambda x: np.sqrt(x * (x >= 0))
    ax.plot(E, g_h, label="$g_e$")
    ax.plot(E, g_e, label="$g_h$")
    ax.plot(E, 10 * g_h * (1-n_F), label="$n_h$")
    ax.plot(E, 10 * g_e * n_F, label="$n_e$")
    ax.plot(E, n_F, label="$n_F$", linestyle='dashed')
    ax.set_ylim(top=1.5)

    ax.set_xlabel('$E$')
    ax.set_ylabel('$g$')
    ax.set_xticks([E_V, E_C, E_F])
    ax.set_xticklabels(['$E_V$', '$E_C$', '$E_F$'])
    ax.legend()
    draw_classic_axes(ax, xlabeloffset=.2)
    fig.savefig('intrinsic_DOS.svg')

def plot_doping():    
    E = np.linspace(-3, 3, 1000)
    fig, ax = pyplot.subplots()

    n_F = 1/(np.exp(2*(E - E_F)) + 1)
    g_e = m_e * sqrt_plus(E - E_C)
    g_h = m_h * sqrt_plus(E_V - E)
    sqrt_plus = lambda x: np.sqrt(x * (x >= 0))
    ax.plot(E, g_h, label="$g_e$")
    ax.plot(E, g_e, label="$g_h$")

    sigma = 0.01
    g_D = np.exp(-(E_D - E)**2 / sigma**2)
    g_A = .7 * np.exp(-(E_A - E)**2 / sigma**2)
    ax.plot(E, g_D, label='$g_D$')
    ax.plot(E, g_A, label='$g_A$')
    ax.legend()
    ax.set_xticks([E_V, E_C, E_A, E_D])
    ax.set_xticklabels(['$E_V$', '$E_C$', '$E_A$', '$E_D$'])
    draw_classic_axes(ax, xlabeloffset=.2)
    fig.savefig('doping.svg')


def main():
    os.chdir('docs/figures')
    plot_dos()
    plot_doping()

if __name__ == "__main__":
    main()