version 0.0.51
This commit is contained in:
47
Tutorial/01_test_and_Pauli_matrix.py
Normal file
47
Tutorial/01_test_and_Pauli_matrix.py
Normal file
@@ -0,0 +1,47 @@
|
||||
import guan
|
||||
|
||||
# test
|
||||
guan.test()
|
||||
|
||||
# Pauli matrix
|
||||
sigma_0 = guan.sigma_0()
|
||||
sigma_x = guan.sigma_x()
|
||||
sigma_y = guan.sigma_y()
|
||||
sigma_z = guan.sigma_z()
|
||||
sigma_00 = guan.sigma_00()
|
||||
sigma_0x = guan.sigma_0x()
|
||||
sigma_0y = guan.sigma_0y()
|
||||
sigma_0z = guan.sigma_0z()
|
||||
sigma_x0 = guan.sigma_x0()
|
||||
sigma_xx = guan.sigma_xx()
|
||||
sigma_xy = guan.sigma_xy()
|
||||
sigma_xz = guan.sigma_xz()
|
||||
sigma_y0 = guan.sigma_y0()
|
||||
sigma_yx = guan.sigma_yx()
|
||||
sigma_yy = guan.sigma_yy()
|
||||
sigma_yz = guan.sigma_yz()
|
||||
sigma_z0 = guan.sigma_z0()
|
||||
sigma_zx = guan.sigma_zx()
|
||||
sigma_zy = guan.sigma_zy()
|
||||
sigma_zz = guan.sigma_zz()
|
||||
print('Pauli matrix\n')
|
||||
print('sigma_0\n', sigma_0, '\n')
|
||||
print('sigma_x\n', sigma_x, '\n')
|
||||
print('sigma_y\n', sigma_y, '\n')
|
||||
print('sigma_z\n', sigma_z, '\n')
|
||||
print('sigma_00\n', sigma_00, '\n')
|
||||
print('sigma_0x\n', sigma_0x, '\n')
|
||||
print('sigma_0y\n', sigma_0y, '\n')
|
||||
print('sigma_0z\n', sigma_0z, '\n')
|
||||
print('sigma_x0\n', sigma_x0, '\n')
|
||||
print('sigma_xx\n', sigma_xx, '\n')
|
||||
print('sigma_xy\n', sigma_xy, '\n')
|
||||
print('sigma_xz\n', sigma_xz, '\n')
|
||||
print('sigma_y0\n', sigma_y0, '\n')
|
||||
print('sigma_yx\n', sigma_yx, '\n')
|
||||
print('sigma_yy\n', sigma_yy, '\n')
|
||||
print('sigma_yz\n', sigma_yz, '\n')
|
||||
print('sigma_z0\n', sigma_z0, '\n')
|
||||
print('sigma_zx\n', sigma_zx, '\n')
|
||||
print('sigma_zy\n', sigma_zy, '\n')
|
||||
print('sigma_zz\n', sigma_zz, '\n')
|
@@ -0,0 +1,8 @@
|
||||
import guan
|
||||
import numpy as np
|
||||
|
||||
# Fourier transform / calculate band structures / plot figures
|
||||
k_array = np.linspace(-np.pi, np.pi, 100)
|
||||
hamiltonian_function = guan.one_dimensional_fourier_transform_with_k(unit_cell=0, hopping=1) # one dimensional chain
|
||||
eigenvalue_array = guan.calculate_eigenvalue_with_one_parameter(k_array, hamiltonian_function)
|
||||
guan.plot(k_array, eigenvalue_array, xlabel='k', ylabel='E', type='-k')
|
6
Tutorial/03_Hamiltonian_of_finite_size_systems.py
Normal file
6
Tutorial/03_Hamiltonian_of_finite_size_systems.py
Normal file
@@ -0,0 +1,6 @@
|
||||
import guan
|
||||
|
||||
# Hamiltonian of finite size
|
||||
print('\n', guan.hamiltonian_of_finite_size_system_along_one_direction(3), '\n')
|
||||
print(guan.hamiltonian_of_finite_size_system_along_two_directions_for_square_lattice(2, 2), '\n')
|
||||
print(guan.hamiltonian_of_finite_size_system_along_three_directions_for_cubic_lattice(2, 2, 2), '\n')
|
9
Tutorial/04_some_models_in_the_reciprocal_space.py
Normal file
9
Tutorial/04_some_models_in_the_reciprocal_space.py
Normal file
@@ -0,0 +1,9 @@
|
||||
import guan
|
||||
import numpy as np
|
||||
|
||||
# Hamiltonian of models in the reciprocal space / calculate band structures / plot figures
|
||||
k_array = np.linspace(-np.pi, np.pi, 100)
|
||||
eigenvalue_array = guan.calculate_eigenvalue_with_one_parameter(k_array, guan.hamiltonian_of_square_lattice_in_quasi_one_dimension)
|
||||
guan.plot(k_array, eigenvalue_array, xlabel='k', ylabel='E', type='-k')
|
||||
eigenvalue_array = guan.calculate_eigenvalue_with_one_parameter(k_array, guan.hamiltonian_of_graphene_with_zigzag_in_quasi_one_dimension)
|
||||
guan.plot(k_array, eigenvalue_array, xlabel='k', ylabel='E', type='-k')
|
@@ -2,7 +2,7 @@ import guan
|
||||
import numpy as np
|
||||
|
||||
# calculate density of states
|
||||
hamiltonian = guan.finite_size_along_two_directions_for_square_lattice(2,2)
|
||||
hamiltonian = guan.hamiltonian_of_finite_size_system_along_two_directions_for_square_lattice(2,2)
|
||||
fermi_energy_array = np.linspace(-4, 4, 400)
|
||||
total_dos_array = guan.total_density_of_states_with_fermi_energy_array(fermi_energy_array, hamiltonian, broadening=0.1)
|
||||
guan.plot(fermi_energy_array, total_dos_array, xlabel='E', ylabel='Total DOS', type='-o')
|
||||
@@ -10,10 +10,10 @@ guan.plot(fermi_energy_array, total_dos_array, xlabel='E', ylabel='Total DOS', t
|
||||
fermi_energy = 0
|
||||
N1 = 3
|
||||
N2 = 4
|
||||
hamiltonian = guan.finite_size_along_two_directions_for_square_lattice(N1,N2)
|
||||
hamiltonian = guan.hamiltonian_of_finite_size_system_along_two_directions_for_square_lattice(N1,N2)
|
||||
LDOS = guan.local_density_of_states_for_square_lattice(fermi_energy, hamiltonian, N1=N1, N2=N2)
|
||||
print('square lattice:\n', LDOS, '\n')
|
||||
h00 = guan.finite_size_along_one_direction(N2)
|
||||
h00 = guan.hamiltonian_of_finite_size_system_along_one_direction(N2)
|
||||
h01 = np.identity(N2)
|
||||
LDOS = guan.local_density_of_states_for_square_lattice_using_dyson_equation(fermi_energy, h00=h00, h01=h01, N2=N2, N1=N1)
|
||||
print(LDOS, '\n\n')
|
||||
@@ -22,10 +22,10 @@ print(LDOS, '\n\n')
|
||||
N1 = 3
|
||||
N2 = 4
|
||||
N3 = 5
|
||||
hamiltonian = guan.finite_size_along_three_directions_for_cubic_lattice(N1, N2, N3)
|
||||
hamiltonian = guan.hamiltonian_of_finite_size_system_along_three_directions_for_cubic_lattice(N1, N2, N3)
|
||||
LDOS = guan.local_density_of_states_for_cubic_lattice(fermi_energy, hamiltonian, N1=N1, N2=N2, N3=N3)
|
||||
print('cubic lattice:\n', LDOS, '\n')
|
||||
h00 = guan.finite_size_along_two_directions_for_square_lattice(N2, N3)
|
||||
h00 = guan.hamiltonian_of_finite_size_system_along_two_directions_for_square_lattice(N2, N3)
|
||||
h01 = np.identity(N2*N3)
|
||||
LDOS = guan.local_density_of_states_for_cubic_lattice_using_dyson_equation(fermi_energy, h00, h01, N3=N3, N2=N2, N1=N1)
|
||||
print(LDOS)
|
@@ -2,14 +2,12 @@ import guan
|
||||
import numpy as np
|
||||
|
||||
# calculate conductance
|
||||
fermi_energy_array = np.linspace(-5, 5, 400)
|
||||
h00 = guan.finite_size_along_one_direction(4)
|
||||
fermi_energy_array = np.linspace(-4, 4, 400)
|
||||
h00 = guan.hamiltonian_of_finite_size_system_along_one_direction(4)
|
||||
h01 = np.identity(4)
|
||||
conductance_array = guan.calculate_conductance_with_fermi_energy_array(fermi_energy_array, h00, h01)
|
||||
guan.plot(fermi_energy_array, conductance_array, xlabel='E', ylabel='Conductance', type='-o')
|
||||
guan.plot(fermi_energy_array, conductance_array, xlabel='E', ylabel='Conductance', type='-')
|
||||
|
||||
# calculate scattering matrix
|
||||
fermi_energy = 0
|
||||
h00 = guan.finite_size_along_one_direction(4)
|
||||
h01 = np.identity(4)
|
||||
guan.print_or_write_scattering_matrix(fermi_energy, h00, h01)
|
13
Tutorial/07_calculate_Chern_number_and_Wilson_loop.py
Normal file
13
Tutorial/07_calculate_Chern_number_and_Wilson_loop.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import guan
|
||||
import numpy as np
|
||||
from math import *
|
||||
|
||||
# calculate Chern number
|
||||
chern_number = guan.calculate_chern_number_for_square_lattice(guan.hamiltonian_of_one_QAH_model, precision=100)
|
||||
print('\nChern number=', chern_number)
|
||||
|
||||
# calculate Wilson loop
|
||||
wilson_loop_array = guan.calculate_wilson_loop(guan.hamiltonian_of_ssh_model)
|
||||
print('Wilson loop =', wilson_loop_array)
|
||||
p = np.log(wilson_loop_array)/2/pi/1j
|
||||
print('p =', p, '\n')
|
@@ -1,9 +0,0 @@
|
||||
import guan
|
||||
import numpy as np
|
||||
import functools
|
||||
|
||||
# Fourier transform / calculate band structures / plot figures
|
||||
x_array = np.linspace(-np.pi, np.pi, 100)
|
||||
hamiltonian_function = functools.partial(guan.one_dimensional_fourier_transform, unit_cell=0, hopping=1)
|
||||
eigenvalue_array = guan.calculate_eigenvalue_with_one_parameter(x_array, hamiltonian_function)
|
||||
guan.plot(x_array, eigenvalue_array, xlabel='k', ylabel='E', type='-k')
|
@@ -1,6 +0,0 @@
|
||||
import guan
|
||||
|
||||
# Hamiltonian of finite size
|
||||
print(guan.finite_size_along_one_direction(3), '\n')
|
||||
print(guan.finite_size_along_two_directions_for_square_lattice(2, 2), '\n')
|
||||
print(guan.finite_size_along_three_directions_for_cubic_lattice(2, 2, 2), '\n')
|
@@ -1,24 +0,0 @@
|
||||
import guan
|
||||
import numpy as np
|
||||
from math import *
|
||||
|
||||
# calculate Chern number
|
||||
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 = guan.calculate_chern_number_for_square_lattice(hamiltonian_function, precision=100)
|
||||
print('Chern number=', chern_number)
|
||||
|
||||
# calculate Wilson loop
|
||||
wilson_loop_array = guan.calculate_wilson_loop(guan.hamiltonian_of_ssh_model)
|
||||
print('Wilson loop =', wilson_loop_array)
|
||||
p = np.log(wilson_loop_array)/2/pi/1j
|
||||
print('p =', p, '\n')
|
@@ -1,9 +0,0 @@
|
||||
import guan
|
||||
import numpy as np
|
||||
|
||||
# Hamiltonian of models in the reciprocal space / calculate band structures / plot figures
|
||||
x_array = np.linspace(-np.pi, np.pi, 100)
|
||||
eigenvalue_array = guan.calculate_eigenvalue_with_one_parameter(x_array, guan.hamiltonian_of_square_lattice_in_quasi_one_dimension)
|
||||
guan.plot(x_array, eigenvalue_array, xlabel='k', ylabel='E', type='-k')
|
||||
eigenvalue_array = guan.calculate_eigenvalue_with_one_parameter(x_array, guan.hamiltonian_of_graphene_with_zigzag_in_quasi_one_dimension)
|
||||
guan.plot(x_array, eigenvalue_array, xlabel='k', ylabel='E', type='-k')
|
@@ -1,12 +0,0 @@
|
||||
import guan
|
||||
|
||||
# test
|
||||
print('test')
|
||||
guan.test()
|
||||
|
||||
# Pauli matrix
|
||||
print('Pauli matrix')
|
||||
print('sigma_0:\n', guan.sigma_0(), '\n')
|
||||
print('sigma_x:\n', guan.sigma_x(), '\n')
|
||||
print('sigma_y:\n', guan.sigma_y(), '\n')
|
||||
print('sigma_z:\n', guan.sigma_z(), '\n')
|
Reference in New Issue
Block a user