Hi Antonio,
It's not really about Kwant, but rather how you define your system.
Specifically you have forgotten one pairing term. Using
sys[((lat_e(x,y), lat_h(x+1,y)) for x in range(L-1) for y in range(W))] =
Delta
sys[((lat_h(x,y), lat_e(x+1,y)) for x in range(L-1) for y in range(W))] =
-Delta
fixes the problem.
Best,
Anton
On Thu, Nov 3, 2016 at 9:52 AM,
Hi Anton,
I want to implement a p-wave superconductor using two lattices (for electrons and holes). I've done that using Pauli matrices with no problem. The thing is that I expect to get Majorana zero energy modes, but I don't. I belive that the problem is the way that I am defining the pairing, which does not take account for the lat_h(0,0) and lat_e(L,0) positions. I wonder if any of you have some tips to implement this coupling with this approach (two lattices) to get the zero energy modes.
Best, Antônio.
------------------------------
*De: *"Anton Akhmerov"
*Para: *antoniolrm@usp.br *Cc: *kwant-discuss@kwant-project.org, "Bas Nijholt" , "Camilla Espedal" *Enviadas: *Quarta-feira, 2 de Novembro de 2016 22:26:30 *Assunto: *Re: [Kwant] Hopping between different lattices and families
Hi Antonio,
I'm sorry, I don't understand your question. What exactly doesn't work, and what do you want to achieve?
Best, Anton
On Mon, Oct 31, 2016 at 11:52 AM,
wrote: Hello everyone,
I am dealing with exactly the same problem, but in other context (I want to create a one-dimensional p-wave superconductor with two lattices). But the thing is that when I try to implement it just like above, I am neglecting the lat_h(0,y) position, and also losing the lat_e(L,y) position. How can I take this positions without counting two times the "bulk" positions?
def make_system(a=1.0, W=1, L=50, mu=1.0, Delta=1.0, t=1.0): # Start with an empty tight-binding system and two square lattices, # corresponding to electron and hole degree of freedom lat_e = kwant.lattice.square(a=1.0, name='e') lat_h = kwant.lattice.square(a=1.0, name='h')
sys = kwant.Builder()
#### Define the scattering region. #### sys[(lat_e(x, y) for x in range(L) for y in range(W))] = - mu sys[(lat_h(x, y) for x in range(L) for y in range(W))] = mu
# hoppings for both electrons and holes sys[lat_e.neighbors()] = -t sys[lat_h.neighbors()] = t
# Superconducting order parameter enters as hopping between # electrons and holes sys[lat_e(x,y), lat_h(x+1,y) for x in range(L-1) for y in range(W)] = Delta
Cheers. Antônio.
------------------------------
*De: *"Anton Akhmerov"
*Para: *"Camilla Espedal" *Cc: *kwant-discuss@kwant-project.org, "Bas Nijholt" < basnijholt@gmail.com> *Enviadas: *Segunda-feira, 31 de Outubro de 2016 13:22:01 *Assunto: *Re: [Kwant] Hopping between different lattices and families Hi Camilla,
It is straightforward to check whether a site is in the system or if its position is inside the shape: http://nbviewer.jupyter .org/url/antonakhmerov.org/misc/site_in_syst.ipynb
Basically the site that you want is on the border of the shape and doesn't get includes due to using a strict inequality. As an extra remark I recommend not relying on strict vs non-strict inequality behavior due to float variable rounding. This is especially important if you are dealing with lattices with non-integer unit vectors. Instead a more robust solution would be to have e.g. (-a/2 < x < L+a/2) in the shape definition.
Best, Anton
On Mon, Oct 31, 2016 at 9:48 AM, Camilla Espedal
wrote:
Thank you!
That worked, but I still don't see why the last thing I did didn't work?
I added a hopping for two points that were within bounds even if shape_sr started at 1 instead of 0? What am I missing?
Best,
Camilla
*From:* Bas Nijholt [mailto:basnijholt@gmail.com] *Sent:* 31. oktober 2016 14:41 *To:* Camilla Espedal
; Anton Akhmerov < anton.akhmerov@gmail.com> *Cc:* kwant-discuss@kwant-project.org *Subject:* Re: [Kwant] Hopping between different lattices and families
The error message says it all :-)
Using `return ((0 <= x < L) and (0 <= y < W)) ` should fix your problem.
Best, Bas
On Mon, 31 Oct 2016 at 14:29 Camilla Espedal
> wrote: Hi again,
Thanks, I will try to write it more clearly. So the script I use to make the system is:
L = 100 W = 40 a = 1 t = 1
def make_system(W,L,a,t):
# Make the lattices # We define two lattices (up and down) with two sublattices A and B lat_up = kwant.lattice.general([(a,a),(a,-a)],[(0,0),(a,0)], name='up') A_up, B_up = lat_up.sublattices lat_down = kwant.lattice.general([(a,a),(a,-a)],[(0,0),(a,0)], name='down') A_down, B_down = lat_down.sublattices
# Define the shape of the scattering region. Must return true where there are sites. def shape_sr(pos): x, y = pos return ((0 < x < L) and (0 < y < W))
sys = kwant.Builder()
sys[lat_up.shape(shape_sr, (1,1))] = 2 sys[lat_down.shape(shape_sr, (1,1))] = 2
sys[A_up(1,1), A_down(2,1)] = 2
return sys
The error message I get is: KeyError: Site(kwant.lattice.Monoatomic([[1,1], [1,-1]], [0,0]. 'up0'), array([1, 1]))
I can not see why the spot should not be created, because it is within the bounds of shapre_sr.
Thanks,
Best, Camilla
-----Original Message----- From: Anton Akhmerov [mailto:anton.akhmerov@gmail.com] Sent: 31. oktober 2016 12:04 To: Camilla Espedal
Cc: kwant-discuss@kwant-project.org Subject: Re: [Kwant] Hopping between different lattices and families Hi Camilla,
Please double-check the error message that you see.
Your assumption why the code doesn't work is not right: it's possible to add a hopping from any site to any site, regardless of distance or lattices involved. My best guess is that the sites aren't present in the system yet.
As a general advice, when describing a problem try to provide complete information required to reproduce this problem. A script and the error message would be usually useful.
Best, Anton
On Mon, Oct 31, 2016 at 6:58 AM, Camilla Espedal < camilla.espedal@ntnu.no> wrote:
Hi again,
I tried to add
sys[A_up(2,2), B_down(2,2)] = 2
This does not work, and I think it is because A_up and B_down are not only on different sublattices, but on different lattices as well. In the tutorial on superconductors (https://kwant-project.org/doc/1.0/tutorial/tutorial5#lattice-descript ion-using-different-lattices) they define the hopping as
sys[((lat_e(x, y), lat_h(x, y)) for x in range(Deltapos, L) for y in range(W))] = Delta
between the lattices but on the same spatial point. But I want to hop between two different lattices from one point in space to another, if that makes sense.
Best, Camilla
-----Original Message----- From: Anton Akhmerov [mailto:anton.akhmerov@gmail.com] Sent: 31. oktober 2016 11:48 To: Camilla Espedal
Cc: kwant-discuss@kwant-project.org Subject: Re: [Kwant] Hopping between different lattices and families Hi Camilla,
It's exactly like you would expect: syst[A_up(i, j), B_down(i, j)] = value. See e.g. https://kwant-project.org/doc/1/tutorial/tutorial4
Best, Anton
On Mon, Oct 31, 2016 at 6:43 AM, Camilla Espedal < camilla.espedal@ntnu.no> wrote:
Hi,
To explain what I mean. I have a system where I have separated spin-up and spin-down into two lattices (like electron and hole in the example at the kwant site) so that it is would be easier to extract spin-resolved information (G_up/up, Gup/down etc.). In addition, these two lattices consists of two sublattices (A and B). The code is like this
lat_up = kwant.lattice.general([(1,0),(s,c)],[(0,0),(0,1/sqrt(3))], name='up')
A_up, B_up = lat_up.sublattices
lat_down = kwant.lattice.general([(1,0),(s,c)],[(0,0),(0,1/sqrt(3))], name='down')
A_down, B_down = lat_down.sublattices
What I want to do now, is to add a hopping term between say A_up (i,j) and B_down (i.j). So a hopping term between the two different lattices and sublattices. How can I implement this? Or is there a better way to achieve what I want?
Best
Camilla Espedal