介观输运, 学术

Kwant库中常用的模块和方法

刚开始使用这个库的时候,需要记很多函数,而且要按照文档中的规则来组建系统。之前多次想放弃使用,感觉自己去写原始代码心里会更踏实点。之后在文献中又多次看到别人在使用这个 Kwant 库,觉得还是可以入手试试,毕竟如果学会了,调用函数计算一些物理量或画一些图还是比较方便的。

入门的例子可以参考:

这里整理了一些常用的 Kwant 库方法,内容不全,主要是参照官方的 API 文档: https://kwant-project.org/doc/ 。

Kwant 里有六个核心模块:

  1. kwant.builder:https://kwant-project.org/doc/1/reference/kwant.builder.html
  2. kwant.lattice:https://kwant-project.org/doc/1/reference/kwant.lattice.html
  3. kwant.plotter:https://kwant-project.org/doc/1/reference/kwant.plotter.html
  4. kwant.solvers:https://kwant-project.org/doc/1/reference/kwant.solvers.html
  5. kwant.operator:https://kwant-project.org/doc/1/reference/kwant.operator.html
  6. kwant.physics:https://kwant-project.org/doc/1/reference/kwant.physics.html

这六个模块中有一些方法比较常用,被定义为高级的方法 (Top level package),可以用 kwant 直接调用。这里列出来:

  1. kwant.builder.Builder 可以直接写成 kwant.Builder。
  2. kwant.lattice.TranslationalSymmetry 可以直接写成 kwant.TranslationalSymmetry 。
  3. kwant.plotter.plot 可以直接写成 kwant.plot。
  4. kwant.solvers.default 中的有:
    • kwant.solvers.default.greens_function 可以直接写成 kwant.greens_function;
    • kwant.solvers.default.ldos 可以直接写成 kwant.ldos;
    • kwant.solvers.default.smatrix 可以直接写成 kwant.smatrix;
    • kwant.solvers.default.wave_function 可以直接写成 kwant.wave_function。

每个模块中都有很多内容,这边只做个简单笔记,不定期更新和补充。

一、kwant.builder

该模块是整个体系的最高级别(High-level construction of systems)。

1. kwant.builder.Builder(或 kwant.Builder)

  • syst = kwant.Builder() # 定义一个 Builder 对象
  • syst.attach_lead() # Builder 对象的 attach_lead 方法,加电极
  • syst = syst.finalized() # Builder 对象的 finalized 方法,返回可解的样本
  • syst.hamiltonian_submatrix() # 获取哈密顿量

2. kwant.builder.Site

3. kwant.builder.HoppingKind

4. kwant.builder.SimpleSiteFamily

5. kwant.builder.BuilderLead

6. kwant.builder.SelfEnergyLead

7. kwant.builder.ModesLead

二、kwant.lattice

该模块用来制作布拉菲格子 (Bravais lattices)。

1. kwant.lattice.TranslationalSymmetry ( 或 kwant.TranslationalSymmetry )

2. kwant.lattice.general

3. kwant.lattice.Monatomic

4. kwant.lattice.Polyatomic

此外,Kwant库提供了几个现成的布拉菲格子 (library of lattices):

  • kwant.lattice.chain 一维链
  • kwant.lattice.square 方格子
  • kwant.lattice.cubic 立方格子
  • kwant.lattice.triangular 三角格子
  • kwant.lattice.honeycomb 蜂窝格子
  • kwant.lattice.kagome 笼目格子

三、kwant.plotter

该模块用来画图(Plotting of systems)。

1. kwant.plotter.plot(或 kwant.plot)

2. kwant.plotter.map

3. kwant.plotter.current

4. kwant.plotter.bands

5. kwant.plotter.spectrum

6. kwant.plotter.streamplot

四、kwant.solvers

该模块是计算一些物理量的库(Library of solvers)

1. kwant.solvers.default.smatrix(或 kwant.smatrix)

2. kwant.solvers.default.greens_function(或 kwant. greens_function)

3. kwant.solvers.default.wave_function(或 kwant. wave_function)

4. kwant.solvers.default.ldos(或 kwant.ldos)

5. kwant.solvers.common.SMatrix

6. kwant.solvers.common.GreensFunction

五、kwant.operator

该模块计算一些算符和可观测量(Operators and Observables)。

1. kwant.operator.Density

2. kwant.operator.Current

3. kwant.operator.Source

六、kwant.physics

该模块包括了一些和物理有关的算法(Physics-related algorithms)。

1. kwant.physics.Bands

2. kwant.physics.modes

3. kwant.physics.selfenergy

4. kwant.physics.two_terminal_shotnoise

5. kwant.physics.PropagatingModes

6. kwant.physics.StabilizedModes

评论功能已关闭,以下留言为历史存档,仅供查看。