def solve(self): symmetry_solver = LatticeSymmetrySolver(self.state) symmetry_solver.solve() # for j in xrange(5): # self.__gamma_shrod() # self.__x_shrod() # self.state.density_potential = self.__solve_puass() E_start = spsc_data.EnergyValue(0.001, "eV") E_end = spsc_data.EnergyValue(0.3, "eV") dE = spsc_data.EnergyValue(0.0001, "eV") meta_info = self.state.electron_states[1].static_potential.meta_info self.state.electron_states[1].static_potential.convert_to('eV') self.state.density_potential.convert_to('eV') static_potential_arr = self.state.electron_states[ 1].static_potential.value[ meta_info['x_solution_start']:meta_info['x_solution_end']] density_potential_arr = self.state.density_potential.value[ meta_info['x_solution_start']:meta_info['x_solution_end']] potential_arr = static_potential_arr + density_potential_arr potential = spsc_data.Potential(potential_arr, "eV") potential_offset = spsc_data.EnergyValue(np.amin(potential_arr), 'eV') potential = potential - spsc_data.Potential( potential_offset.value * np.ones( (len(potential), ), "float64"), potential_offset.units) potential.meta_info = meta_info mass = self.state.electron_states[1].mass length = self.state.length iteration_factory = spsc_shrod.SolutionIterationRungeKuttFactory() solution_strategy = spsc_shrod.IterableSolutionStrategyNonSymmetricWell( E_start, E_end, dE, 1, iteration_factory) solutions = solution_strategy.solve(potential, mass, length, (10.0**-20, 0, 10.0**-25, 0)) wave_function = solutions[0][1] zeros = np.zeros((len(self.state.density_potential), )) wave_function_full_arr = np.concatenate( (zeros[:meta_info['x_solution_start']], wave_function.value, zeros[meta_info['x_solution_end']:])) wave_function = spsc_data.WaveFunction(wave_function_full_arr) wave_function.mirror() wave_function.normalize() self.state.electron_states[1].wave_functions.append(wave_function) energy_level = solutions[0][0] energy_level = energy_level + potential_offset self.state.electron_states[1].energy_levels.append(energy_level)
def solve(self): E_start = spsc_data.EnergyValue(0.0001, "eV") E_end = spsc_data.EnergyValue(0.2, "eV") dE = spsc_data.EnergyValue(0.0001, "eV") static_potential = self.state.electron_states[0].static_potential meta_info = static_potential.meta_info iteration_factory = spsc_shrod.SolutionIterationSlopedLatticeFactory() solution_strategy = spsc_shrod.IterableSolutionStrategyNonSymmetricWell( E_start, E_end, dE, 1, iteration_factory) density_potential = self.state.density_potential mass = self.state.electron_states[0].mass length = self.state.length electron_state = self.state.electron_states[0] for j in xrange(10): potential = static_potential + density_potential potential_offset = spsc_data.EnergyValue( potential[meta_info["well_start"]], potential.units) potential = potential - spsc_data.Potential( potential_offset.value * np.ones( (len(potential), ), "float64"), potential_offset.units) potential.meta_info = meta_info solutions = solution_strategy.solve(potential, mass, length, (10.0**-20, 0, 10.0**-25, 0)) for i in xrange(len(solutions)): solution = solutions[i] if len(electron_state.wave_functions) > i: electron_state.wave_functions[i] = solution[1] else: electron_state.wave_functions.append(solution[1]) energy_level = solution[0] + potential_offset if len(electron_state.energy_levels) > i: electron_state.energy_levels[i] = energy_level else: electron_state.energy_levels.append(energy_level) h = 1.0 / (len(self.state.electron_states[0].wave_functions[0]) - 1) electron_density = spsc_data.Density( electron_state.sum_density.value * h * (electron_state.wave_functions[0].value**2), electron_state.sum_density.units) self.state.static_density.convert_to("m^-2") density = self.state.static_density - electron_density puass_solution_strategy = spsc_puass.GaussSolutionStrategy() prev_density_potential = density_potential density_potential = puass_solution_strategy.solve( density, 12, self.state.length) density_potential.convert_to(prev_density_potential.units) density_potential.value = (density_potential.value + prev_density_potential.value) / 2 self.state.density_potential = density_potential
def solve(self): # 30 nm well E_start = spsc_data.EnergyValue(0.001, "eV") E_end = spsc_data.EnergyValue(0.4, "eV") # 13 nm well # E_start = spsc_data.EnergyValue(0.01, "eV") # E_end = spsc_data.EnergyValue(0.08, "eV") dE = spsc_data.EnergyValue(0.0001, "eV") static_potential = self.state.electron_states[0].static_potential meta_info = static_potential.meta_info mass = self.state.electron_states[0].mass if isinstance(mass, spsc_data.APhysValueArray): iteration_factory = spsc_shrod.SolutionIterationSymmetryLatticeDiffMassFactory( ) else: iteration_factory = spsc_shrod.SolutionIterationSymmetryLatticeFactory( ) solution_strategy = spsc_shrod.IterableSolutionStrategySymmetricWell( E_start, E_end, dE, 1, iteration_factory) density_potential = self.state.density_potential length = self.state.length electron_state = self.state.electron_states[0] for j in xrange(5): potential = static_potential + density_potential potential_offset = spsc_data.EnergyValue( potential[meta_info["well_start"]], potential.units) potential = potential - spsc_data.Potential( potential_offset.value * np.ones( (len(potential), ), "float64"), potential_offset.units) potential.meta_info = meta_info solutions = solution_strategy.solve(potential, mass, length, (10.0**-20, 0)) for i in xrange(len(solutions)): solution = solutions[i] if len(electron_state.wave_functions) > i: electron_state.wave_functions[i] = solution[1] else: electron_state.wave_functions.append(solution[1]) energy_level = solution[0] + potential_offset if len(electron_state.energy_levels) > i: electron_state.energy_levels[i] = energy_level else: electron_state.energy_levels.append(energy_level) density_potential = self.__solve_puass() # density_potential = self.__solve_puass() + density_potential # density_potential.value = density_potential.value / 2 self.state.density_potential = density_potential
def solve(self): E_start = spsc_data.EnergyValue(0.001, "eV") E_end = spsc_data.EnergyValue(0.4, "eV") dE = spsc_data.EnergyValue(0.0001, "eV") iteration_factory = spsc_shrod.SolutionIterationFlatPotentialFactory() solution_strategy = spsc_shrod.IterableSolutionStrategySymmetricWell( E_start, E_end, dE, 6, iteration_factory) potential = self.state.electron_states[0].static_potential mass = self.state.electron_states[0].mass length = self.state.length solutions = solution_strategy.solve(potential, mass, length, (10.0**-20, 0)) for i in xrange(len(solutions)): solution = solutions[i] self.state.electron_states[0].wave_functions.append(solution[1]) self.state.electron_states[0].energy_levels.append(solution[0])
def __get_E_Fermi(self): electron_state = self.state.electron_states[0] dos = self.__get_dos() # @TODO currently it's working for two and one subband systems only energy_levels_number = len(electron_state.energy_levels) if energy_levels_number > 2: raise StandardError( "Cannot find E Fermi for more than 2 energy levels filled") for i in xrange(energy_levels_number): electron_state.energy_levels[i].convert_to( electron_state.energy_levels[i].units_default) electron_state.sum_density.convert_to( electron_state.sum_density.units_default) n = electron_state.sum_density.value if energy_levels_number == 1: E_Fermi_value = n / dos + electron_state.energy_levels[0].value else: E1 = electron_state.energy_levels[0].value E2 = electron_state.energy_levels[1].value E_Fermi_value = 0.5 * (n / dos + E1 + E2) if E_Fermi_value < E2: E_Fermi_value = n / dos + electron_state.energy_levels[0].value E_Fermi = spsc_data.EnergyValue(E_Fermi_value) # E_Fermi.convert_to("eV") return E_Fermi
def superlattice_well_sloped(periods_num, well_length, lattice_well_length, lattice_barrier_length, slope): state = superlattice_well(periods_num, well_length, lattice_well_length, lattice_barrier_length) slope.convert_to(slope.units_default) state.length.convert_to(state.length.units_default) energy_diff = slope.value * state.length.value * constants.e energy_diff = spsc_data.EnergyValue(energy_diff) energy_diff.convert_to("eV") state.electron_states[0].static_potential.convert_to("eV") potential_arr = state.electron_states[0].static_potential.value slope_arr = np.zeros((len(potential_arr), )) dE = energy_diff.value / (len(slope_arr) - 1) for i in range(len(slope_arr)): slope_arr[i] = dE * i potential_arr = potential_arr + slope_arr well_min_index = potential_arr.argmin() well_min_value = potential_arr[well_min_index] potential_arr = potential_arr - np.full( (len(potential_arr), ), well_min_value) meta_info = state.electron_states[0].static_potential.meta_info state.electron_states[0].static_potential = spsc_data.Potential( potential_arr, "eV") state.electron_states[0].static_potential.meta_info = meta_info return state
def _get_U(self, index): self._reset_to_default_units() potential_value = self.potential[index] x = self.length.value * index / (len(self.potential) - 1) U = spsc_data.EnergyValue(potential_value - self.slope.value * x * constants.e) return U
def __get_E_Fermi(self): electron_state_gamma = self.state.electron_states[0] electron_state_x = self.state.electron_states[1] dos_gamma = self.__get_dos_gamma() dos_x = self.__get_dos_x() # @TODO currently it's working for two and one subband systems only energy_levels_number = len(electron_state_gamma.energy_levels) if energy_levels_number > 2: raise StandardError( "Cannot find E Fermi for more than 2 energy levels filled") for i in xrange(energy_levels_number): electron_state_gamma.energy_levels[i].convert_to( electron_state_gamma.energy_levels[i].units_default) electron_state_x.energy_levels[0].convert_to( electron_state_x.energy_levels[0].units_default) electron_state_gamma.sum_density.convert_to( electron_state_gamma.sum_density.units_default) n = electron_state_gamma.sum_density.value Ex = electron_state_x.energy_levels[0].value E1 = electron_state_gamma.energy_levels[0].value if energy_levels_number == 1: E_Fermi_value = (n + dos_gamma * E1 + dos_x * Ex) / (dos_gamma + dos_x) E_max = max(Ex, E1) if E_Fermi_value < E_max: if E_max == Ex: dos = dos_gamma else: dos = dos_x E_Fermi_value = n / dos + min(Ex, E1) else: E2 = electron_state_gamma.energy_levels[1].value E_Fermi_value = (n + dos_gamma * (E1 + E2) + dos_x * Ex) / (2 * dos_gamma + dos_x) E_max = max(Ex, E1, E2) if E_Fermi_value < E_max: if E_max == Ex: E_Fermi_value = (n + dos_gamma * (E1 + E2)) / (2 * dos_gamma) if E_Fermi_value < E2: E_Fermi_value = n / dos_gamma + E1 else: E_Fermi_value = (n + dos_gamma * E1 + dos_x * Ex) / (dos_gamma + dos_x) E_max = max(Ex, E1) if E_Fermi_value < E_max: if E_max == Ex: dos = dos_gamma else: dos = dos_x E_Fermi_value = n / dos + min(Ex, E1) E_Fermi = spsc_data.EnergyValue(E_Fermi_value) return E_Fermi
def __init__(self, potential, mass, length): super(SolutionIterationSlopePotential, self).__init__(potential, mass, length) self.slope = spsc_data.ElectricFieldValue(0) self.x0 = spsc_data.LengthValue(0) self.eps0 = spsc_data.EnergyValue(0) self._reset_to_default_units() # Calculate slope energy_difference = self.potential[SolutionIterationSlopePotential.SLOPE_RESOLUTION_DOTS_NUM - 1] - \ self.potential[0] energy_difference = spsc_data.EnergyValue(energy_difference) voltage_difference = energy_difference.value / constants.e length_piece = self.length.value * ( SolutionIterationSlopePotential.SLOPE_RESOLUTION_DOTS_NUM - 1) / (len(self.potential) - 1) self.slope.value = voltage_difference / length_piece self.x0.value = np.power( constants.h_plank**2 / (2 * self.mass.value * constants.e * self.slope.value), float(1) / 3) self.eps0.value = constants.e * self.slope.value * self.x0.value
def single_well_sloped(well_length, slope): state = single_well(well_length) length = well_length * 3 slope.convert_to(slope.units_default) length.convert_to(length.units_default) energy_diff = slope.value * length.value * constants.e energy_diff = spsc_data.EnergyValue(energy_diff) energy_diff.convert_to("eV") state.electron_states[0].static_potential.convert_to("eV") potential_arr = state.electron_states[0].static_potential.value slope_arr = np.zeros((len(potential_arr), )) dE = energy_diff.value / (len(slope_arr) - 1) for i in range(len(slope_arr)): slope_arr[i] = dE * i potential_arr = potential_arr + slope_arr well_min_index = potential_arr.argmin() well_min_value = potential_arr[well_min_index] potential_arr = potential_arr - np.full( (len(potential_arr), ), well_min_value) state.electron_states[0].static_potential = spsc_data.Potential( potential_arr, "eV") return state
plt.plot(wf_x) electron_state_1.static_potential.convert_to('eV') plt.plot(E1.value * np.ones((len(potential_1), ), "float64")) plt.plot(E2.value * np.ones((len(potential_1), ), "float64")) plt.plot(Ex.value * np.ones((len(potential_1), ), "float64")) plt.show() n = spsc_data.DensityValue(6.81 * 10**15, 'm^-2') n.convert_to(n.units_default) electron_state_1.mass.convert_to(electron_state_1.mass.units_default) g = 0.068 * spsc_constants.m_e / (np.pi * spsc_constants.h_plank**2) E1.convert_to(E1.units_default) E2.convert_to(E2.units_default) Ef = spsc_data.EnergyValue(0.5 * (n.value / g + E1.value + E2.value)) Ef1 = Ef - E1 Ef2 = Ef - E2 Ef.convert_to('eV') E1.convert_to('eV') E2.convert_to('eV') Ef1.convert_to('eV') Ef2.convert_to('eV') print "E1: ", E1 print "E2: ", E2 print "dE: ", (E2 - E1) print "Ef1: ", Ef1 print "Ef2: ", Ef2 print "Ex: ", Ex # import start_scripts.RC1075