band_structure.py 1.28 KB
Newer Older
1
2
3
# Tutorial 2.4.1. Band structure calculations
# ===========================================
#
4
5
6
7
8
9
10
11
12
13
# Physics background
# ------------------
#  band structure of a simple quantum wire in tight-binding approximation
#
# Kwant features highlighted
# --------------------------
#  - Computing the band structure of a finalized lead.

import kwant

14
# For plotting.
15
from matplotlib import pyplot
16

17
#HIDDEN_BEGIN_zxip
18
19
def make_lead(a=1, t=1.0, W=10):
    # Start with an empty lead with a single square lattice
20
    lat = kwant.lattice.square(a)
21

22
    sym_lead = kwant.TranslationalSymmetry((-a, 0))
23
24
25
26
    lead = kwant.Builder(sym_lead)

    # build up one unit cell of the lead, and add the hoppings
    # to the next unit cell
Joseph Weston's avatar
Joseph Weston committed
27
    for j in range(W):
28
        lead[lat(0, j)] = 4 * t
29
30

        if j > 0:
31
            lead[lat(0, j), lat(0, j - 1)] = -t
32

33
        lead[lat(1, j), lat(0, j)] = -t
34

35
    return lead
36
#HIDDEN_END_zxip
37
38


39
#HIDDEN_BEGIN_pejz
40
def main():
41
    lead = make_lead().finalized()
42
    kwant.plotter.bands(lead, show=False)
43
44
    pyplot.xlabel("momentum [(lattice constant)^-1]")
    pyplot.ylabel("energy [t]")
45
    pyplot.show()
46
#HIDDEN_END_pejz
47
48
49
50
51
52


# Call the main function if the script gets executed (as opposed to imported).
# See <http://docs.python.org/library/__main__.html>.
if __name__ == '__main__':
    main()