def main(): # Define the system: hamiltonian_up = gasb.hamiltonian_97_up() hamiltonian_dn = gasb.hamiltonian_97_up_y_inv() lead_ham = gasb.hamiltonian_97_up(-100) centralShape = shapes.Rect() syst_up = gasb.system_builder(hamiltonian_up, lead_ham, centralShape) syst_dn = gasb.system_builder(hamiltonian_dn, lead_ham, centralShape) # Calculate the wave_function: energia = 442 parametros = gasb.params_97 parametros['eF'] = 60 # parametros = dict(GammaLead = parametros["GammaC"], V = 100, **parametros ) wf_up = kwant.wave_function(syst_up, energy=energia, params=parametros) wf_dn = kwant.wave_function(syst_dn, energy=energia, params=parametros) modes_up = wf_up(0) # from left lead modes_dn = wf_dn(0) # from left lead # Calculate the density: rho_up = kwant.operator.Density(syst_up) rho_dn = kwant.operator.Density(syst_dn) psi_up = sum(rho_up(p) for p in modes_up) psi_dn = sum(rho_dn(p) for p in modes_dn) # Calculate dos in a line dos_in_line_up, y_values_up = density_in_line(syst_up, modes_up) dos_in_line_dn, y_values_dn = density_in_line(syst_dn, modes_dn) # Plot the results: fig, ax = plt.subplots(2, 2, figsize=(14, 6)) y_values_up = y_values_up * (shapes.A0 / 10) # conversion to nm^{-1} y_values_dn = y_values_dn * (shapes.A0 / 10) # conversion to nm^{-1} min_line, max_line = -0.7 * shapes.L_STD, 0.7 * shapes.L_STD map_density(ax[0][0], syst_up, psi_up, colormap="Reds") ax[0][0].vlines(0, min_line, max_line, linestyle="--") ax[0][0].set_title("spin up") map_density(ax[1][0], syst_dn, psi_dn, colormap="Blues") ax[1][0].vlines(0, min_line, max_line, linestyle="--") ax[1][0].set_title("spin up inv.") ax[0][1].plot(y_values_up, normalize(dos_in_line_up), marker=".", markersize=2.5, linestyle="-", color="red") ax[1][1].plot(y_values_dn, normalize(dos_in_line_dn), marker=".", markersize=2.5, linestyle="-") plt.tight_layout() plt.show()
def calcula_Bandas(esp, eF, centralShape, V_shift=100, percent=0.25, Nkx=501, gammaLead=36.917): params_raw = eval("gasb.params_" + esp) params_dict = dict(GammaLead=gammaLead, V=V_shift, **params_raw) hamiltonian_syst = eval("gasb.hamiltonian_" + esp + "_k_plus()") hamiltonian_lead = gasb.free_ham(norbs=6) sistema = gasb.system_builder(hamiltonian_syst, hamiltonian_lead, centralShape) vec_k_limited_confined = np.linspace(-1, 1, Nkx) * np.pi * percent vec_k_limited_free = np.linspace(-1, 1, Nkx) * np.pi / shapes.A_STD * percent "Bands: " free_elec_energies = trans.continuous_bands_2D( kx_array=vec_k_limited_free, ky_value=0, hamiltonian=hamiltonian_syst, params=params_dict, eF_value=eF) confined_elec_energies = trans.band_values(ham_syst=hamiltonian_syst, momenta=vec_k_limited_confined, params=params_dict, eF_value=eF) return vec_k_limited_confined, free_elec_energies, confined_elec_energies
def main(): ## Dimensions of the system: Length = shapes.W_STD Width = shapes.W_STD shapeScattering = shapes.Rect(Width, Length) params_raw = gasb.params_97 gammaLead = 36.917 V_shift = 100 params_dict = dict(GammaLead=gammaLead, V=V_shift, **params_raw) hamiltonian_syst = gasb.hamiltonian_97_k_plus() hamiltonian_lead = gasb.free_ham(norbs=6) sistema = gasb.system_builder(hamiltonian_syst, hamiltonian_lead, shapeScattering) # sistema_dn = gasb.system_builder(hamiltonian_syst_dn, hamiltonian_lead, shapeScattering) Fermi_initial, Fermi_final, N_values = 435, 440, 2001 Fermi_values = np.linspace(Fermi_initial, Fermi_final, N_values) params_dict['eF'] = 62. ## " Names for the files: " L_nm = Length * shapes.A0 * 1 / 10 path_data = "./data/transport/" name_preffixe = "data_" + str(Fermi_initial) + "_" + str( Fermi_final) + "_meV_Fermi_" name_Fermi = name_preffixe + str(N_values) + "_L_" + str(L_nm) name_transport_up = name_preffixe + "Transport_UP_" + str( N_values) + "_L_" + str(L_nm) name_transport_dn = name_preffixe + "Transport_DN_" + str( N_values) + "_L_" + str(L_nm) name_transport_total = name_preffixe + "Transport_Total_" + str( N_values) + "_L_" + str(L_nm) np.save(path_data + name_Fermi + ".npy", Fermi_values) np.savetxt(path_data + name_Fermi + ".txt", Fermi_values) ## " Transport: " transport_up, transport_dn, transport_total = calc_transp_Fermi( sistema, Fermi_values, params_dict) # Save the results in "numpy" format and "txt" # np.save(path_data + name_transport_up + ".npy", transport_up) # np.savetxt(path_data + name_transport_up + ".txt", transport_up) # # np.save(path_data + name_transport_dn + ".npy", transport_dn) # np.savetxt(path_data + name_transport_dn + ".txt", transport_dn) np.save(path_data + name_transport_total + ".npy", transport_total) np.savetxt(path_data + name_transport_total + ".txt", transport_total)
def make_system(esp="97", gammaLead=36.917, V_shift=100, width = shapes.W_STD, length = shapes.L_STD): shapeScattering = shapes.Rect(width, length) # folder_fig = esp + folder_suf params_raw = eval("gasb.params_" + esp) params_dict = dict(GammaLead = gammaLead, V = V_shift, **params_raw) hamiltonian_syst = eval("gasb.hamiltonian_" + esp + "_k_plus()") hamiltonian_lead = gasb.free_ham(norbs = 6) sistema = gasb.system_builder(hamiltonian_syst, hamiltonian_lead, shapeScattering) return sistema
def main(): """ This code is for generate maps of current, without bands structures and with custom operators. This will allow a better exploratory process. """ # Define the system hamiltonian = gasb.hamiltonian_97_k_plus() lead_ham = gasb.free_ham(norbs = 6) centralShape = shapes.Rect(Wmax = 300, Lmax=500) syst = gasb.system_builder(hamiltonian, lead_ham, centralShape, a_lattice=20) fig, axis = plt.subplots(1,1,figsize=(10,5)) kwant.plot(syst, ax = axis, show = False) axis.axis('off') axis.set_aspect('equal') plt.show()
def main(): """ This code is for generate maps of current, without bands structures and with custom operators. This will allow a better exploratory process. """ # Define the system hamiltonian = gasb.hamiltonian_97_k_plus() lead_ham = gasb.free_ham(norbs = 6) centralShape = shapes.Rect() syst = gasb.system_builder(hamiltonian, lead_ham, centralShape) # Calculate the wave function: energia = 442 parametros = gasb.params_97 parametros['eF'] = 60 parametros['Eta2'] = 0 parametros['Eta3'] = 0 parametros = dict(GammaLead = parametros["GammaC"], V = 100, **parametros) wf = kwant.wave_function(syst, energy=energia, params=parametros) # modes = wf_dn(0) # from left lead # Define the operator σz = tinyarray.array([[1,0],[0,-1]]) Mz = np.kron(σz, np.eye(3)) # Current colormap = "Reds" J_spin = kwant.operator.Current(syst, Mz) current_spin = sum(J_spin(psi, params = parametros) for psi in wf(0)) # Plot and/or save the data fig, axis = plt.subplots(1,1, figsize=(8,8)) kwant.plotter.current(syst, current_spin, cmap = colormap, colorbar = False, show = False, ax = axis) edit_axis(axis) plt.show()
def calcula_correntes(esp, eF, energia, centralShape, V_shift=100, lead=0, gammaLead=36.917): # folder_fig = esp + folder_suf params_raw = eval("gasb.params_" + esp) params_dict = dict(GammaLead=gammaLead, V=V_shift, **params_raw) hamiltonian_syst = eval("gasb.hamiltonian_" + esp + "_k_plus()") hamiltonian_lead = gasb.free_ham(norbs=6) sistema = gasb.system_builder(hamiltonian_syst, hamiltonian_lead, centralShape) "Currents: " current_Total = trans.current_spin(sistema, params_dict, eF_value=eF, energy=energia, lead_index=lead, spin='total') current_Up = trans.current_spin(sistema, params_dict, eF_value=eF, energy=energia, lead_index=lead, spin='up') current_Dn = trans.current_spin(sistema, params_dict, eF_value=eF, energy=energia, lead_index=lead, spin='down') return current_Up, current_Dn, current_Total
def main(): shapeScattering = shapes.Rect(shapes.W_STD, shapes.L_STD) params_raw = gasb.params_97 gammaLead = 36.917 V_shift = 100 params_dict = dict(GammaLead=gammaLead, V=V_shift, **params_raw) hamiltonian_syst = gasb.hamiltonian_97_k_plus() hamiltonian_lead = gasb.free_ham(norbs=6) sistema = gasb.system_builder(hamiltonian_syst, hamiltonian_lead, shapeScattering) eF_initial, eF_final, N_values = 62, 64, 501 eF_values = np.linspace(eF_initial, eF_final, N_values) "Transport: " energy = 440 transport = np.empty(len(eF_values)) for i in range(len(eF_values)): params_dict['eF'] = eF_values[i] # compute the scattering matrix at a given energy smatrix = kwant.smatrix(sistema, energy, params=params_dict) # compute the transmission probability from lead 0 to lead 1 transport[i] = smatrix.transmission(1, 0) path_data = "./data/transport/" name_preffixe = "data_" + str(eF_initial) + "_" + str(eF_final) + "_" name_eF = name_preffixe + "eF_" + str(N_values) name_transport = name_preffixe + "Transport_" + str(N_values) np.save(path_data + name_eF + ".npy", eF_values) np.savetxt(path_data + name_eF + ".txt", eF_values) np.save(path_data + name_transport + ".npy", transport) np.savetxt(path_data + name_transport + ".txt", transport)
def plot_bands_with_currents(esp, eF, energia, centralShape, V_shift=100, percent=0.25, Nkx=501, lead=0, gammaLead=36.917): """ esp = "97", "103" ou "110" eF = campo elétrico aplicado na direção-z energia = nível de Fermi (para calcular correntes) """ folder_fig = esp + folder_suf params_raw = eval("gasb.params_" + esp) params_dict = dict(GammaLead=gammaLead, V=V_shift, **params_raw) hamiltonian_syst = eval("gasb.hamiltonian_" + esp + "_k_plus()") hamiltonian_lead = gasb.free_ham(norbs=6) sistema = gasb.system_builder(hamiltonian_syst, hamiltonian_lead, centralShape) vec_k_limited_confined = np.linspace(-1, 1, Nkx) * np.pi * percent vec_k_limited_free = np.linspace(-1, 1, Nkx) * np.pi / shapes.A_STD * percent fig1 = plt.figure(figsize=(10, 10)) ax1 = fig1.add_subplot(121) ax2 = fig1.add_subplot(322) ax3 = fig1.add_subplot(324) ax4 = fig1.add_subplot(326) "Bands: " free_elec_energies = trans.continuous_bands_2D( kx_array=vec_k_limited_free, ky_value=0, hamiltonian=hamiltonian_syst, params=params_dict, eF_value=eF) confined_elec_energies = trans.band_values(ham_syst=hamiltonian_syst, momenta=vec_k_limited_confined, params=params_dict, eF_value=eF) trans.bands_cont2D_and_discr(axis=ax1, free_elec_energies=free_elec_energies, confined_elec_energies=confined_elec_energies, momenta=vec_k_limited_confined, kx_max=0.20, E_min=405, E_max=460, E_line=energia) "Currents: " trans.current_spin(sistema, params_dict, eF_value=eF, energy=energia, lead_index=lead, spin='total', colormap="Oranges", axis=ax2) trans.current_spin(sistema, params_dict, eF_value=eF, energy=energia, lead_index=lead, spin='up', colormap="Reds", axis=ax3) trans.current_spin(sistema, params_dict, eF_value=eF, energy=energia, lead_index=lead, spin='down', colormap="Blues", axis=ax4) plt.tight_layout() "Saving the plot" name_fig, _ = names(esp, eF, energia, V_shift, lead) plt.savefig(path_fig + folder_fig + name_fig) # plt.show() return 0
def plot_bands_with_transport(esp, spin, eF, energia, centralShape, porcent=0.25, Nkx=501, lead=0): # """ # esp = "97", "103" ou "110" # tipo_Ham = "plus" ou "minus"; # Relacionado à entrada H_12 do Hamiltoniano # eF = campo elétrico aplicado na direção-z # energia = nível de Fermi (para calcular correntes) # """ # # path_fig = "/home/marcos/Desktop/projetos_trabalho/images/"; # folder = esp + "_Angstroms_GaSb_InAs/"; # name_fig = esp + "_bands_transport_eF_" \ # + str(eF) + "meV_mu_" \ # + str(energia) + "meV"\ # + "_k_" + tipo_Ham \ # + "_lead_" + str(lead) + ".png"; hamiltonian_symb = eval("gasb.hamiltonian_" + esp + "_" + spin + "()") params_dict = eval("gasb.params_" + esp) sistema = gasb.system_builder(hamiltonian_symb, centralShape) vec_k_limited_disc = np.linspace(-1, 1, Nkx) * np.pi * porcent; vec_k_limited_cont = np.linspace(-1, 1, Nkx) * np.pi/shapes.A_STD * porcent; fig1 = plt.figure(figsize=(10,10)) ax1 = fig1.add_subplot(121) ax2 = fig1.add_subplot(322) ax3 = fig1.add_subplot(324) ax4 = fig1.add_subplot(326) "Bands: " cont_energies = trans.continuous_bands_2D(kx_array = vec_k_limited_cont, ky_value = 0, hamiltonian = hamiltonian_symb, params = params_dict, eF_value = eF) disc_energies = trans.band_values(syst = sistema, momenta = vec_k_limited_disc, params = params_dict, eF_value = eF) trans.bands_cont2D_and_discr(axis = ax1, cont_energies = cont_energies, disc_energies = disc_energies, momenta = vec_k_limited_disc, kx_max = 0.20, E_min = 405, E_max = 460, E_line = energia) "Transport: " trans.current_spin(ax2, sistema, params_dict, eF_value = eF, energy = energia, lead_index=lead, spin='total', colormap="Oranges") trans.current_spin(ax3, sistema, params_dict, eF_value = eF, energy = energia, lead_index=lead, spin='up', colormap="Reds") trans.current_spin(ax4, sistema, params_dict, eF_value = eF, energy = energia, lead_index=lead, spin='down', colormap="Blues") plt.tight_layout() # plt.savefig(path_fig + folder + name_fig) plt.show() return 0
def main(): # Define the system: hamiltonian = gasb.hamiltonian_97_k_plus() # hamiltonian = gasb.hamiltonian_97_down() lead_ham = gasb.free_ham(6) centralShape = shapes.Rect() syst = gasb.system_builder(hamiltonian, lead_ham, centralShape) # Calculate the wave_function: energia = 448 parametros = gasb.params_97 parametros['Eta3'] = 0 parametros['Eta2'] = 0 parametros['eF'] = 60 parametros = dict(GammaLead = parametros["GammaC"], V = 100, **parametros ) wf = kwant.wave_function(syst, energy = energia, params = parametros) modes_left = wf(0) modes_right = wf(1) # modes_total = np.vstack((wf(0), wf(1))) # Calculate the density: sigma_z = tinyarray.array([[1,0],[0,-1]]) spin_proj= np.kron(sigma_z, np.eye(3)) identity = np.eye(6) rho = kwant.operator.Density(syst, spin_proj) psi_left = sum(rho(p) for p in modes_left) psi_right = sum(rho(p) for p in modes_right) # Calculate dos in a line dos_in_line_from_left = density_in_line(syst, psi) dos_in_line_from_both = density_in_line(syst, np.vstack((wf(0),wf(1)))) plt.plot(sum(dos_in_line_from_both)) plt.show() # print(dos_in_line.shape) # print(dos_in_line) plot_dos_in_line(dos_in_line_from_left) # plot_dos_in_line(dos_in_line_from_both) print(sum(dos_in_line_from_both).shape) # Plot the results: colorRight = "seismic" colorLeft = "seismic" fig, ax = plt.subplots(2,2,figsize=(14,6)) y_values_left = y_values_left * (shapes.A0 / 10) # conversion to nm^{-1} y_values_right = y_values_right * (shapes.A0 / 10) # conversion to nm^{-1} min_line, max_line = -0.7 * shapes.L_STD, 0.7 * shapes.L_STD map_density(ax[0][0], syst, psi_left, colormap = colorRight) ax[0][0].vlines(0, min_line, max_line, linestyle = "--") ax[0][0].set_title("left lead") map_density(ax[1][0], syst, psi_right, colormap = colorLeft) ax[1][0].vlines(0, min_line, max_line, linestyle = "--") ax[1][0].set_title("right lead") ax[0][1].plot(y_values_left, normalize(dos_in_line_from_left), marker = ".", markersize = 2.5, linestyle = "-" ) ax[1][1].plot(y_values_right, normalize(dos_in_line_from_right), marker = ".", markersize = 2.5, linestyle = "-" ) plt.tight_layout() plt.show()