Dear all,

I am learning Kwant through tutorial. My toy model is a two-terminal
quantum wire system based on the square lattice. I want to plot the spatial
local dos for both the scattering region and leads. However, it does not
work for leads part. The following is the code that presents my problem.  I
am wondering whether it is possible to solve this problem with Kwant.

Thanks a lot for any help.

Kind regards,

kuangyia

=============================================================
#!/usr/bin/env python3

import kwant
import numpy as np
import matplotlib.pyplot as plt

def make_system(a=1, t=1.0, W=20, L=50, L_well=10):
    # Start with an empty tight-binding system and a single square lattice.
    # `a` is the lattice constant (by default set to 1 for simplicity.
    lat = kwant.lattice.square(a)
    sys = kwant.Builder()

    #### Define the scattering region and its potential profiel. ####
    def potential(site, pot):
        (x, y) = site.pos
        if (L - L_well) / 2 < x < (L + L_well) / 2:
            return pot
        else:
            return 0

    def onsite(site, pot=0):
        return 4 * t + potential(site, pot)

    sys[(lat(x, y) for x in range(L) for y in range(W))] = onsite
    sys[lat.neighbors()] = -t

    #### Define and attach the leads. ####
    lead = kwant.Builder(kwant.TranslationalSymmetry((-a, 0)))
    lead[(lat(0, j) for j in range(W))] = 4 * t
    lead[lat.neighbors()] = -t
    sys.attach_lead(lead)
    sys.attach_lead(lead.reversed())

    return sys

def main():

    sys = make_system()

    # Check that the system looks as intended.
    kwant.plot(sys)

    # Finalize the system.
    sys = sys.finalized()

    # Calculate ldos at a given energy
    well_depth = 0.55
    ldos = kwant.ldos(sys, energy=0.25, args=[-well_depth])
    kwant.plotter.map(sys, ldos, num_lead_cells=10)

if __name__ == '__main__':
    main()

Reply via email to