Oscar Erlandsson wrote:
Let's say I want to model a 2D system with 'wide leads' like illustrated in the attached figure, i.e. with leads wider than the scattering region,
It is possible to realize such a system in Kwant. However, one has to respect Kwant’s convention that leads are connected to the scattering region with the same hopping that connects the unit cells within the lead. (We have chosen this convention for simplicity. Note that it does not restrict what systems are possible, since one can always absorb a special connecting hopping into the scattering region.) I notice that this convention is not well explained in [1]. Would you like to help us by improving the documentation? The source file that needs to be changed is kwant/system.py [2].
and use a code like the one provided in the 'tutorial/quantum_wire.py' example.
If I use the code
for j in xrange(W+1): left_lead[lat(0, j)] = 4 * t
and so on, where I have replaced 'W' with 'W+1' then attach_lead gives the error "ValueError: Builder does not interrupt the lead, this lead cannot be attached.".
Kwant’s attach_lead connects the lead by using a “flood fill” [3] approach: Imagine the infinite system that is being attached as an infinite tube. Now the scattering region is superimposed, and a “liquid” is injected into the tube from one of its infinite ends (the “TranslationalSymmetry” defines which). This approach clearly fails if the scattering system does not “stop” the lead. (Again, if you find this to be not well explained in the documentation, as it probably is, we are happy to accept improvements.) But this does not mean that you cannot make a system like the one you drew. You just need to add sites to the scattering region such that the lead will be stopped.
If I try another approach where I initially increase the width of the scattering region, attach the leads with the same width as the scattering region, and then use
for i in xrange(L): del sys[lat(i, W-1)] del sys[lat(i, 0)]
to "peel off" the scattering region edges, sys.finalized() gives me the error "KeyError: Site(kwant.lattice.Monatomic([[1.0, 0.0], [0.0, 1.0]], [0.0, 0.0], ''), array([0, 9]))".
If you had used Kwant 1.1, you would have gotten a more helpful error message: ValueError: Lead 0 is attached to a site that does not belong to the scattering region: <Site [0 9] of <unnamed Monatomic lattice, vectors [1.0 0.0], [0.0 1.0], origin [0.0 0.0]>> Your idea is good, but you should not remove sites to which the lead is attached. The following will work: for i in xrange(1, L-1): del sys[lat(i, W-1)] del sys[lat(i, 0)] Cheers Christoph [1] http://kwant-project.org/doc/1/reference/generated/kwant.system.FiniteSystem... [2] https://gitlab.kwant-project.org/kwant/kwant/blob/master/kwant/system.py [3] https://en.wikipedia.org/wiki/Flood_fill