update
This commit is contained in:
parent
275a12024d
commit
867d15ae26
@ -3,7 +3,6 @@ This code is supported by the website: https://www.guanjihuan.com
|
||||
The newest version of this code is on the web page: https://www.guanjihuan.com/archives/22604
|
||||
"""
|
||||
|
||||
|
||||
import numpy as np
|
||||
import cmath
|
||||
|
||||
@ -25,24 +24,14 @@ def find_vector_with_fixed_gauge_by_making_one_component_real(vector, precision=
|
||||
vector_1 = np.array([np.sqrt(0.5), np.sqrt(0.5)])*cmath.exp(np.random.uniform(0, 1)*1j)
|
||||
vector_2 = np.array([1, 0])*cmath.exp(np.random.uniform(0, 1)*1j)
|
||||
|
||||
print('\n随机规范的原向量:', vector_1)
|
||||
print('随机规范的原向量:', vector_1)
|
||||
angle = cmath.phase(vector_1[0])
|
||||
print('固定规范后的向量(方法1):', vector_1*cmath.exp(-1j*angle))
|
||||
vector_1 = find_vector_with_fixed_gauge_by_making_one_component_real(vector_1, precision=0.001)
|
||||
print('固定规范后的向量:', vector_1)
|
||||
print('固定规范后的向量(方法2):', vector_1)
|
||||
|
||||
print('\n随机规范的原向量:', vector_2)
|
||||
angle = cmath.phase(vector_2[0])
|
||||
print('固定规范后的向量(方法1):', vector_2*cmath.exp(-1j*angle))
|
||||
vector_2 = find_vector_with_fixed_gauge_by_making_one_component_real(vector_2, precision=0.001)
|
||||
print('固定规范后的向量:', vector_2)
|
||||
|
||||
|
||||
# # 可直接使用Guan软件包来调用以上函数:https://py.guanjihuan.com。
|
||||
# # 安装命令:pip install --upgrade guan。
|
||||
|
||||
# import guan
|
||||
|
||||
# print('\n随机规范的原向量:', vector_1)
|
||||
# vector_1 = guan.find_vector_with_fixed_gauge_by_making_one_component_real(vector_1, precision=0.001)
|
||||
# print('固定规范后的向量:', vector_1)
|
||||
|
||||
# print('\n随机规范的原向量:', vector_2)
|
||||
# vector_2 = guan.find_vector_with_fixed_gauge_by_making_one_component_real(vector_2, precision=0.001)
|
||||
# print('固定规范后的向量:', vector_2)
|
||||
print('固定规范后的向量(方法2):', vector_2)
|
@ -68,11 +68,4 @@ print(eigenvector[:, 1], '\n\n')
|
||||
vector1, vector2 = rotation_of_degenerate_vectors(eigenvector[:, 0], eigenvector[:, 1], precision=0.01, criterion=0.01, show_theta=1)
|
||||
print()
|
||||
print(vector1)
|
||||
print(vector2, '\n')
|
||||
|
||||
|
||||
# # 可直接使用Guan软件包来调用以上函数:https://py.guanjihuan.com。
|
||||
# # 安装命令:pip install --upgrade guan。
|
||||
# import guan
|
||||
# vector1, vector2 = guan.rotation_of_degenerate_vectors(vector1, vector2, index1=None, index2=None, precision=0.01, criterion=0.01, show_theta=0)
|
||||
# hamiltonian = guan.hamiltonian_of_bbh_model(kx, ky, gamma_x=0.5, gamma_y=0.5, lambda_x=1, lambda_y=1)
|
||||
print(vector2, '\n')
|
@ -0,0 +1,63 @@
|
||||
"""
|
||||
This code is supported by the website: https://www.guanjihuan.com
|
||||
The newest version of this code is on the web page: https://www.guanjihuan.com/archives/38466
|
||||
"""
|
||||
|
||||
import numpy as np
|
||||
|
||||
def matrix_00(width):
|
||||
h00 = np.zeros((width, width))
|
||||
for width0 in range(width-1):
|
||||
h00[width0, width0+1] = 1
|
||||
h00[width0+1, width0] = 1
|
||||
return h00
|
||||
|
||||
def matrix_01(width):
|
||||
h01 = np.identity(width)
|
||||
return h01
|
||||
|
||||
def main():
|
||||
width = 2
|
||||
length = 3
|
||||
eta = 1e-2
|
||||
E = 0
|
||||
h00 = matrix_00(width)
|
||||
h01 = matrix_01(width)
|
||||
G_ii_n_array = G_ii_n_with_Dyson_equation_2(width, length, E, eta, h00, h01)
|
||||
for i0 in range(length):
|
||||
# print('G_{'+str(i0+1)+','+str(i0+1)+'}^{('+str(length)+')}:')
|
||||
# print(G_ii_n_array[i0, :, :],'\n')
|
||||
print('x=', i0+1, ':')
|
||||
for j0 in range(width):
|
||||
print(' y=', j0+1, ' ', -np.imag(G_ii_n_array[i0, j0, j0])/np.pi) # 态密度
|
||||
|
||||
def G_ii_n_with_Dyson_equation_2(width, length, E, eta, h00, h01):
|
||||
G_ii_n_array = np.zeros((length, width, width), complex)
|
||||
G_11_1 = np.linalg.inv((E+eta*1j)*np.identity(width)-h00)
|
||||
for i in range(length):
|
||||
G_nn_n_right_minus = G_11_1
|
||||
G_nn_n_left_minus = G_11_1
|
||||
if i!=0:
|
||||
for _ in range(i-1):
|
||||
G_nn_n_right = Green_nn_n(E, eta, h00, h01, G_nn_n_right_minus)
|
||||
G_nn_n_right_minus = G_nn_n_right
|
||||
if i!=length-1:
|
||||
for _ in range(length-i-2):
|
||||
G_nn_n_left = Green_nn_n(E, eta, h00, h01, G_nn_n_left_minus)
|
||||
G_nn_n_left_minus = G_nn_n_left
|
||||
|
||||
if i==0:
|
||||
G_ii_n_array[i, :, :] = np.linalg.inv((E+eta*1j)*np.identity(width)-h00-np.dot(np.dot(h01, G_nn_n_left_minus), h01.transpose().conj()))
|
||||
elif i!=0 and i!=length-1:
|
||||
G_ii_n_array[i, :, :] = np.linalg.inv((E+eta*1j)*np.identity(width)-h00-np.dot(np.dot(h01.transpose().conj(), G_nn_n_right_minus), h01)-np.dot(np.dot(h01, G_nn_n_left_minus), h01.transpose().conj()))
|
||||
elif i==length-1:
|
||||
G_ii_n_array[i, :, :] = np.linalg.inv((E+eta*1j)*np.identity(width)-h00-np.dot(np.dot(h01.transpose().conj(), G_nn_n_right_minus), h01))
|
||||
return G_ii_n_array
|
||||
|
||||
def Green_nn_n(E, eta, H00, V, G_nn_n_minus):
|
||||
dim = H00.shape[0]
|
||||
G_nn_n = np.linalg.inv((E+eta*1j)*np.identity(dim)-H00-np.dot(np.dot(V.transpose().conj(), G_nn_n_minus), V))
|
||||
return G_nn_n
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
x
Reference in New Issue
Block a user