def test_tighter_confinement_leads_to_higher_energy_states(): """Tests that a smaller CSNC leads to higher-energy eigenstates. """ a = Material(2.0, 0.0, 1.0, 1.0, 1.0) b = Material(1.0, -0.5, 1.0, 1.0, 1.0) # Lower band edges. csnc1 = CoreShellParticle(b, a, 1.0, 1.0) # Type 1 CSNC. csnc2 = CoreShellParticle(b, a, 0.9, 1.0) # Type 1 CSNC. csnc1_energies = csnc1.calculate_s1_energies() csnc2_energies = csnc2.calculate_s1_energies() assert np.all(csnc2_energies > csnc1_energies)
def main(): inp_effective_electron_mass = 0.073 InP = Material(1.34, 0, inp_effective_electron_mass, 0.64, 9.6, "InP") CdS = Material(2.20, -0.39, 0.21, 0.68, 5.3, "CdS") shell_widths = np.array([0.53, 1.05, 1.47, 1.90, 2.76, 3.84]) experimental_bandgaps = [1.78, 1.46, 1.37, 1.32, 1.26, 1.24] print("Using InP electron effective mass: {:0.2f}".format( inp_effective_electron_mass)) print( "Core \t Shell \tExp \t BG \t E(e): E(h): Coulomb: Polarization: Model(Exp-Model):" ) for i, shell_width in enumerate(shell_widths): csnc = CoreShellParticle(InP, CdS, 1.23, shell_width, 1.5) print(1.23, "\t", shell_width, end="\t") # print("Is CSNC type two? h/e?", csnc.type_two, csnc.h_e) energies = np.array(csnc.calculate_s1_energies()) # print(energies) plots = False col_energy_sectioned = csnc.coulomb_screening_energy( plot_integrand=plots) pol_energy_sectioned = csnc.polarization_screening_energy( plot_integrand=plots) self_energy = csnc.self_interaction_energy() # print(xx_coulomb_sectioned) # whole_integral_energy = ( # csnc.bandgap + np.sum(energies) + col_energy_whole[0] + pol_energy_whole[0] # ) sectioned_integral_energy = ( csnc.bandgap + np.sum(energies) + col_energy_sectioned[0] + pol_energy_sectioned[0] # + self_energy ) # + xx_coulomb_sectioned[0] # print("Col:", col_energy_whole, col_energy_sectioned, "Pol:", pol_energy) # print("NC bandgap:", csnc.bandgap) print(experimental_bandgaps[i], end="\t") # print( # "{:0.2f}({:0.2f})".format( # whole_integral_energy, # abs(experimental_bandgaps[i] - whole_integral_energy), # ), # end="\t", # ) print( "{:0.3f}\t{:0.3f}\t{:0.3f}\t{:0.3f}\t{:0.3f}\t{:0.3f}\t{:0.3f}". format( csnc.bandgap, energies[0], energies[1], col_energy_sectioned[0], pol_energy_sectioned[0], sectioned_integral_energy, experimental_bandgaps[i] - sectioned_integral_energy, ), end="\t", ) print()
def test_energies_are_order_unity(): """Tests that energies are approximately around 1. """ a = Material(1.0, 0.0, 1.0, 1.0, 1.0) b = Material(1.0, -0.5, 1.0, 1.0, 1.0) # Lower band edges. csnc1 = CoreShellParticle(a, b, 1.0, 1.0) # Type 2 CSNC. h/e structure. energies = csnc1.calculate_s1_energies() assert np.all(np.logical_and(1e-1 < energies, energies < 10))
def test_adaptive_energy_bracketing_for_high_energies(): """Tests that high energies are bracketed for extremely small CSNCs. """ a = Material(1.0, 0.0, 1.0, 1.0, 1.0) b = Material(1.0, -0.5, 1.0, 1.0, 1.0) # Lower band edges. csnc1 = CoreShellParticle(a, b, 0.1, 0.1) # Type 2 CSNC. h/e structure. energies = csnc1.calculate_s1_energies() # print(energies) assert np.isclose(energies[0], energies[1])
import numpy as np from pyncband import Material, CoreShellParticle InP = Material(1.34, 0, 1.0, 0.64, 9.6, "InP") CdS = Material(2.20, -0.39, 0.21, 0.68, 5.3, "CdS") def inp_electron_mass_from_energy(e): alpha = -1.2 e_p = 20.6 e_g = 1.34 return 1 / (alpha + e_p / (e_g + e)) for energy in np.linspace(0.1, 1, 5): print(inp_electron_mass_from_energy(energy)) inp_eff_electron_mass = 1.0 mass_eps = 1.0 print("Iteratively figuring out InP electron effective mass:") while mass_eps > 1e-5: InP = Material(1.34, 0, inp_eff_electron_mass, 0.64, 9.6, "InP") csnc = CoreShellParticle(InP, CdS, 1.23, 1.90, 1.5) energy_e, energy_h = csnc.calculate_s1_energies() inp_eff_electron_mass_new = inp_electron_mass_from_energy(energy_e) mass_eps = abs(inp_eff_electron_mass_new - inp_eff_electron_mass) print(mass_eps, inp_eff_electron_mass, inp_eff_electron_mass_new) inp_eff_electron_mass = inp_eff_electron_mass_new