# Description -------------------------------------------------------------------------------------------------------------- # Simulation of the band structure at the np junction of a diode. This is a qualitatively reasonable representation # using a scaled tanh function. Ohmic (linear) potential drop across the n and p regions is included. # Use 0.6 > bias > -1.0 # # Name: bands.py # Author: W. Hetherington, Physics, Oregon State University # Created: 2012/02/14 # Modified: 2012 # Copyright: (c) 2012 # License: No restrictions #--------------------------------------------------------------------------------------------------------------------------- from scipy import * from numpy import * import matplotlib.pyplot as plt def BandFunctions(xn, xp, dz, band_gap, evd_zero, e_donor, e_acceptor, bias) : # xn and xp are the position arrays for the n and p regions. # dz is the zero bias depletion zone width. # band_gap in eV, vd_zero is the zero bias potential energy difference in eV across the junction. # bias is the foraward bias in eV. # e_donor is the donor state energy in eV below the n-type conduction band edge. # e_acceptor is the acceptor state energy in eV above the p-type valence band edge. x = concatenate((xn, xp)) #cb = (tanh(x/100.0) + 1.0)/2.0 * (evd_zero - bias/2.0) + e_donor + bias/2.0 evd = evd_zero - bias d = dz * (1.0 - bias/evd_zero) cb = tanh(x/d) * evd/2.0 + evd/2.0 + e_donor + bias/2.0 + x * -0.0001 * bias #vb = (tanh(x/100.0) - 1.0)/2.0 * (evd_zero - bias/2.0) - e_acceptor - bias/2.0 vb = tanh(x/d) * evd/2.0 - evd/2.0 - e_acceptor - bias/2.0 + x * -0.0001 * bias efn = zeros(len(xn)) + bias/2.0 + xn * -0.0001 * bias efp = zeros(len(xp)) - bias/2.0 + xp * -0.0001 * bias return cb, vb, x, efn, efp # efn, efp, x def Main() : pts = 1000 xn = linspace(-500., 0, pts/2) xp = linspace(0, 500., pts/2) x = concatenate((xn, xp)) acceptor_level = 0.05 donor_level = 0.05 evd_zero = 0.7 band_gap = 1.1 bias = -0.3 depletion_zone_zero_bias = 100.0 if bias > evd_zero : print('Bias is too large.') return cb, vb, x, efn, efp = BandFunctions(xn, xp, depletion_zone_zero_bias, band_gap, evd_zero, donor_level, acceptor_level, bias) plt.plot(x, cb) plt.plot(x, vb) spacer = 0 if bias < 0 : spacer = int((-bias) * 1.3 * len(xn)) print spacer if spacer != 0 : plt.plot(xn[:-spacer], efn[:-spacer], '-', color='orange') else : plt.plot(xn, efn, '-', color='red') plt.plot(xp[spacer:], efp[spacer:], '-', color='red') plt.grid(True) legends = ['conduction band', 'valence band', 'donor level', 'acceptor level'] plt.legend(legends, 'lower right') # , 'center right') plt.xlabel('Position (arbitrary unit)') plt.ylabel('Potential Energy in eV') plt.title('Diode Band Structure for Bias = ' + str(bias) + ' eV') plt.show() #------------------------------------------------------------------------------------------------------------------- if __name__ == '__main__' : Main()