From 3457034248d354ab7b43d6d94618948f92f52d81 Mon Sep 17 00:00:00 2001 From: guanjihuan <34735497+guanjihuan@users.noreply.github.com> Date: Sat, 5 Jun 2021 15:12:12 +0800 Subject: [PATCH] update --- Tutorial/{test.py => 0_test.py} | 4 +- .../{Wilson_loop.py => 10_Wilson_loop.py} | 38 ++++++------- ...read_and_write.py => 11_read_and_write.py} | 38 ++++++------- Tutorial/12_download.py | 5 ++ .../{Pauli_matrix.py => 1_Pauli_matrix.py} | 10 ++-- ...ize.py => 2_Hamiltonian_of_finite_size.py} | 8 +-- ..._Fourier_transform_and_band_structures.py} | 36 ++++++------- ...phene.py => 4_bands_of_zigzag_graphene.py} | 22 ++++---- ...states.py => 5_total_density_of_states.py} | 12 ++--- ...states.py => 6_local_density_of_states.py} | 54 +++++++++---------- Tutorial/{conductance.py => 7_conductance.py} | 14 ++--- ...ering_matrix.py => 8_scattering_matrix.py} | 12 ++--- .../{Chern_number.py => 9_Chern_number.py} | 34 ++++++------ 13 files changed, 146 insertions(+), 141 deletions(-) rename Tutorial/{test.py => 0_test.py} (91%) mode change 100755 => 100644 rename Tutorial/{Wilson_loop.py => 10_Wilson_loop.py} (96%) mode change 100755 => 100644 rename Tutorial/{read_and_write.py => 11_read_and_write.py} (96%) mode change 100755 => 100644 create mode 100644 Tutorial/12_download.py rename Tutorial/{Pauli_matrix.py => 1_Pauli_matrix.py} (97%) mode change 100755 => 100644 rename Tutorial/{Hamiltonian_of_finite_size.py => 2_Hamiltonian_of_finite_size.py} (98%) mode change 100755 => 100644 rename Tutorial/{Fourier_transform_and_band_structures.py => 3_Fourier_transform_and_band_structures.py} (98%) mode change 100755 => 100644 rename Tutorial/{bands_of_zigzag_graphene.py => 4_bands_of_zigzag_graphene.py} (97%) mode change 100755 => 100644 rename Tutorial/{total_density_of_states.py => 5_total_density_of_states.py} (98%) mode change 100755 => 100644 rename Tutorial/{local_density_of_states.py => 6_local_density_of_states.py} (97%) mode change 100755 => 100644 rename Tutorial/{conductance.py => 7_conductance.py} (97%) mode change 100755 => 100644 rename Tutorial/{scattering_matrix.py => 8_scattering_matrix.py} (96%) mode change 100755 => 100644 rename Tutorial/{Chern_number.py => 9_Chern_number.py} (97%) mode change 100755 => 100644 diff --git a/Tutorial/test.py b/Tutorial/0_test.py old mode 100755 new mode 100644 similarity index 91% rename from Tutorial/test.py rename to Tutorial/0_test.py index ffd0ebb..1d702a5 --- a/Tutorial/test.py +++ b/Tutorial/0_test.py @@ -1,3 +1,3 @@ -import gjh - +import gjh + gjh.test() \ No newline at end of file diff --git a/Tutorial/Wilson_loop.py b/Tutorial/10_Wilson_loop.py old mode 100755 new mode 100644 similarity index 96% rename from Tutorial/Wilson_loop.py rename to Tutorial/10_Wilson_loop.py index f13eb8d..34dd76b --- a/Tutorial/Wilson_loop.py +++ b/Tutorial/10_Wilson_loop.py @@ -1,20 +1,20 @@ -import gjh -import numpy as np -import cmath -from math import * - -def hamiltonian_function(k): # SSH model - gamma = 0.5 - lambda0 = 1 - delta = 0 - hamiltonian = np.zeros((2, 2), dtype=complex) - hamiltonian[0,0] = delta - hamiltonian[1,1] = -delta - hamiltonian[0,1] = gamma+lambda0*cmath.exp(-1j*k) - hamiltonian[1,0] = gamma+lambda0*cmath.exp(1j*k) - return hamiltonian - -wilson_loop_array = gjh.calculate_wilson_loop(hamiltonian_function) -print('wilson loop =', wilson_loop_array) -p = np.log(wilson_loop_array)/2/pi/1j +import gjh +import numpy as np +import cmath +from math import * + +def hamiltonian_function(k): # SSH model + gamma = 0.5 + lambda0 = 1 + delta = 0 + hamiltonian = np.zeros((2, 2), dtype=complex) + hamiltonian[0,0] = delta + hamiltonian[1,1] = -delta + hamiltonian[0,1] = gamma+lambda0*cmath.exp(-1j*k) + hamiltonian[1,0] = gamma+lambda0*cmath.exp(1j*k) + return hamiltonian + +wilson_loop_array = gjh.calculate_wilson_loop(hamiltonian_function) +print('wilson loop =', wilson_loop_array) +p = np.log(wilson_loop_array)/2/pi/1j print('p =', p, '\n') \ No newline at end of file diff --git a/Tutorial/read_and_write.py b/Tutorial/11_read_and_write.py old mode 100755 new mode 100644 similarity index 96% rename from Tutorial/read_and_write.py rename to Tutorial/11_read_and_write.py index 1dad216..3d17d93 --- a/Tutorial/read_and_write.py +++ b/Tutorial/11_read_and_write.py @@ -1,20 +1,20 @@ -import gjh -import numpy as np - -x = np.array([1, 2, 3]) -y = np.array([5, 6, 7]) -gjh.write_one_dimensional_data(x, y, filename='one_dimensional_data') - -matrix = np.zeros((3, 3)) -matrix[0, 1] = 11 -gjh.write_two_dimensional_data(x, y, matrix, filename='two_dimensional_data') - - -x_read, y_read = gjh.read_one_dimensional_data('one_dimensional_data') -print(x_read, '\n') -print(y_read, '\n\n') - -x_read, y_read, matrix_read = gjh.read_two_dimensional_data('two_dimensional_data') -print(x_read, '\n') -print(y_read, '\n') +import gjh +import numpy as np + +x = np.array([1, 2, 3]) +y = np.array([5, 6, 7]) +gjh.write_one_dimensional_data(x, y, filename='one_dimensional_data') + +matrix = np.zeros((3, 3)) +matrix[0, 1] = 11 +gjh.write_two_dimensional_data(x, y, matrix, filename='two_dimensional_data') + + +x_read, y_read = gjh.read_one_dimensional_data('one_dimensional_data') +print(x_read, '\n') +print(y_read, '\n\n') + +x_read, y_read, matrix_read = gjh.read_two_dimensional_data('two_dimensional_data') +print(x_read, '\n') +print(y_read, '\n') print(matrix_read) \ No newline at end of file diff --git a/Tutorial/12_download.py b/Tutorial/12_download.py new file mode 100644 index 0000000..f6a62f0 --- /dev/null +++ b/Tutorial/12_download.py @@ -0,0 +1,5 @@ +import gjh + +gjh.download_with_scihub() +# gjh.download_with_scihub('address') +# gjh.download_with_scihub(num=3) \ No newline at end of file diff --git a/Tutorial/Pauli_matrix.py b/Tutorial/1_Pauli_matrix.py old mode 100755 new mode 100644 similarity index 97% rename from Tutorial/Pauli_matrix.py rename to Tutorial/1_Pauli_matrix.py index abe95ee..4403c0e --- a/Tutorial/Pauli_matrix.py +++ b/Tutorial/1_Pauli_matrix.py @@ -1,6 +1,6 @@ -import gjh - -print('sigma_0:\n', gjh.sigma_0(), '\n') -print('sigma_x:\n', gjh.sigma_x(), '\n') -print('sigma_y:\n', gjh.sigma_y(), '\n') +import gjh + +print('sigma_0:\n', gjh.sigma_0(), '\n') +print('sigma_x:\n', gjh.sigma_x(), '\n') +print('sigma_y:\n', gjh.sigma_y(), '\n') print('sigma_z:\n', gjh.sigma_z(), '\n') \ No newline at end of file diff --git a/Tutorial/Hamiltonian_of_finite_size.py b/Tutorial/2_Hamiltonian_of_finite_size.py old mode 100755 new mode 100644 similarity index 98% rename from Tutorial/Hamiltonian_of_finite_size.py rename to Tutorial/2_Hamiltonian_of_finite_size.py index 55aa9fb..aac1e0d --- a/Tutorial/Hamiltonian_of_finite_size.py +++ b/Tutorial/2_Hamiltonian_of_finite_size.py @@ -1,5 +1,5 @@ -import gjh - -print(gjh.finite_size_along_one_direction(3), '\n') -print(gjh.finite_size_along_two_directions_for_square_lattice(2, 2), '\n') +import gjh + +print(gjh.finite_size_along_one_direction(3), '\n') +print(gjh.finite_size_along_two_directions_for_square_lattice(2, 2), '\n') print(gjh.finite_size_along_three_directions_for_cubic_lattice(2, 2, 2), '\n') \ No newline at end of file diff --git a/Tutorial/Fourier_transform_and_band_structures.py b/Tutorial/3_Fourier_transform_and_band_structures.py old mode 100755 new mode 100644 similarity index 98% rename from Tutorial/Fourier_transform_and_band_structures.py rename to Tutorial/3_Fourier_transform_and_band_structures.py index 6c2cf95..3669a26 --- a/Tutorial/Fourier_transform_and_band_structures.py +++ b/Tutorial/3_Fourier_transform_and_band_structures.py @@ -1,19 +1,19 @@ -import gjh -import numpy as np -from math import * -import functools - -x = np.linspace(-pi, pi, 100) -y = np.linspace(-pi, pi, 100) - -hamiltonian_function = functools.partial(gjh.one_dimensional_fourier_transform, unit_cell=0, hopping=1) -eigenvalue_array = gjh.calculate_eigenvalue_with_one_parameter(x, hamiltonian_function) -gjh.plot(x, eigenvalue_array, xlabel='k', ylabel='E', type='-o') - -hamiltonian_function = functools.partial(gjh.two_dimensional_fourier_transform_for_square_lattice, unit_cell=0, hopping_1=1, hopping_2=1) -eigenvalue_array = gjh.calculate_eigenvalue_with_two_parameters(x, y, hamiltonian_function) -gjh.plot_3d_surface(x, y, eigenvalue_array, xlabel='kx', ylabel='ky', zlabel='E') - -hamiltonian_function = functools.partial(gjh.three_dimensional_fourier_transform_for_cubic_lattice, k3=0, unit_cell=0, hopping_1=1, hopping_2=1, hopping_3=1) -eigenvalue_array = gjh.calculate_eigenvalue_with_two_parameters(x, y, hamiltonian_function) +import gjh +import numpy as np +from math import * +import functools + +x = np.linspace(-pi, pi, 100) +y = np.linspace(-pi, pi, 100) + +hamiltonian_function = functools.partial(gjh.one_dimensional_fourier_transform, unit_cell=0, hopping=1) +eigenvalue_array = gjh.calculate_eigenvalue_with_one_parameter(x, hamiltonian_function) +gjh.plot(x, eigenvalue_array, xlabel='k', ylabel='E', type='-o') + +hamiltonian_function = functools.partial(gjh.two_dimensional_fourier_transform_for_square_lattice, unit_cell=0, hopping_1=1, hopping_2=1) +eigenvalue_array = gjh.calculate_eigenvalue_with_two_parameters(x, y, hamiltonian_function) +gjh.plot_3d_surface(x, y, eigenvalue_array, xlabel='kx', ylabel='ky', zlabel='E') + +hamiltonian_function = functools.partial(gjh.three_dimensional_fourier_transform_for_cubic_lattice, k3=0, unit_cell=0, hopping_1=1, hopping_2=1, hopping_3=1) +eigenvalue_array = gjh.calculate_eigenvalue_with_two_parameters(x, y, hamiltonian_function) gjh.plot_3d_surface(x, y, eigenvalue_array, xlabel='kx', ylabel='ky', zlabel='E') \ No newline at end of file diff --git a/Tutorial/bands_of_zigzag_graphene.py b/Tutorial/4_bands_of_zigzag_graphene.py old mode 100755 new mode 100644 similarity index 97% rename from Tutorial/bands_of_zigzag_graphene.py rename to Tutorial/4_bands_of_zigzag_graphene.py index e70bf23..1a02233 --- a/Tutorial/bands_of_zigzag_graphene.py +++ b/Tutorial/4_bands_of_zigzag_graphene.py @@ -1,12 +1,12 @@ -import gjh -import numpy as np -from math import * -import functools - -x = np.linspace(-pi, pi, 100) -Ny = 10 -unit_cell = gjh.finite_size_along_two_directions_for_graphene(1, Ny) -hopping = gjh.hopping_along_zigzag_direction_for_graphene(Ny) -hamiltonian_function = functools.partial(gjh.one_dimensional_fourier_transform, unit_cell=unit_cell, hopping=hopping) -eigenvalue_array = gjh.calculate_eigenvalue_with_one_parameter(x, hamiltonian_function) +import gjh +import numpy as np +from math import * +import functools + +x = np.linspace(-pi, pi, 100) +Ny = 10 +unit_cell = gjh.finite_size_along_two_directions_for_graphene(1, Ny) +hopping = gjh.hopping_along_zigzag_direction_for_graphene(Ny) +hamiltonian_function = functools.partial(gjh.one_dimensional_fourier_transform, unit_cell=unit_cell, hopping=hopping) +eigenvalue_array = gjh.calculate_eigenvalue_with_one_parameter(x, hamiltonian_function) gjh.plot(x, eigenvalue_array, xlabel='k', ylabel='E') \ No newline at end of file diff --git a/Tutorial/total_density_of_states.py b/Tutorial/5_total_density_of_states.py old mode 100755 new mode 100644 similarity index 98% rename from Tutorial/total_density_of_states.py rename to Tutorial/5_total_density_of_states.py index cd805c8..e2052b2 --- a/Tutorial/total_density_of_states.py +++ b/Tutorial/5_total_density_of_states.py @@ -1,7 +1,7 @@ -import gjh -import numpy as np - -hamiltonian = gjh.finite_size_along_two_directions_for_square_lattice(2,2) -fermi_energy_array = np.linspace(-4, 4, 400) -total_dos_array = gjh.total_density_of_states_with_fermi_energy_array(fermi_energy_array, hamiltonian, broadening=0.1) +import gjh +import numpy as np + +hamiltonian = gjh.finite_size_along_two_directions_for_square_lattice(2,2) +fermi_energy_array = np.linspace(-4, 4, 400) +total_dos_array = gjh.total_density_of_states_with_fermi_energy_array(fermi_energy_array, hamiltonian, broadening=0.1) gjh.plot(fermi_energy_array, total_dos_array, xlabel='E', ylabel='Total DOS', type='-o') \ No newline at end of file diff --git a/Tutorial/local_density_of_states.py b/Tutorial/6_local_density_of_states.py old mode 100755 new mode 100644 similarity index 97% rename from Tutorial/local_density_of_states.py rename to Tutorial/6_local_density_of_states.py index 54920b6..1b284c8 --- a/Tutorial/local_density_of_states.py +++ b/Tutorial/6_local_density_of_states.py @@ -1,28 +1,28 @@ -import gjh -import numpy as np - -fermi_energy = 0 -N1 = 3 -N2 = 4 -hamiltonian = gjh.finite_size_along_two_directions_for_square_lattice(N1,N2) -LDOS = gjh.local_density_of_states_for_square_lattice(fermi_energy, hamiltonian, N1=N1, N2=N2) -print('square lattice:\n', LDOS, '\n') - -h00 = gjh.finite_size_along_one_direction(N2) -h01 = np.identity(N2) -LDOS = gjh.local_density_of_states_for_square_lattice_using_dyson_equation(fermi_energy, h00=h00, h01=h01, N2=N2, N1=N1) -print(LDOS, '\n\n') -gjh.plot_contour(range(N1), range(N2), LDOS) - - -N1 = 3 -N2 = 4 -N3 = 5 -hamiltonian = gjh.finite_size_along_three_directions_for_cubic_lattice(N1, N2, N3) -LDOS = gjh.local_density_of_states_for_cubic_lattice(fermi_energy, hamiltonian, N1=N1, N2=N2, N3=N3) -print('cubic lattice:\n', LDOS, '\n') - -h00 = gjh.finite_size_along_two_directions_for_square_lattice(N2, N3) -h01 = np.identity(N2*N3) -LDOS = gjh.local_density_of_states_for_cubic_lattice_using_dyson_equation(fermi_energy, h00, h01, N3=N3, N2=N2, N1=N1) +import gjh +import numpy as np + +fermi_energy = 0 +N1 = 3 +N2 = 4 +hamiltonian = gjh.finite_size_along_two_directions_for_square_lattice(N1,N2) +LDOS = gjh.local_density_of_states_for_square_lattice(fermi_energy, hamiltonian, N1=N1, N2=N2) +print('square lattice:\n', LDOS, '\n') + +h00 = gjh.finite_size_along_one_direction(N2) +h01 = np.identity(N2) +LDOS = gjh.local_density_of_states_for_square_lattice_using_dyson_equation(fermi_energy, h00=h00, h01=h01, N2=N2, N1=N1) +print(LDOS, '\n\n') +gjh.plot_contour(range(N1), range(N2), LDOS) + + +N1 = 3 +N2 = 4 +N3 = 5 +hamiltonian = gjh.finite_size_along_three_directions_for_cubic_lattice(N1, N2, N3) +LDOS = gjh.local_density_of_states_for_cubic_lattice(fermi_energy, hamiltonian, N1=N1, N2=N2, N3=N3) +print('cubic lattice:\n', LDOS, '\n') + +h00 = gjh.finite_size_along_two_directions_for_square_lattice(N2, N3) +h01 = np.identity(N2*N3) +LDOS = gjh.local_density_of_states_for_cubic_lattice_using_dyson_equation(fermi_energy, h00, h01, N3=N3, N2=N2, N1=N1) print(LDOS) \ No newline at end of file diff --git a/Tutorial/conductance.py b/Tutorial/7_conductance.py old mode 100755 new mode 100644 similarity index 97% rename from Tutorial/conductance.py rename to Tutorial/7_conductance.py index 7cfa6de..10d5a94 --- a/Tutorial/conductance.py +++ b/Tutorial/7_conductance.py @@ -1,8 +1,8 @@ -import gjh -import numpy as np - -fermi_energy_array = np.linspace(-5, 5, 400) -h00 = gjh.finite_size_along_one_direction(4) -h01 = np.identity(4) -conductance_array = gjh.calculate_conductance_with_fermi_energy_array(fermi_energy_array, h00, h01) +import gjh +import numpy as np + +fermi_energy_array = np.linspace(-5, 5, 400) +h00 = gjh.finite_size_along_one_direction(4) +h01 = np.identity(4) +conductance_array = gjh.calculate_conductance_with_fermi_energy_array(fermi_energy_array, h00, h01) gjh.plot(fermi_energy_array, conductance_array, xlabel='E', ylabel='Conductance', type='-o') \ No newline at end of file diff --git a/Tutorial/scattering_matrix.py b/Tutorial/8_scattering_matrix.py old mode 100755 new mode 100644 similarity index 96% rename from Tutorial/scattering_matrix.py rename to Tutorial/8_scattering_matrix.py index c84970d..c6a5f8e --- a/Tutorial/scattering_matrix.py +++ b/Tutorial/8_scattering_matrix.py @@ -1,7 +1,7 @@ -import gjh -import numpy as np - -fermi_energy = 0 -h00 = gjh.finite_size_along_one_direction(4) -h01 = np.identity(4) +import gjh +import numpy as np + +fermi_energy = 0 +h00 = gjh.finite_size_along_one_direction(4) +h01 = np.identity(4) gjh.print_or_write_scattering_matrix(fermi_energy, h00, h01) \ No newline at end of file diff --git a/Tutorial/Chern_number.py b/Tutorial/9_Chern_number.py old mode 100755 new mode 100644 similarity index 97% rename from Tutorial/Chern_number.py rename to Tutorial/9_Chern_number.py index 063738c..ef2d23a --- a/Tutorial/Chern_number.py +++ b/Tutorial/9_Chern_number.py @@ -1,18 +1,18 @@ -import gjh -import numpy as np -from math import * - -def hamiltonian_function(kx, ky): # one QAH model with chern number 2 - t1 = 1.0 - t2 = 1.0 - t3 = 0.5 - m = -1.0 - hamiltonian = np.zeros((2, 2), dtype=complex) - hamiltonian[0, 1] = 2*t1*cos(kx)-1j*2*t1*cos(ky) - hamiltonian[1, 0] = 2*t1*cos(kx)+1j*2*t1*cos(ky) - hamiltonian[0, 0] = m+2*t3*sin(kx)+2*t3*sin(ky)+2*t2*cos(kx+ky) - hamiltonian[1, 1] = -(m+2*t3*sin(kx)+2*t3*sin(ky)+2*t2*cos(kx+ky)) - return hamiltonian - -chern_number = gjh.calculate_chern_number_for_square_lattice(hamiltonian_function, precision=100) +import gjh +import numpy as np +from math import * + +def hamiltonian_function(kx, ky): # one QAH model with chern number 2 + t1 = 1.0 + t2 = 1.0 + t3 = 0.5 + m = -1.0 + hamiltonian = np.zeros((2, 2), dtype=complex) + hamiltonian[0, 1] = 2*t1*cos(kx)-1j*2*t1*cos(ky) + hamiltonian[1, 0] = 2*t1*cos(kx)+1j*2*t1*cos(ky) + hamiltonian[0, 0] = m+2*t3*sin(kx)+2*t3*sin(ky)+2*t2*cos(kx+ky) + hamiltonian[1, 1] = -(m+2*t3*sin(kx)+2*t3*sin(ky)+2*t2*cos(kx+ky)) + return hamiltonian + +chern_number = gjh.calculate_chern_number_for_square_lattice(hamiltonian_function, precision=100) print(chern_number) \ No newline at end of file