python kwant计算简单方格体系透射率

import kwant
import matplotlib.pyplot as plt


def make_system(a=1, t=1.0, W=10, L=30):
    """搭建体系TB模型哈密顿量"""

    # 搭建device的哈密顿量
    lat = kwant.lattice.square(a)  # a为晶格常数
    syst = kwant.Builder()

    # 设置体系座位能on_site_energy
    syst[(lat(x,y) for x in range(L) for y in range(W))] = 4 * t
    # 设置体系的最近邻hooping
    syst[lat.neighbors()] = -t

    # 搭建左端的left_lead的哈密顿量
    lead = kwant.Builder(kwant.TranslationalSymmetry((-a, 0)))
    # 左端on_site_energy
    lead[(lat(0, j) for j in range(W))] = 4 * t
    # 左端最近邻hooping
    lead[lat.neighbors()] = -t

    # device和lead相连接
    # 与左端相连接
    syst.attach_lead(lead)
    syst.attach_lead(lead.reversed())
    # 返回体系的哈密顿矩阵
    return syst


def plot_conductance(syst, energies):
    """计算透射率"""
    data = []
    for energy in energies:
        # 生成体系的S矩阵
        smatrix = kwant.smatrix(syst, energy)
        # 计算透射率
        data.append(smatrix.transmission(1, 0))

    plt.figure()
    plt.plot(energies, data)
    plt.xlabel("energy [t]")
    plt.ylabel("condutance [e^2/h]")
    plt.show()

def main():
    syst = make_system()
    # 绘制体系模型
    kwant.plot(syst)
    # 完成体系
    syst = syst.finalized()

    # 画透射率图像
    plot_conductance(syst, energies=[0.01*i for i in range(100)])

if __name__ == '__main__':
    main()

你可能感兴趣的:(算法)