Tibor Sekera wrote:

> Because one of the leads is translationally invariant along x
> direction, while the other one along y direction, I need to
> interpolate between two different gauge choices.
>
> Is there an easy (universal) way to do this?

No, there is no support for this in Kwant.  We have been thinking about
it, but this is one of the many useful additions that no one yet had the
time to implement.

A contribution would be very welcome.  Of course, we are happy to
discuss, accompany and help!

I attach an example script that demonstrates magnetic field and leads
with different directions.  Feel free to use it at will.

import kwant, numpy
From math import cos, sin
import matplotlib.pyplot as plt

lat = kwant.lattice.square()


def phase_x(a, b):
    ap = a.pos
    bp = b.pos
    phase = -B * (0.5 * (ap[1] + bp[1]) * (bp[0] - ap[0]))
    return -complex(cos(phase), sin(phase))


def gauge_x_to_y(s):
    return numpy.prod(s.pos)


def phase_y(a, b):
    ap = a.pos
    bp = b.pos
    phase = -B * (0.5 * (ap[1] + bp[1]) * (bp[0] - ap[0])
                  + gauge_x_to_y(a) - gauge_x_to_y(b))
    return -complex(cos(phase), sin(phase))


def gauge_scatreg(s):
    return gauge_x_to_y(s) if s in gauge_transformed_sites else 0


def phase_scatreg(a, b):
    ap = a.pos
    bp = b.pos
    phase = -B * (0.5 * (ap[1] + bp[1]) * (bp[0] - ap[0])
                  + gauge_scatreg(a) - gauge_scatreg(b))
    return -complex(cos(phase), sin(phase))


def make_lead(direction, width, r0, phase):
    lead = kwant.Builder(kwant.TranslationalSymmetry(lat.vec(direction)))
    lead[( lat(r0[0] - i * direction[1], r0[1] + i * direction[0])
           for i in range(width) )] = 4
    lead[lat.neighbors()] = phase
    return lead


def main(E=1):
    global B, gauge_transformed_sites

    sys = kwant.Builder()
    sys[( lat(x,y) for x in range(40) for y in range(40)
          if y > 19 - abs(x-17) )] = 4
    sys[lat.neighbors()] = phase_scatreg
    sys.attach_lead(make_lead((1, 0), 18, (50, 0), phase_x))
    sys.attach_lead(make_lead((-1, 0), 20, (50, 23), phase_x))
    sys.attach_lead(make_lead((0, 1), 18, (19, 0), phase_y))
    kwant.plot(sys)
    sys = sys.finalized()

    gauge_transformed_sites = set(sys.sites[i] for i in sys.lead_interfaces[2])

    Bs = numpy.arange(-0.21, 0.5, 0.01)
    conds = []
    for B in Bs:
        cond = kwant.smatrix(sys, E).transmission(1, 0)
        conds.append(cond)
        print(B, cond)

    ax = plt.figure().add_subplot(1, 1, 1)
    ax.plot(Bs, conds)
    plt.show()


if __name__ == '__main__':
    main()

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to