0.0.181
This commit is contained in:
parent
7ce33b5ccb
commit
6d1ed5924c
@ -12,6 +12,13 @@ import guan
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -229,8 +236,7 @@ hamiltonian = guan.hamiltonian_of_cubic_lattice(k1, k2, k3)
|
|||||||
hamiltonian = guan.hamiltonian_of_ssh_model(k, v=0.6, w=1)
|
hamiltonian = guan.hamiltonian_of_ssh_model(k, v=0.6, w=1)
|
||||||
|
|
||||||
# 石墨烯的哈密顿量
|
# 石墨烯的哈密顿量
|
||||||
import math
|
hamiltonian = guan.hamiltonian_of_graphene(k1, k2, staggered_potential=0, t=1, a='default')
|
||||||
hamiltonian = guan.hamiltonian_of_graphene(k1, k2, staggered_potential=0, t=1, a=1/math.sqrt(3))
|
|
||||||
|
|
||||||
# 石墨烯有效模型的哈密顿量
|
# 石墨烯有效模型的哈密顿量
|
||||||
hamiltonian = guan.effective_hamiltonian_of_graphene(qx, qy, t=1, staggered_potential=0, valley_index=0)
|
hamiltonian = guan.effective_hamiltonian_of_graphene(qx, qy, t=1, staggered_potential=0, valley_index=0)
|
||||||
@ -242,12 +248,10 @@ hamiltonian = guan.effective_hamiltonian_of_graphene_after_discretization(qx, qy
|
|||||||
hamiltonian = guan.hamiltonian_of_graphene_with_zigzag_in_quasi_one_dimension(k, N=10, M=0, t=1, period=0)
|
hamiltonian = guan.hamiltonian_of_graphene_with_zigzag_in_quasi_one_dimension(k, N=10, M=0, t=1, period=0)
|
||||||
|
|
||||||
# Haldane模型的哈密顿量
|
# Haldane模型的哈密顿量
|
||||||
import math
|
hamiltonian = guan.hamiltonian_of_haldane_model(k1, k2, M=2/3, t1=1, t2=1/3, phi=math.pi/4, a='default')
|
||||||
hamiltonian = guan.hamiltonian_of_haldane_model(k1, k2, M=2/3, t1=1, t2=1/3, phi=math.pi/4, a=1/math.sqrt(3))
|
|
||||||
|
|
||||||
# 准一维Haldane模型条带的哈密顿量
|
# 准一维Haldane模型条带的哈密顿量
|
||||||
import math
|
hamiltonian = guan.hamiltonian_of_haldane_model_in_quasi_one_dimension(k, N=10, M=2/3, t1=1, t2=1/3, phi='default', period=0)
|
||||||
hamiltonian = guan.hamiltonian_of_haldane_model_in_quasi_one_dimension(k, N=10, M=2/3, t1=1, t2=1/3, phi=math.pi/4, period=0)
|
|
||||||
|
|
||||||
# 一个量子反常霍尔效应的哈密顿量
|
# 一个量子反常霍尔效应的哈密顿量
|
||||||
hamiltonian = guan.hamiltonian_of_one_QAH_model(k1, k2, t1=1, t2=1, t3=0.5, m=-1)
|
hamiltonian = guan.hamiltonian_of_one_QAH_model(k1, k2, t1=1, t2=1, t3=0.5, m=-1)
|
||||||
@ -583,27 +587,24 @@ chern_number = guan.calculate_chern_number_for_square_lattice_with_wilson_loop(h
|
|||||||
chern_number = guan.calculate_chern_number_for_square_lattice_with_wilson_loop_for_degenerate_case(hamiltonian_function, index_of_bands=[0, 1], precision_of_plaquettes=20, precision_of_wilson_loop=5, print_show=0)
|
chern_number = guan.calculate_chern_number_for_square_lattice_with_wilson_loop_for_degenerate_case(hamiltonian_function, index_of_bands=[0, 1], precision_of_plaquettes=20, precision_of_wilson_loop=5, print_show=0)
|
||||||
|
|
||||||
# 通过高效法计算贝利曲率
|
# 通过高效法计算贝利曲率
|
||||||
import math
|
k_array, berry_curvature_array = guan.calculate_berry_curvature_with_efficient_method(hamiltonian_function, k_min='default', k_max='default', precision=100, print_show=0)
|
||||||
k_array, berry_curvature_array = guan.calculate_berry_curvature_with_efficient_method(hamiltonian_function, k_min=-math.pi, k_max=math.pi, precision=100, print_show=0)
|
|
||||||
|
|
||||||
# 通过高效法计算贝利曲率(可计算简并的情况)
|
# 通过高效法计算贝利曲率(可计算简并的情况)
|
||||||
import math
|
k_array, berry_curvature_array = guan.calculate_berry_curvature_with_efficient_method_for_degenerate_case(hamiltonian_function, index_of_bands=[0, 1], k_min='default', k_max='default', precision=100, print_show=0)
|
||||||
k_array, berry_curvature_array = guan.calculate_berry_curvature_with_efficient_method_for_degenerate_case(hamiltonian_function, index_of_bands=[0, 1], k_min=-math.pi, k_max=math.pi, precision=100, print_show=0)
|
|
||||||
|
|
||||||
# 通过Wilson loop方法计算贝里曲率
|
# 通过Wilson loop方法计算贝里曲率
|
||||||
import math
|
k_array, berry_curvature_array = guan.calculate_berry_curvature_with_wilson_loop(hamiltonian_function, k_min='default', k_max='default', precision_of_plaquettes=20, precision_of_wilson_loop=5, print_show=0)
|
||||||
k_array, berry_curvature_array = guan.calculate_berry_curvature_with_wilson_loop(hamiltonian_function, k_min=-math.pi, k_max=math.pi, precision_of_plaquettes=20, precision_of_wilson_loop=5, print_show=0)
|
|
||||||
|
|
||||||
# 通过Wilson loop方法计算贝里曲率(可计算简并的情况)
|
# 通过Wilson loop方法计算贝里曲率(可计算简并的情况)
|
||||||
import math
|
k_array, berry_curvature_array = guan.calculate_berry_curvature_with_wilson_loop_for_degenerate_case(hamiltonian_function, index_of_bands=[0, 1], k_min='default', k_max='default', precision_of_plaquettes=20, precision_of_wilson_loop=5, print_show=0)
|
||||||
k_array, berry_curvature_array = guan.calculate_berry_curvature_with_wilson_loop_for_degenerate_case(hamiltonian_function, index_of_bands=[0, 1], k_min=-math.pi, k_max=math.pi, precision_of_plaquettes=20, precision_of_wilson_loop=5, print_show=0)
|
|
||||||
|
|
||||||
# 计算蜂窝格子的陈数(高效法)
|
# 计算蜂窝格子的陈数(高效法)
|
||||||
chern_number = guan.calculate_chern_number_for_honeycomb_lattice(hamiltonian_function, a=1, precision=300, print_show=0)
|
chern_number = guan.calculate_chern_number_for_honeycomb_lattice(hamiltonian_function, a=1, precision=300, print_show=0)
|
||||||
|
|
||||||
# 计算Wilson loop
|
# 计算Wilson loop
|
||||||
import math
|
wilson_loop_array = guan.calculate_wilson_loop(hamiltonian_function, k_min='default', k_max='default', precision=100, print_show=0)
|
||||||
wilson_loop_array = guan.calculate_wilson_loop(hamiltonian_function, k_min=-math.pi, k_max=math.pi, precision=100, print_show=0)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -779,6 +780,13 @@ guan.print_array_with_index(array, show_index=1, index_type=0)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -856,6 +864,10 @@ guan.play_element_words(random_on=0, show_translation=1, show_link=1, translatio
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
# replace with your username:
|
# replace with your username:
|
||||||
name = guan
|
name = guan
|
||||||
version = 0.0.180
|
version = 0.0.181
|
||||||
author = guanjihuan
|
author = guanjihuan
|
||||||
author_email = guanjihuan@163.com
|
author_email = guanjihuan@163.com
|
||||||
description = An open source python package
|
description = An open source python package
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
Metadata-Version: 2.1
|
Metadata-Version: 2.1
|
||||||
Name: guan
|
Name: guan
|
||||||
Version: 0.0.180
|
Version: 0.0.181
|
||||||
Summary: An open source python package
|
Summary: An open source python package
|
||||||
Home-page: https://py.guanjihuan.com
|
Home-page: https://py.guanjihuan.com
|
||||||
Author: guanjihuan
|
Author: guanjihuan
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# With this package, you can calculate band structures, density of states, quantum transport and topological invariant of tight-binding models by invoking the functions you need. Other frequently used functions are also integrated in this package, such as file reading/writing, figure plotting, data processing.
|
# With this package, you can calculate band structures, density of states, quantum transport and topological invariant of tight-binding models by invoking the functions you need. Other frequently used functions are also integrated in this package, such as file reading/writing, figure plotting, data processing.
|
||||||
|
|
||||||
# The current version is guan-0.0.180, updated on December 03, 2023.
|
# The current version is guan-0.0.181, updated on December 03, 2023.
|
||||||
|
|
||||||
# Installation: pip install --upgrade guan
|
# Installation: pip install --upgrade guan
|
||||||
|
|
||||||
@ -679,11 +679,12 @@ def hamiltonian_of_ssh_model(k, v=0.6, w=1):
|
|||||||
return hamiltonian
|
return hamiltonian
|
||||||
|
|
||||||
# 石墨烯的哈密顿量
|
# 石墨烯的哈密顿量
|
||||||
import math
|
def hamiltonian_of_graphene(k1, k2, staggered_potential=0, t=1, a='default'):
|
||||||
def hamiltonian_of_graphene(k1, k2, staggered_potential=0, t=1, a=1/math.sqrt(3)):
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import cmath
|
import cmath
|
||||||
import math
|
import math
|
||||||
|
if a == 'default':
|
||||||
|
a = 1/math.sqrt(3)
|
||||||
h0 = np.zeros((2, 2), dtype=complex) # mass term
|
h0 = np.zeros((2, 2), dtype=complex) # mass term
|
||||||
h1 = np.zeros((2, 2), dtype=complex) # nearest hopping
|
h1 = np.zeros((2, 2), dtype=complex) # nearest hopping
|
||||||
h0[0, 0] = staggered_potential
|
h0[0, 0] = staggered_potential
|
||||||
@ -753,11 +754,12 @@ def hamiltonian_of_graphene_with_zigzag_in_quasi_one_dimension(k, N=10, M=0, t=1
|
|||||||
return hamiltonian
|
return hamiltonian
|
||||||
|
|
||||||
# Haldane模型的哈密顿量
|
# Haldane模型的哈密顿量
|
||||||
import math
|
def hamiltonian_of_haldane_model(k1, k2, M=2/3, t1=1, t2=1/3, phi=math.pi/4, a='default'):
|
||||||
def hamiltonian_of_haldane_model(k1, k2, M=2/3, t1=1, t2=1/3, phi=math.pi/4, a=1/math.sqrt(3)):
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import cmath
|
import cmath
|
||||||
import math
|
import math
|
||||||
|
if a == 'default':
|
||||||
|
a=1/math.sqrt(3)
|
||||||
h0 = np.zeros((2, 2), dtype=complex) # mass term
|
h0 = np.zeros((2, 2), dtype=complex) # mass term
|
||||||
h1 = np.zeros((2, 2), dtype=complex) # nearest hopping
|
h1 = np.zeros((2, 2), dtype=complex) # nearest hopping
|
||||||
h2 = np.zeros((2, 2), dtype=complex) # next nearest hopping
|
h2 = np.zeros((2, 2), dtype=complex) # next nearest hopping
|
||||||
@ -771,10 +773,12 @@ def hamiltonian_of_haldane_model(k1, k2, M=2/3, t1=1, t2=1/3, phi=math.pi/4, a=1
|
|||||||
return hamiltonian
|
return hamiltonian
|
||||||
|
|
||||||
# 准一维Haldane模型条带的哈密顿量
|
# 准一维Haldane模型条带的哈密顿量
|
||||||
import math
|
def hamiltonian_of_haldane_model_in_quasi_one_dimension(k, N=10, M=2/3, t1=1, t2=1/3, phi='default', period=0):
|
||||||
def hamiltonian_of_haldane_model_in_quasi_one_dimension(k, N=10, M=2/3, t1=1, t2=1/3, phi=math.pi/4, period=0):
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import cmath
|
import cmath
|
||||||
|
import math
|
||||||
|
if phi == 'default':
|
||||||
|
phi=math.pi/4
|
||||||
h00 = np.zeros((4*N, 4*N), dtype=complex) # hopping in a unit cell
|
h00 = np.zeros((4*N, 4*N), dtype=complex) # hopping in a unit cell
|
||||||
h01 = np.zeros((4*N, 4*N), dtype=complex) # hopping between unit cells
|
h01 = np.zeros((4*N, 4*N), dtype=complex) # hopping between unit cells
|
||||||
for i in range(N):
|
for i in range(N):
|
||||||
@ -2422,11 +2426,15 @@ def calculate_chern_number_for_square_lattice_with_wilson_loop_for_degenerate_ca
|
|||||||
return chern_number
|
return chern_number
|
||||||
|
|
||||||
# 通过高效法计算贝利曲率
|
# 通过高效法计算贝利曲率
|
||||||
import math
|
def calculate_berry_curvature_with_efficient_method(hamiltonian_function, k_min='default', k_max='default', precision=100, print_show=0):
|
||||||
def calculate_berry_curvature_with_efficient_method(hamiltonian_function, k_min=-math.pi, k_max=math.pi, precision=100, print_show=0):
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import cmath
|
import cmath
|
||||||
import guan
|
import guan
|
||||||
|
import math
|
||||||
|
if k_min == 'default':
|
||||||
|
k_min = -math.pi
|
||||||
|
if k_max == 'default':
|
||||||
|
k_max=math.pi
|
||||||
if np.array(hamiltonian_function(0, 0)).shape==():
|
if np.array(hamiltonian_function(0, 0)).shape==():
|
||||||
dim = 1
|
dim = 1
|
||||||
else:
|
else:
|
||||||
@ -2464,10 +2472,14 @@ def calculate_berry_curvature_with_efficient_method(hamiltonian_function, k_min=
|
|||||||
return k_array, berry_curvature_array
|
return k_array, berry_curvature_array
|
||||||
|
|
||||||
# 通过高效法计算贝利曲率(可计算简并的情况)
|
# 通过高效法计算贝利曲率(可计算简并的情况)
|
||||||
import math
|
def calculate_berry_curvature_with_efficient_method_for_degenerate_case(hamiltonian_function, index_of_bands=[0, 1], k_min='default', k_max='default', precision=100, print_show=0):
|
||||||
def calculate_berry_curvature_with_efficient_method_for_degenerate_case(hamiltonian_function, index_of_bands=[0, 1], k_min=-math.pi, k_max=math.pi, precision=100, print_show=0):
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import cmath
|
import cmath
|
||||||
|
import math
|
||||||
|
if k_min == 'default':
|
||||||
|
k_min = -math.pi
|
||||||
|
if k_max == 'default':
|
||||||
|
k_max=math.pi
|
||||||
delta = (k_max-k_min)/precision
|
delta = (k_max-k_min)/precision
|
||||||
k_array = np.arange(k_min, k_max, delta)
|
k_array = np.arange(k_min, k_max, delta)
|
||||||
berry_curvature_array = np.zeros((k_array.shape[0], k_array.shape[0]), dtype=complex)
|
berry_curvature_array = np.zeros((k_array.shape[0], k_array.shape[0]), dtype=complex)
|
||||||
@ -2538,9 +2550,13 @@ def calculate_berry_curvature_with_efficient_method_for_degenerate_case(hamilton
|
|||||||
return k_array, berry_curvature_array
|
return k_array, berry_curvature_array
|
||||||
|
|
||||||
# 通过Wilson loop方法计算贝里曲率
|
# 通过Wilson loop方法计算贝里曲率
|
||||||
import math
|
def calculate_berry_curvature_with_wilson_loop(hamiltonian_function, k_min='default', k_max='default', precision_of_plaquettes=20, precision_of_wilson_loop=5, print_show=0):
|
||||||
def calculate_berry_curvature_with_wilson_loop(hamiltonian_function, k_min=-math.pi, k_max=math.pi, precision_of_plaquettes=20, precision_of_wilson_loop=5, print_show=0):
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import math
|
||||||
|
if k_min == 'default':
|
||||||
|
k_min = -math.pi
|
||||||
|
if k_max == 'default':
|
||||||
|
k_max=math.pi
|
||||||
if np.array(hamiltonian_function(0, 0)).shape==():
|
if np.array(hamiltonian_function(0, 0)).shape==():
|
||||||
dim = 1
|
dim = 1
|
||||||
else:
|
else:
|
||||||
@ -2590,9 +2606,13 @@ def calculate_berry_curvature_with_wilson_loop(hamiltonian_function, k_min=-math
|
|||||||
return k_array, berry_curvature_array
|
return k_array, berry_curvature_array
|
||||||
|
|
||||||
# 通过Wilson loop方法计算贝里曲率(可计算简并的情况)
|
# 通过Wilson loop方法计算贝里曲率(可计算简并的情况)
|
||||||
import math
|
def calculate_berry_curvature_with_wilson_loop_for_degenerate_case(hamiltonian_function, index_of_bands=[0, 1], k_min='default', k_max='default', precision_of_plaquettes=20, precision_of_wilson_loop=5, print_show=0):
|
||||||
def calculate_berry_curvature_with_wilson_loop_for_degenerate_case(hamiltonian_function, index_of_bands=[0, 1], k_min=-math.pi, k_max=math.pi, precision_of_plaquettes=20, precision_of_wilson_loop=5, print_show=0):
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import math
|
||||||
|
if k_min == 'default':
|
||||||
|
k_min = -math.pi
|
||||||
|
if k_max == 'default':
|
||||||
|
k_max=math.pi
|
||||||
delta = (k_max-k_min)/precision_of_plaquettes
|
delta = (k_max-k_min)/precision_of_plaquettes
|
||||||
k_array = np.arange(k_min, k_max, delta)
|
k_array = np.arange(k_min, k_max, delta)
|
||||||
berry_curvature_array = np.zeros((k_array.shape[0], k_array.shape[0]), dtype=complex)
|
berry_curvature_array = np.zeros((k_array.shape[0], k_array.shape[0]), dtype=complex)
|
||||||
@ -2700,10 +2720,14 @@ def calculate_chern_number_for_honeycomb_lattice(hamiltonian_function, a=1, prec
|
|||||||
return chern_number
|
return chern_number
|
||||||
|
|
||||||
# 计算Wilson loop
|
# 计算Wilson loop
|
||||||
import math
|
def calculate_wilson_loop(hamiltonian_function, k_min='default', k_max='default', precision=100, print_show=0):
|
||||||
def calculate_wilson_loop(hamiltonian_function, k_min=-math.pi, k_max=math.pi, precision=100, print_show=0):
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import guan
|
import guan
|
||||||
|
import math
|
||||||
|
if k_min == 'default':
|
||||||
|
k_min = -math.pi
|
||||||
|
if k_max == 'default':
|
||||||
|
k_max=math.pi
|
||||||
k_array = np.linspace(k_min, k_max, precision)
|
k_array = np.linspace(k_min, k_max, precision)
|
||||||
dim = np.array(hamiltonian_function(0)).shape[0]
|
dim = np.array(hamiltonian_function(0)).shape[0]
|
||||||
wilson_loop_array = np.ones(dim, dtype=complex)
|
wilson_loop_array = np.ones(dim, dtype=complex)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user