Dear Felix,

The current  will not vanish when you put B=0.  You are calculating the contribution of the left lead alone.
The one which vanishes is the measured one at equilibrium. It corresponds to the current you obtain with kwant when you sum the contributions of all the leads and then integrate them over the whole Fermi sea. If one lead is set to a slightly higher potential, then the sum of all the contributions will vanish but a small part of the order ev of that lead, and thus, the current will be proportional to this ev. You can have more details about this in the documentation of Tkwant or the thesis of Joseph Weston for example.

For the sign you are mentioning (between method 1 and 2), it is a global sign, that comes from the way plotter.interpolate returns the result. (usually, the current is calculated on all the hoppings in syst.graph which contains the hoppings (a, b) as well as (b, a))

I hope this helps,
Adel


On Tue, Jun 15, 2021 at 11:44 AM <felixmende2@web.de> wrote:
Dear Adel,

Thank you for your quick reply!

I am sceptical about the results my method 1 yields, because depending on how I define the "cut" function I obtain either a positiv or negativ
current density profil. Furthermore I would expect for zero magnetic field no current density at all and even more critical I would expect vanishing total current (no bias applied). Because the model is totally time reversal symmetric.
I made a minimal example highlighting these differences:
https://github.com/Quaki96/KwantQuestion_2D-current-density-profile-through-3D-nanowire-cut/blob/8e46cebd463e04a1ef9c2c904a4c6c4dc2dea87f/current_density_minimal_example_Method1.ipynb
the only difference here is the definition of the "cut" function either defined as
def cut(site0,site1):       
        return site0.pos[0]==x_cut  and site1.pos[0]==x_cut +1
or as
def cut(site0,site1):       
        return site0.pos[0]==x_cut+1  and site1.pos[0]==x_cut


For the second method. It seems like that the interpolation increases somehow the number of sites, (probably for some interpolation reasons) but I think the labelling modulo some shift is
#field[ x integer lattice position index, y integerlattice position index, z integer lattice position index, vec field].
I agree some explanation or an improved documentation would be really desirable.

Happy Kwanting


Felix


--
Abbout Adel