From 0b8cf206f79d3d8413bac6ebdbb0f50c7ef255f1 Mon Sep 17 00:00:00 2001 From: guanjihuan Date: Wed, 19 Jan 2022 19:47:41 +0800 Subject: [PATCH] version 0.0.49 --- API_Reference/API_Reference.py | 12 +-- PyPI/setup.cfg | 2 +- PyPI/src/guan/Fourier_transform.py | 60 ++++++++++++- ..._Green_functions.py => Green_functions.py} | 2 +- PyPI/src/guan/__init__.py | 11 ++- ... => band_structures_and_wave_functions.py} | 6 +- PyPI/src/guan/basic_functions.py | 57 +------------ PyPI/src/guan/calculate_conductance.py | 84 ------------------- ...sity_of_states.py => density_of_states.py} | 2 +- ...ttering_matrix.py => quantum_transport.py} | 84 ++++++++++++++++++- ..._invariant.py => topological_invariant.py} | 2 +- 11 files changed, 161 insertions(+), 161 deletions(-) rename PyPI/src/guan/{calculate_Green_functions.py => Green_functions.py} (99%) rename PyPI/src/guan/{calculate_band_structures_and_wave_functions.py => band_structures_and_wave_functions.py} (97%) delete mode 100644 PyPI/src/guan/calculate_conductance.py rename PyPI/src/guan/{calculate_density_of_states.py => density_of_states.py} (99%) rename PyPI/src/guan/{calculate_scattering_matrix.py => quantum_transport.py} (69%) rename PyPI/src/guan/{calculate_topological_invariant.py => topological_invariant.py} (99%) diff --git a/API_Reference/API_Reference.py b/API_Reference/API_Reference.py index d25c0e9..df64c89 100644 --- a/API_Reference/API_Reference.py +++ b/API_Reference/API_Reference.py @@ -22,6 +22,11 @@ sigma_z0 = guan.sigma_z0() sigma_zx = guan.sigma_zx() sigma_zy = guan.sigma_zy() sigma_zz = guan.sigma_zz() + +# Fourier transform +hamiltonian = guan.one_dimensional_fourier_transform(k, unit_cell, hopping) +hamiltonian = guan.two_dimensional_fourier_transform_for_square_lattice(k1, k2, unit_cell, hopping_1, hopping_2) +hamiltonian = guan.three_dimensional_fourier_transform_for_cubic_lattice(k1, k2, k3, unit_cell, hopping_1, hopping_2, hopping_3) b1 = guan.calculate_one_dimensional_reciprocal_lattice_vector(a1) b1, b2 = guan.calculate_two_dimensional_reciprocal_lattice_vectors(a1, a2) b1, b2, b3 = guan.calculate_three_dimensional_reciprocal_lattice_vectors(a1, a2, a3) @@ -29,11 +34,6 @@ b1 = guan.calculate_one_dimensional_reciprocal_lattice_vector_with_sympy(a1) b1, b2 = guan.calculate_two_dimensional_reciprocal_lattice_vectors_with_sympy(a1, a2) b1, b2, b3 = guan.calculate_three_dimensional_reciprocal_lattice_vectors_with_sympy(a1, a2, a3) -# Fourier transform -hamiltonian = guan.one_dimensional_fourier_transform(k, unit_cell, hopping) -hamiltonian = guan.two_dimensional_fourier_transform_for_square_lattice(k1, k2, unit_cell, hopping_1, hopping_2) -hamiltonian = guan.three_dimensional_fourier_transform_for_cubic_lattice(k1, k2, k3, unit_cell, hopping_1, hopping_2, hopping_3) - # Hamiltonian of finite size systems hamiltonian = guan.finite_size_along_one_direction(N, on_site=0, hopping=1, period=0) hamiltonian = guan.finite_size_along_two_directions_for_square_lattice(N1, N2, on_site=0, hopping_1=1, hopping_2=1, period_1=0, period_2=0) @@ -52,7 +52,7 @@ hamiltonian = guan.hamiltonian_of_graphene_with_zigzag_in_quasi_one_dimension(k, hamiltonian = guan.hamiltonian_of_haldane_model(k1, k2, M=2/3, t1=1, t2=1/3, phi=pi/4, a=1/sqrt(3)) hamiltonian = guan.hamiltonian_of_haldane_model_in_quasi_one_dimension(k, N=10, M=2/3, t1=1, t2=1/3, phi=pi/4) -# calculate band structures +# band structures and wave functions eigenvalue = guan.calculate_eigenvalue(hamiltonian) eigenvalue_array = guan.calculate_eigenvalue_with_one_parameter(x_array, hamiltonian_function, print_show=0) eigenvalue_array = guan.calculate_eigenvalue_with_two_parameters(x_array, y_array, hamiltonian_function, print_show=0, print_show_more=0) diff --git a/PyPI/setup.cfg b/PyPI/setup.cfg index 760e218..f5c7aa7 100644 --- a/PyPI/setup.cfg +++ b/PyPI/setup.cfg @@ -1,7 +1,7 @@ [metadata] # replace with your username: name = guan -version = 0.0.47 +version = 0.0.49 author = guanjihuan author_email = guanjihuan@163.com description = An open source python package diff --git a/PyPI/src/guan/Fourier_transform.py b/PyPI/src/guan/Fourier_transform.py index 3095dbb..cd52519 100644 --- a/PyPI/src/guan/Fourier_transform.py +++ b/PyPI/src/guan/Fourier_transform.py @@ -5,6 +5,8 @@ import numpy as np import cmath +# Fourier_transform for discrete lattices + def one_dimensional_fourier_transform(k, unit_cell, hopping): unit_cell = np.array(unit_cell) hopping = np.array(hopping) @@ -24,4 +26,60 @@ def three_dimensional_fourier_transform_for_cubic_lattice(k1, k2, k3, unit_cell, hopping_2 = np.array(hopping_2) hopping_3 = np.array(hopping_3) hamiltonian = unit_cell+hopping_1*cmath.exp(1j*k1)+hopping_1.transpose().conj()*cmath.exp(-1j*k1)+hopping_2*cmath.exp(1j*k2)+hopping_2.transpose().conj()*cmath.exp(-1j*k2)+hopping_3*cmath.exp(1j*k3)+hopping_3.transpose().conj()*cmath.exp(-1j*k3) - return hamiltonian \ No newline at end of file + return hamiltonian + + +## calculate reciprocal lattice vectors + +def calculate_one_dimensional_reciprocal_lattice_vector(a1): + b1 = 2*np.pi/a1 + return b1 + +def calculate_two_dimensional_reciprocal_lattice_vectors(a1, a2): + a1 = np.array(a1) + a2 = np.array(a2) + a1 = np.append(a1, 0) + a2 = np.append(a2, 0) + a3 = np.array([0, 0, 1]) + b1 = 2*np.pi*np.cross(a2, a3)/np.dot(a1, np.cross(a2, a3)) + b2 = 2*np.pi*np.cross(a3, a1)/np.dot(a1, np.cross(a2, a3)) + b1 = np.delete(b1, 2) + b2 = np.delete(b2, 2) + return b1, b2 + +def calculate_three_dimensional_reciprocal_lattice_vectors(a1, a2, a3): + a1 = np.array(a1) + a2 = np.array(a2) + a3 = np.array(a3) + b1 = 2*np.pi*np.cross(a2, a3)/np.dot(a1, np.cross(a2, a3)) + b2 = 2*np.pi*np.cross(a3, a1)/np.dot(a1, np.cross(a2, a3)) + b3 = 2*np.pi*np.cross(a1, a2)/np.dot(a1, np.cross(a2, a3)) + return b1, b2, b3 + +def calculate_one_dimensional_reciprocal_lattice_vector_with_sympy(a1): + import sympy + b1 = 2*sympy.pi/a1 + return b1 + +def calculate_two_dimensional_reciprocal_lattice_vectors_with_sympy(a1, a2): + import sympy + a1 = sympy.Matrix(1, 3, [a1[0], a1[1], 0]) + a2 = sympy.Matrix(1, 3, [a2[0], a2[1], 0]) + a3 = sympy.Matrix(1, 3, [0, 0, 1]) + cross_a2_a3 = a2.cross(a3) + cross_a3_a1 = a3.cross(a1) + b1 = 2*sympy.pi*cross_a2_a3/a1.dot(cross_a2_a3) + b2 = 2*sympy.pi*cross_a3_a1/a1.dot(cross_a2_a3) + b1 = sympy.Matrix(1, 2, [b1[0], b1[1]]) + b2 = sympy.Matrix(1, 2, [b2[0], b2[1]]) + return b1, b2 + +def calculate_three_dimensional_reciprocal_lattice_vectors_with_sympy(a1, a2, a3): + import sympy + cross_a2_a3 = a2.cross(a3) + cross_a3_a1 = a3.cross(a1) + cross_a1_a2 = a1.cross(a2) + b1 = 2*sympy.pi*cross_a2_a3/a1.dot(cross_a2_a3) + b2 = 2*sympy.pi*cross_a3_a1/a1.dot(cross_a2_a3) + b3 = 2*sympy.pi*cross_a1_a2/a1.dot(cross_a2_a3) + return b1, b2, b3 \ No newline at end of file diff --git a/PyPI/src/guan/calculate_Green_functions.py b/PyPI/src/guan/Green_functions.py similarity index 99% rename from PyPI/src/guan/calculate_Green_functions.py rename to PyPI/src/guan/Green_functions.py index 3762d64..17dbbf8 100644 --- a/PyPI/src/guan/calculate_Green_functions.py +++ b/PyPI/src/guan/Green_functions.py @@ -1,6 +1,6 @@ # Guan is an open-source python package developed and maintained by https://www.guanjihuan.com/about. The primary location of this package is on website https://py.guanjihuan.com. -# calculate Green functions +# Green functions import numpy as np import guan diff --git a/PyPI/src/guan/__init__.py b/PyPI/src/guan/__init__.py index 4b7af47..0321edd 100644 --- a/PyPI/src/guan/__init__.py +++ b/PyPI/src/guan/__init__.py @@ -6,12 +6,11 @@ from .basic_functions import * from .Fourier_transform import * from .Hamiltonian_of_finite_size_systems import * from .Hamiltonian_of_models_in_the_reciprocal_space import * -from .calculate_band_structures_and_wave_functions import * -from .calculate_Green_functions import * -from .calculate_density_of_states import * -from .calculate_conductance import * -from .calculate_scattering_matrix import * -from .calculate_topological_invariant import * +from .band_structures_and_wave_functions import * +from .Green_functions import * +from .density_of_states import * +from .quantum_transport import * +from .topological_invariant import * from .read_and_write import * from .plot_figures import * from .others import * \ No newline at end of file diff --git a/PyPI/src/guan/calculate_band_structures_and_wave_functions.py b/PyPI/src/guan/band_structures_and_wave_functions.py similarity index 97% rename from PyPI/src/guan/calculate_band_structures_and_wave_functions.py rename to PyPI/src/guan/band_structures_and_wave_functions.py index 1e9dc83..480bec6 100644 --- a/PyPI/src/guan/calculate_band_structures_and_wave_functions.py +++ b/PyPI/src/guan/band_structures_and_wave_functions.py @@ -1,8 +1,8 @@ # Guan is an open-source python package developed and maintained by https://www.guanjihuan.com/about. The primary location of this package is on website https://py.guanjihuan.com. -# calculate_band_structures_and_wave_functions +# band_structures_and_wave_functions -## calculate band structures +## band structures import numpy as np import cmath @@ -66,7 +66,7 @@ def calculate_eigenvalue_with_two_parameters(x_array, y_array, hamiltonian_funct i0 += 1 return eigenvalue_array -## calculate wave functions +## wave functions def calculate_eigenvector(hamiltonian): eigenvalue, eigenvector = np.linalg.eigh(hamiltonian) diff --git a/PyPI/src/guan/basic_functions.py b/PyPI/src/guan/basic_functions.py index 80542a5..84bb571 100644 --- a/PyPI/src/guan/basic_functions.py +++ b/PyPI/src/guan/basic_functions.py @@ -71,59 +71,4 @@ def sigma_zy(): return np.kron(sigma_z(), sigma_y()) def sigma_zz(): - return np.kron(sigma_z(), sigma_z()) - -## calculate reciprocal lattice vectors - -def calculate_one_dimensional_reciprocal_lattice_vector(a1): - b1 = 2*np.pi/a1 - return b1 - -def calculate_two_dimensional_reciprocal_lattice_vectors(a1, a2): - a1 = np.array(a1) - a2 = np.array(a2) - a1 = np.append(a1, 0) - a2 = np.append(a2, 0) - a3 = np.array([0, 0, 1]) - b1 = 2*np.pi*np.cross(a2, a3)/np.dot(a1, np.cross(a2, a3)) - b2 = 2*np.pi*np.cross(a3, a1)/np.dot(a1, np.cross(a2, a3)) - b1 = np.delete(b1, 2) - b2 = np.delete(b2, 2) - return b1, b2 - -def calculate_three_dimensional_reciprocal_lattice_vectors(a1, a2, a3): - a1 = np.array(a1) - a2 = np.array(a2) - a3 = np.array(a3) - b1 = 2*np.pi*np.cross(a2, a3)/np.dot(a1, np.cross(a2, a3)) - b2 = 2*np.pi*np.cross(a3, a1)/np.dot(a1, np.cross(a2, a3)) - b3 = 2*np.pi*np.cross(a1, a2)/np.dot(a1, np.cross(a2, a3)) - return b1, b2, b3 - -def calculate_one_dimensional_reciprocal_lattice_vector_with_sympy(a1): - import sympy - b1 = 2*sympy.pi/a1 - return b1 - -def calculate_two_dimensional_reciprocal_lattice_vectors_with_sympy(a1, a2): - import sympy - a1 = sympy.Matrix(1, 3, [a1[0], a1[1], 0]) - a2 = sympy.Matrix(1, 3, [a2[0], a2[1], 0]) - a3 = sympy.Matrix(1, 3, [0, 0, 1]) - cross_a2_a3 = a2.cross(a3) - cross_a3_a1 = a3.cross(a1) - b1 = 2*sympy.pi*cross_a2_a3/a1.dot(cross_a2_a3) - b2 = 2*sympy.pi*cross_a3_a1/a1.dot(cross_a2_a3) - b1 = sympy.Matrix(1, 2, [b1[0], b1[1]]) - b2 = sympy.Matrix(1, 2, [b2[0], b2[1]]) - return b1, b2 - -def calculate_three_dimensional_reciprocal_lattice_vectors_with_sympy(a1, a2, a3): - import sympy - cross_a2_a3 = a2.cross(a3) - cross_a3_a1 = a3.cross(a1) - cross_a1_a2 = a1.cross(a2) - b1 = 2*sympy.pi*cross_a2_a3/a1.dot(cross_a2_a3) - b2 = 2*sympy.pi*cross_a3_a1/a1.dot(cross_a2_a3) - b3 = 2*sympy.pi*cross_a1_a2/a1.dot(cross_a2_a3) - return b1, b2, b3 \ No newline at end of file + return np.kron(sigma_z(), sigma_z()) \ No newline at end of file diff --git a/PyPI/src/guan/calculate_conductance.py b/PyPI/src/guan/calculate_conductance.py deleted file mode 100644 index c1a6d5e..0000000 --- a/PyPI/src/guan/calculate_conductance.py +++ /dev/null @@ -1,84 +0,0 @@ -# Guan is an open-source python package developed and maintained by https://www.guanjihuan.com/about. The primary location of this package is on website https://py.guanjihuan.com. - -# calculate conductance - -import numpy as np -import copy -import guan - -def calculate_conductance(fermi_energy, h00, h01, length=100): - right_self_energy, left_self_energy, gamma_right, gamma_left = guan.self_energy_of_lead(fermi_energy, h00, h01) - for ix in range(length): - if ix == 0: - green_nn_n = guan.green_function(fermi_energy, h00, broadening=0, self_energy=left_self_energy) - green_0n_n = copy.deepcopy(green_nn_n) - elif ix != length-1: - green_nn_n = guan.green_function_nn_n(fermi_energy, h00, h01, green_nn_n, broadening=0) - green_0n_n = guan.green_function_in_n(green_0n_n, h01, green_nn_n) - else: - green_nn_n = guan.green_function_nn_n(fermi_energy, h00, h01, green_nn_n, broadening=0, self_energy=right_self_energy) - green_0n_n = guan.green_function_in_n(green_0n_n, h01, green_nn_n) - conductance = np.trace(np.dot(np.dot(np.dot(gamma_left, green_0n_n), gamma_right), green_0n_n.transpose().conj())) - return conductance - -def calculate_conductance_with_fermi_energy_array(fermi_energy_array, h00, h01, length=100): - dim = np.array(fermi_energy_array).shape[0] - conductance_array = np.zeros(dim) - i0 = 0 - for fermi_energy_0 in fermi_energy_array: - conductance_array[i0] = np.real(calculate_conductance(fermi_energy_0, h00, h01, length)) - i0 += 1 - return conductance_array - -def calculate_conductance_with_disorder(fermi_energy, h00, h01, disorder_intensity=2.0, disorder_concentration=1.0, length=100): - right_self_energy, left_self_energy, gamma_right, gamma_left = guan.self_energy_of_lead(fermi_energy, h00, h01) - dim = np.array(h00).shape[0] - for ix in range(length): - disorder = np.zeros((dim, dim)) - for dim0 in range(dim): - if np.random.uniform(0, 1)<=disorder_concentration: - disorder[dim0, dim0] = np.random.uniform(-disorder_intensity, disorder_intensity) - if ix == 0: - green_nn_n = guan.green_function(fermi_energy, h00+disorder, broadening=0, self_energy=left_self_energy) - green_0n_n = copy.deepcopy(green_nn_n) - elif ix != length-1: - green_nn_n = guan.green_function_nn_n(fermi_energy, h00+disorder, h01, green_nn_n, broadening=0) - green_0n_n = guan.green_function_in_n(green_0n_n, h01, green_nn_n) - else: - green_nn_n = guan.green_function_nn_n(fermi_energy, h00+disorder, h01, green_nn_n, broadening=0, self_energy=right_self_energy) - green_0n_n = guan.green_function_in_n(green_0n_n, h01, green_nn_n) - conductance = np.trace(np.dot(np.dot(np.dot(gamma_left, green_0n_n), gamma_right), green_0n_n.transpose().conj())) - return conductance - -def calculate_conductance_with_disorder_intensity_array(fermi_energy, h00, h01, disorder_intensity_array, disorder_concentration=1.0, length=100, calculation_times=1): - dim = np.array(disorder_intensity_array).shape[0] - conductance_array = np.zeros(dim) - i0 = 0 - for disorder_intensity_0 in disorder_intensity_array: - for times in range(calculation_times): - conductance_array[i0] = conductance_array[i0]+np.real(calculate_conductance_with_disorder(fermi_energy, h00, h01, disorder_intensity=disorder_intensity_0, disorder_concentration=disorder_concentration, length=length)) - i0 += 1 - conductance_array = conductance_array/calculation_times - return conductance_array - -def calculate_conductance_with_disorder_concentration_array(fermi_energy, h00, h01, disorder_concentration_array, disorder_intensity=2.0, length=100, calculation_times=1): - dim = np.array(disorder_concentration_array).shape[0] - conductance_array = np.zeros(dim) - i0 = 0 - for disorder_concentration_0 in disorder_concentration_array: - for times in range(calculation_times): - conductance_array[i0] = conductance_array[i0]+np.real(calculate_conductance_with_disorder(fermi_energy, h00, h01, disorder_intensity=disorder_intensity, disorder_concentration=disorder_concentration_0, length=length)) - i0 += 1 - conductance_array = conductance_array/calculation_times - return conductance_array - -def calculate_conductance_with_scattering_length_array(fermi_energy, h00, h01, length_array, disorder_intensity=2.0, disorder_concentration=1.0, calculation_times=1): - dim = np.array(length_array).shape[0] - conductance_array = np.zeros(dim) - i0 = 0 - for length_0 in length_array: - for times in range(calculation_times): - conductance_array[i0] = conductance_array[i0]+np.real(calculate_conductance_with_disorder(fermi_energy, h00, h01, disorder_intensity=disorder_intensity, disorder_concentration=disorder_concentration, length=length_0)) - i0 += 1 - conductance_array = conductance_array/calculation_times - return conductance_array \ No newline at end of file diff --git a/PyPI/src/guan/calculate_density_of_states.py b/PyPI/src/guan/density_of_states.py similarity index 99% rename from PyPI/src/guan/calculate_density_of_states.py rename to PyPI/src/guan/density_of_states.py index 652d45c..7065bf2 100644 --- a/PyPI/src/guan/calculate_density_of_states.py +++ b/PyPI/src/guan/density_of_states.py @@ -1,6 +1,6 @@ # Guan is an open-source python package developed and maintained by https://www.guanjihuan.com/about. The primary location of this package is on website https://py.guanjihuan.com. -# calculate density of states +# density of states import numpy as np from math import * diff --git a/PyPI/src/guan/calculate_scattering_matrix.py b/PyPI/src/guan/quantum_transport.py similarity index 69% rename from PyPI/src/guan/calculate_scattering_matrix.py rename to PyPI/src/guan/quantum_transport.py index 9c0039c..50e5eab 100644 --- a/PyPI/src/guan/calculate_scattering_matrix.py +++ b/PyPI/src/guan/quantum_transport.py @@ -1,11 +1,93 @@ # Guan is an open-source python package developed and maintained by https://www.guanjihuan.com/about. The primary location of this package is on website https://py.guanjihuan.com. -# calculate scattering matrix +# quantum transport + +## conductance import numpy as np import copy import guan +def calculate_conductance(fermi_energy, h00, h01, length=100): + right_self_energy, left_self_energy, gamma_right, gamma_left = guan.self_energy_of_lead(fermi_energy, h00, h01) + for ix in range(length): + if ix == 0: + green_nn_n = guan.green_function(fermi_energy, h00, broadening=0, self_energy=left_self_energy) + green_0n_n = copy.deepcopy(green_nn_n) + elif ix != length-1: + green_nn_n = guan.green_function_nn_n(fermi_energy, h00, h01, green_nn_n, broadening=0) + green_0n_n = guan.green_function_in_n(green_0n_n, h01, green_nn_n) + else: + green_nn_n = guan.green_function_nn_n(fermi_energy, h00, h01, green_nn_n, broadening=0, self_energy=right_self_energy) + green_0n_n = guan.green_function_in_n(green_0n_n, h01, green_nn_n) + conductance = np.trace(np.dot(np.dot(np.dot(gamma_left, green_0n_n), gamma_right), green_0n_n.transpose().conj())) + return conductance + +def calculate_conductance_with_fermi_energy_array(fermi_energy_array, h00, h01, length=100): + dim = np.array(fermi_energy_array).shape[0] + conductance_array = np.zeros(dim) + i0 = 0 + for fermi_energy_0 in fermi_energy_array: + conductance_array[i0] = np.real(calculate_conductance(fermi_energy_0, h00, h01, length)) + i0 += 1 + return conductance_array + +def calculate_conductance_with_disorder(fermi_energy, h00, h01, disorder_intensity=2.0, disorder_concentration=1.0, length=100): + right_self_energy, left_self_energy, gamma_right, gamma_left = guan.self_energy_of_lead(fermi_energy, h00, h01) + dim = np.array(h00).shape[0] + for ix in range(length): + disorder = np.zeros((dim, dim)) + for dim0 in range(dim): + if np.random.uniform(0, 1)<=disorder_concentration: + disorder[dim0, dim0] = np.random.uniform(-disorder_intensity, disorder_intensity) + if ix == 0: + green_nn_n = guan.green_function(fermi_energy, h00+disorder, broadening=0, self_energy=left_self_energy) + green_0n_n = copy.deepcopy(green_nn_n) + elif ix != length-1: + green_nn_n = guan.green_function_nn_n(fermi_energy, h00+disorder, h01, green_nn_n, broadening=0) + green_0n_n = guan.green_function_in_n(green_0n_n, h01, green_nn_n) + else: + green_nn_n = guan.green_function_nn_n(fermi_energy, h00+disorder, h01, green_nn_n, broadening=0, self_energy=right_self_energy) + green_0n_n = guan.green_function_in_n(green_0n_n, h01, green_nn_n) + conductance = np.trace(np.dot(np.dot(np.dot(gamma_left, green_0n_n), gamma_right), green_0n_n.transpose().conj())) + return conductance + +def calculate_conductance_with_disorder_intensity_array(fermi_energy, h00, h01, disorder_intensity_array, disorder_concentration=1.0, length=100, calculation_times=1): + dim = np.array(disorder_intensity_array).shape[0] + conductance_array = np.zeros(dim) + i0 = 0 + for disorder_intensity_0 in disorder_intensity_array: + for times in range(calculation_times): + conductance_array[i0] = conductance_array[i0]+np.real(calculate_conductance_with_disorder(fermi_energy, h00, h01, disorder_intensity=disorder_intensity_0, disorder_concentration=disorder_concentration, length=length)) + i0 += 1 + conductance_array = conductance_array/calculation_times + return conductance_array + +def calculate_conductance_with_disorder_concentration_array(fermi_energy, h00, h01, disorder_concentration_array, disorder_intensity=2.0, length=100, calculation_times=1): + dim = np.array(disorder_concentration_array).shape[0] + conductance_array = np.zeros(dim) + i0 = 0 + for disorder_concentration_0 in disorder_concentration_array: + for times in range(calculation_times): + conductance_array[i0] = conductance_array[i0]+np.real(calculate_conductance_with_disorder(fermi_energy, h00, h01, disorder_intensity=disorder_intensity, disorder_concentration=disorder_concentration_0, length=length)) + i0 += 1 + conductance_array = conductance_array/calculation_times + return conductance_array + +def calculate_conductance_with_scattering_length_array(fermi_energy, h00, h01, length_array, disorder_intensity=2.0, disorder_concentration=1.0, calculation_times=1): + dim = np.array(length_array).shape[0] + conductance_array = np.zeros(dim) + i0 = 0 + for length_0 in length_array: + for times in range(calculation_times): + conductance_array[i0] = conductance_array[i0]+np.real(calculate_conductance_with_disorder(fermi_energy, h00, h01, disorder_intensity=disorder_intensity, disorder_concentration=disorder_concentration, length=length_0)) + i0 += 1 + conductance_array = conductance_array/calculation_times + return conductance_array + + +## scattering matrix + def if_active_channel(k_of_channel): if np.abs(np.imag(k_of_channel))<1e-6: if_active = 1 diff --git a/PyPI/src/guan/calculate_topological_invariant.py b/PyPI/src/guan/topological_invariant.py similarity index 99% rename from PyPI/src/guan/calculate_topological_invariant.py rename to PyPI/src/guan/topological_invariant.py index e272a25..221f140 100644 --- a/PyPI/src/guan/calculate_topological_invariant.py +++ b/PyPI/src/guan/topological_invariant.py @@ -1,6 +1,6 @@ # Guan is an open-source python package developed and maintained by https://www.guanjihuan.com/about. The primary location of this package is on website https://py.guanjihuan.com. -# calculate topological invariant +# topological invariant import numpy as np import cmath