def __get_dos_x(self): self.state.electron_states[1].mass.convert_to( self.state.electron_states[0].mass.units_default) if isinstance(self.state.electron_states[1].mass, spsc_data.APhysValueArray): mass = spsc_data.MassValue(self.state.electron_states[1].mass[ self.state.get_granularity() / 2]) else: mass = self.state.electron_states[1].mass return mass.value / (np.pi * spsc_constants.h_plank**2)
def superlattice_well(periods_num, well_length, lattice_well_length, lattice_barrier_length): well_length.convert_to("nm") lattice_well_length.convert_to("nm") lattice_barrier_length.convert_to("nm") state = spsc_core.StateSimple() electron_state = spsc_core.ElectronStateSimple() length = spsc_data.LengthValue(0, "nm") lattice_length = spsc_data.LengthValue(0, "nm") for i in range(periods_num): lattice_length += lattice_well_length + lattice_barrier_length length += lattice_barrier_length * 2 + well_length + lattice_length * 2 potential = spsc_data.Potential( np.ones((int(lattice_barrier_length.value * DOTS_PER_NM), ), "float64"), "eV") next_index = lattice_barrier_length.value * DOTS_PER_NM for i in range(periods_num): potential.append( spsc_data.Potential( np.zeros((int(lattice_well_length.value * DOTS_PER_NM), ), "float64"), "eV")) potential.append( spsc_data.Potential( np.ones((int(lattice_barrier_length.value * DOTS_PER_NM), ), "float64"), "eV")) next_index += lattice_well_length.value * DOTS_PER_NM + lattice_barrier_length.value * DOTS_PER_NM meta_info = { "well_start": int(next_index), "lattice_bar_width": int(lattice_barrier_length.value * DOTS_PER_NM), "lattice_well_width": int(lattice_well_length.value * DOTS_PER_NM) } potential.append( spsc_data.Potential( np.zeros((int(well_length.value * DOTS_PER_NM), ), "float64"), "eV")) next_index += well_length.value * DOTS_PER_NM meta_info["well_end"] = int(next_index) empty_dots = int(length.value * DOTS_PER_NM) + 1 - len(potential) potential.append( spsc_data.Potential(np.zeros((empty_dots, ), "float64"), "eV")) potential.mirror() potential.meta_info = meta_info electron_state.static_potential = potential electron_state.mass = spsc_data.MassValue(constants.m_e) electron_state.sum_density = spsc_data.DensityValue(0, "m^-2") state.electron_states = [electron_state] state.length = length state.static_density = spsc_data.Density( np.zeros((len(potential, )), "float64"), "m^-2") state.density_potential = spsc_data.Potential( np.zeros((len(potential, )), "float64")) return state
def single_well(well_length): state = spsc_core.StateSimple() granularity = well_length.value * 10 length = well_length * 3 length.convert_to("nm") potential = spsc_data.Potential(np.ones((granularity, ), "float64"), "eV") potential.append( spsc_data.Potential(np.zeros((granularity, ), "float64"), "eV")) potential.append( spsc_data.Potential(np.ones((granularity + 1, ), "float64"), "eV")) electron_state = spsc_core.ElectronStateSimple() electron_state.static_potential = potential electron_state.mass = spsc_data.MassValue(0.068 * constants.m_e) state.electron_states = [electron_state] state.length = length return state
def solve(self, E, solution_start): self._reset_to_default_units() E.convert_to(E.units_default) lattice_potential = spsc_data.Potential( self.potential[:self.well_start], self.potential.units) flat_lattice_potential = self._flatten_potential(lattice_potential) lattice_length = spsc_data.LengthValue( self.length.value * (len(flat_lattice_potential) - 1) / (len(self.potential) - 1), self.length.units) lattice_mass = spsc_data.MassArray( self.mass[:len(flat_lattice_potential)]) # Need this because the last point in the lattice potential is artificial, # and we need to keep the same mass as it was in the last point. lattice_mass.value[-1] = lattice_mass.value[-2] iteration = SolutionIterationFlatPotentialDiffMass( flat_lattice_potential, lattice_mass, lattice_length) lattice_solution = iteration.solve(E, solution_start) well_solution_start = (lattice_solution[0][-1], lattice_solution[1][-1]) well_potential = spsc_data.Potential( self.potential[self.well_start:self.well_end], self.potential.units) well_length = spsc_data.LengthValue( self.length.value * len(well_potential) / (len(self.potential) - 1), self.length.units) well_mass = spsc_data.MassValue(self.mass.value[self.well_start]) iteration = SolutionIterationRungeKutt(well_potential, well_mass, well_length) well_solution = iteration.solve(E, well_solution_start) N = len(self.potential) solution = (spsc_data.WaveFunction(np.zeros( (N, ))), spsc_data.WaveFunction(np.zeros((N, )))) solution[0][:len(lattice_solution[0])] = lattice_solution[0] solution[0][len(lattice_solution[0]) - 1:len(lattice_solution[0]) + len(well_solution[0]) - 1] = well_solution[0] solution[1][:len(lattice_solution[1])] = lattice_solution[1] solution[1][len(lattice_solution[1]) - 1:len(lattice_solution[1]) + len(well_solution[1]) - 1] = well_solution[1] return solution
import scipy.constants as constants import spsc_data h_plank = constants.hbar * (10**7) m_e = spsc_data.MassValue(constants.m_e, "kg") m_e.convert_to("g") m_e = m_e.value e = spsc_data.ChargeValue(constants.elementary_charge, "C") e.convert_to("esu") e = e.value
def __init__(self): self.wave_functions = [] self.energy_levels = [] self.static_potential = spsc_data.Potential([]) self.mass = spsc_data.MassValue(0) self.sum_density = spsc_data.DensityValue(0)