from math import pi
import numpy as np
import cupy as cp
from numpy import exp, sqrt
from numpy.linalg import eigh
import matplotlib.pylab as plt
from numba import njit
def tridiag_block_matrix(H, c, u, d):
# c, u, d are center, upper and lower blocks
N, _ = H.shape
n, _ = c.shape
H[0:n, 0:n] = c
for i in range(n, N, n):
H[i:i+n, i:i+n] = c
H[i-n:i, i:i+n] = d
H[i:i+n, i-n:i] = u
return H
def H0_SU4(H, k, t = 1.0):
A = cp.array([[sqrt(3),0,1,exp(-1j*k)],[0,sqrt(3),1,1],[1,1,sqrt(3),0],[exp(1j*k),1,0,sqrt(3)]])
B = cp.array([[0,0,0,0],[0,0,0,0],[1,0,0,0],[0,-1,0,0]])
return tridiag_block_matrix(H, A, B.T, B)
def H0_Graphene(H, k, t = -1):
A = np.array([[0, t*(1+exp(-1j* k))], [t*(1+ exp(1j*k)), 0]])
B = np.array([[0, 0], [t, 0]])
return tridiag_block_matrix(H, A, B, B.T)
def calculated_band(H,
使用cupy优化能带计算
最新推荐文章于 2024-04-14 11:45:30 发布