diff --git a/API_reference.py b/API_reference.py index 28841f5..39c6ccb 100644 --- a/API_reference.py +++ b/API_reference.py @@ -89,10 +89,8 @@ k_right, k_left, velocity_right, velocity_left, f_right, f_left, u_right, u_left transmission_matrix, reflection_matrix, k_right, k_left, velocity_right, velocity_left, ind_right_active = guan.calculate_scattering_matrix(fermi_energy, h00, h01, length=100) guan.print_or_write_scattering_matrix(fermi_energy, h00, h01, length=100, on_print=1, on_write=0) -# calculate Chern number # Source code: https://py.guanjihuan.com/calculate_chern_number +# calculate topological invariant # Source code: https://py.guanjihuan.com/source-code/calculate_topological_invariant chern_number = guan.calculate_chern_number_for_square_lattice(hamiltonian_function, precision=100) - -# calculate Wilson loop # Source code: https://py.guanjihuan.com/calculate_wilson_loop wilson_loop_array = guan.calculate_wilson_loop(hamiltonian_function, k_min=-pi, k_max=pi, precision=100) # read and write # Source code: https://py.guanjihuan.com/read_and_write diff --git a/PyPI/setup.cfg b/PyPI/setup.cfg index aa47e55..cea5ec2 100644 --- a/PyPI/setup.cfg +++ b/PyPI/setup.cfg @@ -1,7 +1,7 @@ [metadata] # replace with your username: name = guan -version = 0.0.21 +version = 0.0.22 author = guanjihuan author_email = guanjihuan@163.com description = An open source python package diff --git a/PyPI/src/guan/__init__.py b/PyPI/src/guan/__init__.py index 9a6a7a1..182cc4e 100644 --- a/PyPI/src/guan/__init__.py +++ b/PyPI/src/guan/__init__.py @@ -11,8 +11,7 @@ from .calculate_Green_functions import * from .calculate_density_of_states import * from .calculate_conductance import * from .calculate_scattering_matrix import * -from .calculate_Chern_number import * -from .calculate_Wilson_loop import * +from .calculate_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_Wilson_loop.py b/PyPI/src/guan/calculate_Wilson_loop.py deleted file mode 100644 index fb93d82..0000000 --- a/PyPI/src/guan/calculate_Wilson_loop.py +++ /dev/null @@ -1,24 +0,0 @@ -# Guan is an open-source python package developed and maintained by https://www.guanjihuan.com. The primary location of this package is on website https://py.guanjihuan.com. - -# calculate Wilson loop - -import numpy as np -from math import * -from .calculate_wave_functions import * - -def calculate_wilson_loop(hamiltonian_function, k_min=-pi, k_max=pi, precision=100): - k_array = np.linspace(k_min, k_max, precision) - dim = np.array(hamiltonian_function(0)).shape[0] - wilson_loop_array = np.ones(dim, dtype=complex) - for i in range(dim): - eigenvector_array = [] - for k in k_array: - eigenvector = calculate_eigenvector(hamiltonian_function(k)) - if k != k_max: - eigenvector_array.append(eigenvector[:, i]) - else: - eigenvector_array.append(eigenvector_array[0]) - for i0 in range(precision-1): - F = np.dot(eigenvector_array[i0+1].transpose().conj(), eigenvector_array[i0]) - wilson_loop_array[i] = np.dot(F, wilson_loop_array[i]) - return wilson_loop_array \ No newline at end of file diff --git a/PyPI/src/guan/calculate_Chern_number.py b/PyPI/src/guan/calculate_topological_invariant.py similarity index 69% rename from PyPI/src/guan/calculate_Chern_number.py rename to PyPI/src/guan/calculate_topological_invariant.py index c72cd33..8004fdf 100644 --- a/PyPI/src/guan/calculate_Chern_number.py +++ b/PyPI/src/guan/calculate_topological_invariant.py @@ -1,11 +1,11 @@ # Guan is an open-source python package developed and maintained by https://www.guanjihuan.com. The primary location of this package is on website https://py.guanjihuan.com. -# calculate Chern number +# calculate topological invariant import numpy as np import cmath from math import * -from .calculate_wave_functions import * +from .calculate_band_structures_and_wave_functions import * def calculate_chern_number_for_square_lattice(hamiltonian_function, precision=100): if np.array(hamiltonian_function(0, 0)).shape==(): @@ -37,3 +37,20 @@ def calculate_chern_number_for_square_lattice(hamiltonian_function, precision=10 chern_number[i] = chern_number[i] + F chern_number = chern_number/(2*pi*1j) return chern_number + +def calculate_wilson_loop(hamiltonian_function, k_min=-pi, k_max=pi, precision=100): + k_array = np.linspace(k_min, k_max, precision) + dim = np.array(hamiltonian_function(0)).shape[0] + wilson_loop_array = np.ones(dim, dtype=complex) + for i in range(dim): + eigenvector_array = [] + for k in k_array: + eigenvector = calculate_eigenvector(hamiltonian_function(k)) + if k != k_max: + eigenvector_array.append(eigenvector[:, i]) + else: + eigenvector_array.append(eigenvector_array[0]) + for i0 in range(precision-1): + F = np.dot(eigenvector_array[i0+1].transpose().conj(), eigenvector_array[i0]) + wilson_loop_array[i] = np.dot(F, wilson_loop_array[i]) + return wilson_loop_array \ No newline at end of file