发布时间:2019年11月1日2023年2月25日 最近修改时间:2023年2月25日
准一维的方格子哈密顿量(以宽度3为例)为
![Rendered by QuickLaTeX.com \begin{aligned}H=&\sum_{x, \langle y, y' \rangle}|x, y \rangle \langle x, y'|+\sum_{\langle x, x' \rangle, y} |x, y \rangle \langle x', y|\\=&\sum_{x}\begin{pmatrix} |x, 0 \rangle, |x, 1 \rangle, |x, 2 \rangle \end{pmatrix}\begin{pmatrix}0 & t & 0\\t & 0 & t\\0 & t &0\\\end{pmatrix}\begin{pmatrix} \langle x,0| \\ \langle x,1| \\ \langle x,2|\end{pmatrix}\\+& \sum_{\langle x, x' \rangle}\begin{pmatrix} |x, 0 \rangle, |x, 1 \rangle, |x, 2 \rangle \end{pmatrix}\begin{pmatrix}t & 0 & 0\\0& t & 0\\0 & 0 &t\\\end{pmatrix}\begin{pmatrix} \langle x',0| \\ \langle x',1| \\ \langle x',2|\end{pmatrix}\end{aligned}](https://www.guanjihuan.com/wp-content/ql-cache/quicklatex.com-70781ec9656b186c55a3d6d884ed7fdc_l3.png)
在上面最后的表达式中,第一项是H00,表示的是元胞内部的哈密顿量矩阵;第二项是H01,表示的是元胞间的跃迁矩阵。
1. 给出全部算法的代码
这里给出“用非平衡格林函数计算准一维方格子电导”的Python代码,相关公式见参考资料。其中用到戴森方程,格林函数 公式参考这篇:利用Dyson方程迭代方法计算态密度(附Python代码)。
"""
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/948
"""
import numpy as np
import matplotlib.pyplot as plt
import copy
import time
def matrix_00(width=10): # 不赋值时默认为10
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=10): # 不赋值时默认为10
h01 = np.identity(width)
return h01
def main():
start_time = time.time()
h00 = matrix_00(width=5)
h01 = matrix_01(width=5)
fermi_energy_array = np.arange(-4, 4, .01)
plot_conductance_energy(fermi_energy_array, h00, h01)
end_time = time.time()
print('运行时间=', end_time-start_time)
def plot_conductance_energy(fermi_energy_array, h00, h01): # 画电导与费米能关系图
dim = fermi_energy_array.shape[0]
cond = np.zeros(dim)
i0 = 0
for fermi_energy0 in fermi_energy_array:
cond0 = np.real(conductance(fermi_energy0 + 1e-12j, h00, h01))
cond[i0] = cond0
i0 += 1
plt.plot(fermi_energy_array, cond, '-k')
plt.show()
def transfer_matrix(fermi_energy, h00, h01, dim): # 转移矩阵T。dim是传递矩阵h00和h01的维度
transfer = np.zeros((2*dim, 2*dim), dtype=complex)
transfer[0:dim, 0:dim] = np.dot(np.linalg.inv(h01), fermi_energy*np.identity(dim)-h00) # np.dot()等效于np.matmul()
transfer[0:dim, dim:2*dim] = np.dot(-1*np.linalg.inv(h01), h01.transpose().conj())
transfer[dim:2*dim, 0:dim] = np.identity(dim)
transfer[dim:2*dim, dim:2*dim] = 0 # a:b代表 a
Published by guanjihuan
View all posts by guanjihuan
|