From 23be72b2c1c8579adec05f7de0189634a7f80454 Mon Sep 17 00:00:00 2001 From: guanjihuan Date: Wed, 15 Jun 2022 15:02:17 +0800 Subject: [PATCH] update --- .../2D_Haldane_model.py | 2 +- .../Chern_number_in_Haldane_model.py | 15 +++++++++------ ...er_in_Haldane_model_by_integration_method_2.py | 14 +++++++++----- ...er_in_Haldane_model_by_integration_method_3.py | 14 +++++++++----- 4 files changed, 28 insertions(+), 17 deletions(-) diff --git a/academic_codes/2019.10.24_Halmiltonian_and_bands_of_Haldane_model/2D_Haldane_model.py b/academic_codes/2019.10.24_Halmiltonian_and_bands_of_Haldane_model/2D_Haldane_model.py index 9f84494..632278c 100755 --- a/academic_codes/2019.10.24_Halmiltonian_and_bands_of_Haldane_model/2D_Haldane_model.py +++ b/academic_codes/2019.10.24_Halmiltonian_and_bands_of_Haldane_model/2D_Haldane_model.py @@ -25,7 +25,7 @@ def hamiltonian(k1, k2, M, t1, t2, phi, a=1/sqrt(3)): # Haldane哈密顿量(a h1[0, 1] = h1[1, 0].conj() # 最近邻项也可写成这种形式 - # h1[1, 0] = t1+t1*cmath.exp(1j*sqrt(3)/2*k1*a-1j*3/2*k2*a)-t1*cmath.exp(-1j*sqrt(3)/2*k1*a-1j*3/2*k2*a) + # h1[1, 0] = t1+t1*cmath.exp(1j*sqrt(3)/2*k1*a-1j*3/2*k2*a)+t1*cmath.exp(-1j*sqrt(3)/2*k1*a-1j*3/2*k2*a) # h1[0, 1] = h1[1, 0].conj() # 次近邻项 diff --git a/academic_codes/2020.07.13_calculation_of_Chern_number_in_Haldane_model/Chern_number_in_Haldane_model.py b/academic_codes/2020.07.13_calculation_of_Chern_number_in_Haldane_model/Chern_number_in_Haldane_model.py index a542708..d6c8e66 100755 --- a/academic_codes/2020.07.13_calculation_of_Chern_number_in_Haldane_model/Chern_number_in_Haldane_model.py +++ b/academic_codes/2020.07.13_calculation_of_Chern_number_in_Haldane_model/Chern_number_in_Haldane_model.py @@ -4,18 +4,17 @@ The newest version of this code is on the web page: https://www.guanjihuan.com/a """ import numpy as np -import matplotlib.pyplot as plt from math import * # 引入pi, cos等 import cmath import time import functools # 使用偏函数functools.partial() -def hamiltonian(k1, k2, M, t1, t2, phi, a=1/sqrt(3)): # Haldane哈密顿量(a为原子间距,不赋值的话默认为1/sqrt(3)) +def hamiltonian(k1, k2, M, t1, t2, phi, a=1/sqrt(3)): # Haldane哈密顿量(a为原子间距,不赋值的话默认为1/sqrt(3)) # 初始化为零矩阵 - h0 = np.zeros((2, 2))*(1+0j) # 乘(1+0j)是为了把h0转为复数 - h1 = np.zeros((2, 2))*(1+0j) - h2 = np.zeros((2, 2))*(1+0j) + h0 = np.zeros((2, 2), dtype=complex) + h1 = np.zeros((2, 2), dtype=complex) + h2 = np.zeros((2, 2), dtype=complex) # 质量项(mass term), 用于打开带隙 h0[0, 0] = M @@ -25,6 +24,10 @@ def hamiltonian(k1, k2, M, t1, t2, phi, a=1/sqrt(3)): # Haldane哈密顿量(a h1[1, 0] = t1*(cmath.exp(1j*k2*a)+cmath.exp(1j*sqrt(3)/2*k1*a-1j/2*k2*a)+cmath.exp(-1j*sqrt(3)/2*k1*a-1j/2*k2*a)) h1[0, 1] = h1[1, 0].conj() + # # 最近邻项也可写成这种形式 + # h1[1, 0] = t1+t1*cmath.exp(1j*sqrt(3)/2*k1*a-1j*3/2*k2*a)+t1*cmath.exp(-1j*sqrt(3)/2*k1*a-1j*3/2*k2*a) + # h1[0, 1] = h1[1, 0].conj() + #次近邻项 # 对应陈数为-1 h2[0, 0] = t2*cmath.exp(-1j*phi)*(cmath.exp(1j*sqrt(3)*k1*a)+cmath.exp(-1j*sqrt(3)/2*k1*a+1j*3/2*k2*a)+cmath.exp(-1j*sqrt(3)/2*k1*a-1j*3/2*k2*a)) h2[1, 1] = t2*cmath.exp(1j*phi)*(cmath.exp(1j*sqrt(3)*k1*a)+cmath.exp(-1j*sqrt(3)/2*k1*a+1j*3/2*k2*a)+cmath.exp(-1j*sqrt(3)/2*k1*a-1j*3/2*k2*a)) @@ -88,4 +91,4 @@ def main(): if __name__ == '__main__': - main() + main() \ No newline at end of file diff --git a/academic_codes/2020.07.13_calculation_of_Chern_number_in_Haldane_model/Chern_number_in_Haldane_model_by_integration_method_2.py b/academic_codes/2020.07.13_calculation_of_Chern_number_in_Haldane_model/Chern_number_in_Haldane_model_by_integration_method_2.py index eefbcda..d4a3cc2 100755 --- a/academic_codes/2020.07.13_calculation_of_Chern_number_in_Haldane_model/Chern_number_in_Haldane_model_by_integration_method_2.py +++ b/academic_codes/2020.07.13_calculation_of_Chern_number_in_Haldane_model/Chern_number_in_Haldane_model_by_integration_method_2.py @@ -11,11 +11,11 @@ import time import functools # 使用偏函数functools.partial() -def hamiltonian(k1, k2, M, t1, t2, phi, a=1/sqrt(3)): # Haldane哈密顿量(a为原子间距,不赋值的话默认为1/sqrt(3)) +def hamiltonian(k1, k2, M, t1, t2, phi, a=1/sqrt(3)): # Haldane哈密顿量(a为原子间距,不赋值的话默认为1/sqrt(3)) # 初始化为零矩阵 - h0 = np.zeros((2, 2))*(1+0j) # 乘(1+0j)是为了把h0转为复数 - h1 = np.zeros((2, 2))*(1+0j) - h2 = np.zeros((2, 2))*(1+0j) + h0 = np.zeros((2, 2), dtype=complex) + h1 = np.zeros((2, 2), dtype=complex) + h2 = np.zeros((2, 2), dtype=complex) # 质量项(mass term), 用于打开带隙 h0[0, 0] = M @@ -25,6 +25,10 @@ def hamiltonian(k1, k2, M, t1, t2, phi, a=1/sqrt(3)): # Haldane哈密顿量(a h1[1, 0] = t1*(cmath.exp(1j*k2*a)+cmath.exp(1j*sqrt(3)/2*k1*a-1j/2*k2*a)+cmath.exp(-1j*sqrt(3)/2*k1*a-1j/2*k2*a)) h1[0, 1] = h1[1, 0].conj() + # # 最近邻项也可写成这种形式 + # h1[1, 0] = t1+t1*cmath.exp(1j*sqrt(3)/2*k1*a-1j*3/2*k2*a)+t1*cmath.exp(-1j*sqrt(3)/2*k1*a-1j*3/2*k2*a) + # h1[0, 1] = h1[1, 0].conj() + #次近邻项 # 对应陈数为-1 h2[0, 0] = t2*cmath.exp(-1j*phi)*(cmath.exp(1j*sqrt(3)*k1*a)+cmath.exp(-1j*sqrt(3)/2*k1*a+1j*3/2*k2*a)+cmath.exp(-1j*sqrt(3)/2*k1*a-1j*3/2*k2*a)) h2[1, 1] = t2*cmath.exp(1j*phi)*(cmath.exp(1j*sqrt(3)*k1*a)+cmath.exp(-1j*sqrt(3)/2*k1*a+1j*3/2*k2*a)+cmath.exp(-1j*sqrt(3)/2*k1*a-1j*3/2*k2*a)) @@ -84,4 +88,4 @@ def main(): if __name__ == '__main__': - main() + main() \ No newline at end of file diff --git a/academic_codes/2020.07.13_calculation_of_Chern_number_in_Haldane_model/Chern_number_in_Haldane_model_by_integration_method_3.py b/academic_codes/2020.07.13_calculation_of_Chern_number_in_Haldane_model/Chern_number_in_Haldane_model_by_integration_method_3.py index c76d62d..09e3d9f 100755 --- a/academic_codes/2020.07.13_calculation_of_Chern_number_in_Haldane_model/Chern_number_in_Haldane_model_by_integration_method_3.py +++ b/academic_codes/2020.07.13_calculation_of_Chern_number_in_Haldane_model/Chern_number_in_Haldane_model_by_integration_method_3.py @@ -11,11 +11,11 @@ import time import functools # 使用偏函数functools.partial() -def hamiltonian(k1, k2, M, t1, t2, phi, a=1/sqrt(3)): # Haldane哈密顿量(a为原子间距,不赋值的话默认为1/sqrt(3)) +def hamiltonian(k1, k2, M, t1, t2, phi, a=1/sqrt(3)): # Haldane哈密顿量# Haldane哈密顿量(a为原子间距,不赋值的话默认为1/sqrt(3)) # 初始化为零矩阵 - h0 = np.zeros((2, 2))*(1+0j) # 乘(1+0j)是为了把h0转为复数 - h1 = np.zeros((2, 2))*(1+0j) - h2 = np.zeros((2, 2))*(1+0j) + h0 = np.zeros((2, 2), dtype=complex) + h1 = np.zeros((2, 2), dtype=complex) + h2 = np.zeros((2, 2), dtype=complex) # 质量项(mass term), 用于打开带隙 h0[0, 0] = M @@ -25,6 +25,10 @@ def hamiltonian(k1, k2, M, t1, t2, phi, a=1/sqrt(3)): # Haldane哈密顿量(a h1[1, 0] = t1*(cmath.exp(1j*k2*a)+cmath.exp(1j*sqrt(3)/2*k1*a-1j/2*k2*a)+cmath.exp(-1j*sqrt(3)/2*k1*a-1j/2*k2*a)) h1[0, 1] = h1[1, 0].conj() + # # 最近邻项也可写成这种形式 + # h1[1, 0] = t1+t1*cmath.exp(1j*sqrt(3)/2*k1*a-1j*3/2*k2*a)+t1*cmath.exp(-1j*sqrt(3)/2*k1*a-1j*3/2*k2*a) + # h1[0, 1] = h1[1, 0].conj() + #次近邻项 # 对应陈数为-1 h2[0, 0] = t2*cmath.exp(-1j*phi)*(cmath.exp(1j*sqrt(3)*k1*a)+cmath.exp(-1j*sqrt(3)/2*k1*a+1j*3/2*k2*a)+cmath.exp(-1j*sqrt(3)/2*k1*a-1j*3/2*k2*a)) h2[1, 1] = t2*cmath.exp(1j*phi)*(cmath.exp(1j*sqrt(3)*k1*a)+cmath.exp(-1j*sqrt(3)/2*k1*a+1j*3/2*k2*a)+cmath.exp(-1j*sqrt(3)/2*k1*a-1j*3/2*k2*a)) @@ -92,4 +96,4 @@ def main(): if __name__ == '__main__': - main() + main() \ No newline at end of file