(sorry I send the previous email accidentally before finishing)

...In your case, you are studying the scattering by a simple uniform rectangle, so the modes d not mix. you just need to diagonalize your system in the y direction, and you will get infinite number of 1D systems, each one you can solve it easily.  your conductance is the sum of all the conductances (Actually the sum is an integral   (you need to divide over the number of modes to go from the sum to the Riemann integral))

I hope that this helps

On Tue, Feb 14, 2017 at 2:36 PM, Abbout Adel wrote:
Dear Kristjan,

First, I would like to say that your problem is not very clear. If what you want is to calculate the conductance in the x direction for a system infinite in the x and y directions, you should know that the result is infinite.
you can though define a conductance per mode  T/M but still, to my knowledge,  you can not do it with kwant (wraparound module will help you just to have the 2D band structure).

In your case, you are studying the scattering by a simple unifirme rectangle

On Mon, Feb 13, 2017 at 3:28 PM, Kristjan Eimre wrote:
Hello once again,

Thanks for all the help so far.

In my initial problem, I wanted to calculate the tunneling probability from bulk metal to "bulk" vacuum. The potential landscape is periodic in the "transverse" directions and assuming the free electron model, plane waves should come from the bulk and try to tunnel through the barrier. The main result I want is the tunneling probability dependence on the wave vector or D(k).

At first, I naively though that I could just point the finite-width leads at different angles (different k vectors) at the surface and have a big lead in the vacuum as the output. This doesn't work very well, as the result depends heavily on the size of the leads, orientation of the vacuum lead and on the shape of the scattering region. In the ideal case, I would like the result to be independent of these parameters.

For example, the tunneling probability through the rectangular barrier matches with the analytical case if the scattering region is the same width as the leads, but if I change the shape and/or add periodic boundary conditions, the result doesn't match with the analytical case any more.

I have looked around and found the wraparound module (https://gitlab.kwant-project.org/cwg/wraparound), which looks like it's exactly the thing I need. However the demo code doesn't really illustrate how to calculate transmission with arbitrary k vectors. How should I attach the leads and how to make them also periodic? As the first step, I would like to use this wraparound code on a system of infinite plane of rectangular barrier and reproduce the analytical result (when the incident plane wave is normal to the barrier). Could you give me some advice on how to achieve this?

Best regards,
Kristjan

On Mon, Dec 19, 2016 at 8:15 PM, Abbout Adel wrote:

Dear Kristjan,

>>>  " And the conductance is the sum of the transmission probabilities of the conduction channels, right? "

Yes this is correct.

The number of conducting channels goes to zeros at higher energies because you work in a lattice: the dispersion relation is not anymore E=k^2 .
In a lattice, the dispersion relation for a mode 'm'  is E_m=4t-e_m-2*cos(k)         (where e_m=-2*cos(m*pi/(W+1)))
in order to recover the results of the continuum, you need to work at low energies.

in your case, you need to change the theoretical relation by putting a shift  2-2*cos(pi/(W+1)) for the energies and this will work for the first mode. you need to do the same thing (shift 2-e_m) for the other modes and make a sum of the transmissions to obtain the results for higher modes.

a script is included below to show how we recover the exact result.

I hope that this helps

import kwant
from numpy import sqrt,sin,cos,pi,sinh
# For plotting
from matplotlib import pyplot

def make_system(a=1, t=1.0, W=10, L=30,V0=0):

lat = kwant.lattice.square(a)

sys = kwant.Builder()

sys[(lat(x, y) for x in range(L) for y in range(W))] = 4*t+V0
sys[lat.neighbors()] = -t

#### Define and attach the leads. ####
lead[(lat(0, j) for j in range(W))] = 4 * t

return sys

def plot_conductance(sys, energies):

# Compute conductance
data = []
for energy in energies:
smatrix = kwant.smatrix(sys, energy)
data.append(smatrix.transmission(1, 0))

# pyplot.figure()
pyplot.plot(energies, data,lw=2,label="numerics")
pyplot.xlabel("well depth [t]")
pyplot.ylabel("conductance [e^2/h]")
pyplot.legend()
pyplot.show()

def main():
V0=0.1
sys = make_system(V0=V0)

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

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

e1=2-2*cos(pi/11)    #energy of the first transverse mode
def Cond(E,V0,L=30):
if E-e1-V0<=0:
k=sqrt(-E+e1+V0)
return 1/(1+((V0*sinh(k*L))**2 )/(4*(E-e1)*(-E+e1+V0)))
else:
k=sqrt(E-e1-V0)
return  1/(1+((V0*sin(k*L))**2 )/(4*(E-e1)*(E-e1-V0)))
energies=[0.1+0.001 * i for i in range(300)]
Cond_analytic=[Cond(E,V0) for E in energies]
pyplot.plot(energies,Cond_analytic,"ro",label="analytic")

# We should see conductance steps.
plot_conductance(sys,   energies)

# Call the main function if the script gets executed (as opposed to imported).
if __name__ == '__main__':
main()

On Mon, Dec 19, 2016 at 4:25 PM, Kristjan Eimre wrote:
Hello again,

Thanks for the ideas. I have fiddled around with Kwant a bit now, and I'm trying to recreate quantum tunneling through rectangular potential barrier (see [1] for analytical solution). I have also added a figure of the analytical solution (rect_trans.png), which shows the transmission probability dependence on electron energy.

I modified the 1st tutorial code to include the rectangular barrier (see my code in [2]). I have attached the figures i got from the code (conductance.png and rect_trans.png). If i have understood correctly, then Kwant outputs the conductance depending on excitation energy. And the conductance is the sum of the transmission probabilities of the conduction channels, right?

I probably should delve deep into books on quantum transport to understand some of these things, but perhaps you could give me some answers for a good start. I have also calculated the number of conduction channels, but this goes to 0 at higher energies. Why does this occur? In the simple analytical case, there is no upper bound on electron energies.

Is it even possible to recreate the analytical quantum tunneling result for the rectangle barrier in Kwant?

Best regards,
Kristjan

--