Dear Anton,
first, let me thank you for your help. I got some problems with it:
1) If I use the "ugly" way, there is an error popping up as soon as I
attach the leads in the manner I wrote in my first mail:
...
lead = kwant.Builder(kwant.TranslationalSymmetry((-1, 0, 0)))
lead[(sublattice(0, y, z) for sublattice in lat.sublattices for y in
xrange(a) for z in xrange(b))] = 4 * t
lead[lat.neighbors()] = -t
sys.attach_lead(lead)
sys.attach_lead(lead.reversed())
...
ERROR: "ValueError: Builder does not interrupt the lead, this lead
cannot be attached."
2) If I use the second way, there is a memory error even before
attaching the leads.
"...
lead = kwant.Builder(kwant.TranslationalSymmetry((-1, 0, 0)))
def lead_shape(pos):
return 0 <= pos[1] < a and 0 <= pos[2] < b
sys[lat.shape(lead_shape, (0, 0, 0))] = 4 * t
lead[lat.neighbors()] = -t"
I dont't know if I'm too stupid/new to kwant/... but I can't solve it.
Best
Julian
> Dear Julian,
>
> Once you execute make_cuboid(), you see the following error message:
>
> 12
> 13 lead = kwant.Builder(kwant.TranslationalSymmetry((-1, 0, 0)))
> ---> 14 lead[(lat(0, j, i) for j in xrange(a) for i in
> xrange(b))] = 4 * t
> 15 lead[lat.neighbors()] = -t
> 16
>
> TypeError: 'Polyatomic' object is not callable
>
> You wrote `lat(0, j, i)`, which is the correct way to deal with
> Monatomic lattices in Kwant. In fact this is just a short hand
> notation for a site of the lattice lat with Bravais vectors 0, j, i.
> If lat was a monatomic lattice, the code you're using would just add a
> bunch of sites of the form lat(0, j, i). In your case lat has several
> sublattices, so `lat(0, j, i)` does not have any meaning in Kwant.
> There are two ways to fix your code. If you want to stick to generator
> expressions [=loops of the form `(f(i) for i in somewhere)`], you can
> write e.g.
>
> lead[(sublattice(0, y, z) for sublattice in lat.sublattices for y in
> xrange(a) for z in xrange(b))] = 4 * t
>
> However, as you see, this becomes ugly. It's better to use shape,
> similarly to the way you defined the scattering region:
>
> def lead_shape(pos):
> return 0 <= pos[1] < a and 0 <= pos[2] < b
>
> sys[lat.shape(lead_shape, (0, 0, 0))] = 4 * t
>
> Note that here the lead_shape doesn't depend on the x-coordinate of
> the site, as required by translation invariance in x-direction. More
> generally, the shape function for the lead should respect the lead
> translational symmetry, or the results may be not what you would
> expect.
>
> I hope this helps,
> Anton
On Mon, May 19, 2014 at 9:39 AM, Julian Schary
<julian.schary(a)stud-mail.uni-wuerzburg.de> wrote:
> Dear all,
>
>
> I'm triying to figure out how to attach symmetrical leads to a 3D zincblende
> -structure in kwant. The code I used so far:
>
> lat = kwant.lattice.general([(0, 0.5, 0.5), (0.5, 0, 0.5), (0.5, 0.5,
> 0)], [(0, 0, 0), (0.25, 0.25, 0.25)])
> a, b = lat.sublattices
> def make_cuboid(t=1.0, a=15, b=10, c=5):
> def cuboid_shape(pos):
> x, y, z = pos
> return 0 <= x < a and 0 <= y < b and 0 <= z < c
>
> sys = kwant.Builder()
> sys[lat.shape(cuboid_shape, (0, 0, 0))] = 4 * t
> sys[lat.neighbors()] = -t
>
> lead = kwant.Builder(kwant.TranslationalSymmetry((-1, 0, 0)))
> lead[(lat(0, j, i) for j in xrange(a) for i in xrange(b))] = 4 * t
> lead[lat.neighbors()] = -t
>
> #sys.attach_lead(lead)
> #sys.attach_lead(lead.reversed())
>
> return sys
>
> causes errors. Could you help me and tell me how to attach the leads in
> 3D,please?
>
> Best regards,
>
> Julian
> Depatment of Physics & Astronomy
> University of Würzburg (Germany)
>