Dear Anton, Thank you very much for the reply.
I implemented the way you suggested (see the following code), i.e., adding extra unit cells from leads to the scattering region. As far as I see, the spatial region for the local dos is indeed extended. However, I am not sure that this local dos is the right one that I want (i.e. for both the scattering and lead regions), since it seems still corresponding to the scattering region. This can be clearly seen from plotting the local dos. Normally, if the added part corresponds to the lead, the local dos in this region should have the plane wave form. Thanks a lot. Best, 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, add_cells=10) sys.attach_lead(lead.reversed(), add_cells=10) 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 welldepth = 0.55 ldos = kwant.ldos(sys, energy=0.25, args=[-welldepth]) kwant.plotter.map(sys, ldos) if __name__ == '__main__': main() On Tue, Sep 19, 2017 at 12:32 AM, Anton Akhmerov < anton.akhmerov...@gmail.com> wrote: > Dear kuangyia, > > The easiest way to resolve your problem is to add several unit cells > from the lead to the scattering region; see "add_cells" argument of > Builder.attach_lead > (https://kwant-project.org/doc/1/reference/generated/ > kwant.builder.Builder#kwant.builder.Builder.attach_lead) > > Best, > Anton > > On Mon, Sep 18, 2017 at 3:09 PM, kuangyia lee <kuangyia....@gmail.com> > wrote: > > 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() > > >