Re: [Kwant] Conductance for a rectangular geometry

2018-02-24 Thread Abbout Adel
Dear Amrita,

Yes, you can add the two builders as follows:
left_lead1+=left_lead2

but in the new version of kwant, the operator += for builders is
deprecated. So, you better use:

left_lead1.update(left_lead2)
and then you add your missing hopping, before you attach the lead:
left_lead1[(lat(0,0),lat(0,-1))]=t

I don't know why you separate your lead into two parts and then build it
again, but you can get it directly in one shot.

I hope this helps.
Adel

On Fri, Feb 23, 2018 at 10:04 PM, amrita chapagain <
amritachapag...@gmail.com> wrote:

> Thank  you Adel for prompt reply. I have another query here. Can I add
> these two system together incorporating missing hopping elements?
>



-- 
Abbout Adel


Re: [Kwant] Conductance for a rectangular geometry

2018-02-22 Thread Abbout Adel
Dear Amrita,

This is a normal result: your two systems are different. In fact, if you
zoom on your left lead you will see that the upper and the bottom parts of
your lead do not communicate. There are hoppings missing and thus the two
situations are not the same. (check the enclosed figure).

I hope this helps.
Adel

On Thu, Feb 22, 2018 at 2:23 AM, amrita chapagain  wrote:

> Hi,
>
> I want to add two leads on left instead. I have attached two leads and try
> to find conductance and compare with just one lead on left. The results for
> two leads and just one lead is not same. Can you help me what I am doing
> wrong here?
>
> I have attached my code here.
>
> import kwant  # Recursive green function method
> import numpy as np# Module with advanced math commands
> from matplotlib import pyplot
> from numpy import sqrt
> from math import *
>
>
> #==
> # Define the shape ---
> #==
> def wv_shape(pos):
> x, y = pos
> return (np.abs(2.0*x)<=L)&(np.abs(y) #--
>
> a  = 1; # Lattice constant
> t  = 1; # Coupling between sites
> E0L= 0*t# On-site potential in the lead
> L  = 18;  # Length of the
> W1   = 90;  # Width on the left
>
> # Define geometry --
> 
> sys0 = kwant.Builder()
> lat  = kwant.lattice.square(a)
> #---
> -
> # Define onsite energies and couplings  --
> --
> sys0[lat.shape(wv_shape,(0,0))] = E0 # To make all sites the same
> sys0[lat.neighbors()]   = t
> #---
> -
>
> # Left lead 
> --
> left_lead1 = kwant.Builder(kwant.TranslationalSymmetry([-1,0]))   # The
> lead goes to minus infinity
> left_lead2 = kwant.Builder(kwant.TranslationalSymmetry([-1,0]))   # The
> lead goes to minus infinity
> left_lead1[(lat(0,y) for y in range(int(-W1/2+1),0))] = E0L
> left_lead2[(lat(0,y) for y in range(0,int(W1/2)))] = E0L
> left_lead1[lat.neighbors()] = t   #
> Couplings in the lead
> left_lead2[lat.neighbors()] = t   #
> Couplings in the lead
> sys0.attach_lead(left_lead1);
> sys0.attach_lead(left_lead2);
>
> #---
> -
> # Right lead 
> -
> right_lead = kwant.Builder(kwant.TranslationalSymmetry([1,0]))   # The
> lead goes to plus infinity
> right_lead[(lat(0,y) for y in range(int(-W1/2+1),int(W1/2)))] = E0L
> right_lead[lat.neighbors()] = t  #
> Couplings in the lead
> sys0.attach_lead(right_lead);
> #---
> --
> sys = sys0.finalized()
> kwant.plot(sys); # Plots the
> shape
>
>
> def plot_conductance(sys, energies):
>
> data = []
> for energy in energies:
> smatrix = kwant.smatrix(sys, energy)
> data.append(smatrix.transmission(2, 0)+smatrix.transmission(1,2) )
> #transmission from left 2 leads to right lead
>
> pyplot.figure()
> pyplot.plot(energies, data)
> pyplot.xlabel("energy [t]")
> pyplot.ylabel("conductance [e^2/h]")
> pyplot.show()
> energies=[-3+i*0.02 for i in range(100)]
> plot_conductance(sys,energies)
>



-- 
Abbout Adel