Hi,
You are doing everything correctly, and this *should* give the correct
> Dear all,
> Since I used NEGF in my previous study, I want to use Green's function
> in Kwant. I have tried a simple Kwant program to check my understanding
> of "kwant.greens_function" and "lead.selfenergy(energy)", but it gives
> wrong results. I used Fisher-Lee relation to calculate the conductance:
>
> G = kwant.greens_function(sys, energy)
> Gr=G.submatrix(1,0) # r indicates retarded
> Ga=conj((Gr).T) # a indicates advanced
>
> Sigma_Lr =flead0.selfenergy(energy) #r indicates retarded
> Sigma_La =conj((Sigma_Lr).T) #a indicates advanced
>
> Sigma_Rr =flead1.selfenergy(energy)
> Sigma_Ra =conj((Sigma_Rr).T)
>
> Gamma_in =1j*(Sigma_Lr-Sigma_La)
> Gamma_out=1j*(Sigma_Rr-Sigma_Ra)
> #TM=Gamma_out*Gr*Gamma_in*Ga
> TM=Np.dot(Np.dot(Np.dot(Gamma_out,Gr),Gamma_in),Ga) #Fisher-Lee relation
> data.append(real(Np.trace(TM)))
> #Fisher-Lee relation
> Do I do I misunderstand anything? Can you please find my mistakes? My
> Kwant program code is attached at the end of this email. Thanks in advance!
> Best wishes,
> Weiyuan Tong
>
result. The reason it does not is because you have finalized the leads
separately from the system to which they are attached, and then used
these. If you use the finalized leads which are present as part of your
finalized system then you obtain the correct results, i.e instead of:
sys = sys.finalized()
flead0 = lead0.finalized()
flead1 = lead1.finalized()
use:
sys = sys.finalized()
flead0 = sys.leads[0]
flead1 = sys.leads[1]
The reason for this is due to the arbitrary ordering of sites in
finalized systems. The Greens function calculated is defined on the
interface sites of the central region, and the self energy is defined
on interface sites in the lead. Clearly in order to multiply the two
matrices (and for the result to be meaningful) the ordering of the
sites needs to be the same in the two cases. If you finalize the leads
separately then the lead has no way of knowing which way its sites
should be ordered. When you finalize the full system (central region +
leads) kwant takes care to ensure the ordering of the sites is
compatible.
You could also calculate the transmission directly using the
`transmission` method of the `GreensFunction` object ("G" in your
code").
This clearly isn't very intuitive; a significant percentage of issues
that people have posted on this mailing list stem from misunderstanding
/ lack of documentation for the ordering of sites. Any suggestions as
to how this could be made more intuitive are welcome!
Hope that clarifies,
Joe