Re: [Kwant] Hopping between different lattices and families

2016-11-03 Thread antoniolrm
Hello again everyone, 

Now I have a problem with plotting this system. To make things easier, I used a 
chain lattice, and I want to plot the probability density of the eigenspinors, 
and I am aware that when dealing with a scalar field (1-component spinor) I 
need to order the atomic positions by doing something like 

xs = np.array([i.pos[0] for i in sys.sites]) 
indx = np.argsort(xs) 

and, for a given eigenspinor, ploting the square modulus of the norm wf_sq can 
be node by 

plt.plot(xs[indx], wf_sq[indx]) 
plt.show(). 

But when I add more lattices in the system, the matrix 'xs' becomes a little 
bit confuse. How can I order this to plot wf_sq porperly? 

Best, 
Antônio. 

- Mensagem original -

> De: "Anton Akhmerov" 
> Para: [email protected], [email protected]
> Enviadas: Quinta-feira, 3 de Novembro de 2016 12:54:44
> Assunto: Re: [Kwant] Hopping between different lattices and families

> 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, < [email protected] > wrote:

> > 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" < [email protected] >
> > 
> 
> > > Para: [email protected]
> > 
> 
> > > Cc: [email protected] , "Bas Nijholt" <
> > > [email protected] >, "Camilla Espedal" <
> > > [email protected]
> > > >
> > 
> 
> > > 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, < [email protected] > 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
> > > 
>

Re: [Kwant] Hopping between different lattices and families

2016-11-03 Thread antoniolrm
Hi Joseph, 

No problem! Thanks for your attention anyway. 

Antônio. 

- Mensagem original -

> De: "Joseph Weston" 
> Para: [email protected]
> Cc: "Anton Akhmerov" ,
> [email protected], "Bas Nijholt"
> , "Camilla Espedal" 
> Enviadas: Quinta-feira, 3 de Novembro de 2016 13:06:02
> Assunto: Re: [Kwant] Hopping between different lattices and families

> Hi,

> > Looking at the code you initially posted, it seems that you do not
> > have
> > any spin degree of freedom in your system. This is a necessary
> > condition
> > for Majoranas. Look again more closely at the Hamiltonians from the
> > literature (e.g.
> > https://arxiv.org/abs/1003.1145). You will see that there are two
> > kinds of Pauli matrices (usually denoted with sigma and tau
> > respectively), one which acts on the spin space, and one which acts
> > on
> > the particle-hole space.

> Disregard all this, I looked a bit closer and saw you were using
> Kitaev's model directly

> Sorry for the noise!

> Joe


Re: [Kwant] Hopping between different lattices and families

2016-11-03 Thread antoniolrm
Hi Anton, 

You are right! My bad. Thanks a lot. 

Best, 
Antônio. 

- Mensagem original -

> De: "Anton Akhmerov" 
> Para: [email protected], [email protected]
> Enviadas: Quinta-feira, 3 de Novembro de 2016 12:54:44
> Assunto: Re: [Kwant] Hopping between different lattices and families

> 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, < [email protected] > wrote:

> > 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" < [email protected] >
> > 
> 
> > > Para: [email protected]
> > 
> 
> > > Cc: [email protected] , "Bas Nijholt" <
> > > [email protected] >, "Camilla Espedal" <
> > > [email protected]
> > > >
> > 
> 
> > > 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, < [email protected] > 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" < [email protected] >
> > > > 
&g

Re: [Kwant] Hopping between different lattices and families

2016-11-03 Thread Joseph Weston
Hi,

> Looking at the code you initially posted, it seems that you do not have
> any spin degree of freedom in your system. This is a necessary condition
> for Majoranas. Look again more closely at the Hamiltonians from the 
> literature (e.g.
> https://arxiv.org/abs/1003.1145). You will see that there are two
> kinds of Pauli matrices (usually denoted with sigma and tau
> respectively), one which acts on the spin space, and one which acts on
> the particle-hole space.

Disregard all this, I looked a bit closer and saw you were using
Kitaev's model directly

Sorry for the noise!

Joe


signature.asc
Description: PGP signature


Re: [Kwant] Hopping between different lattices and families

2016-11-03 Thread Joseph Weston
Hi,

> 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. 

Looking at the code you initially posted, it seems that you do not have
any spin degree of freedom in your system. This is a necessary condition
for Majoranas. Look again more closely at the Hamiltonians from the literature 
(e.g.
https://arxiv.org/abs/1003.1145). You will see that there are two
kinds of Pauli matrices (usually denoted with sigma and tau
respectively), one which acts on the spin space, and one which acts on
the particle-hole space.

You can treat all the onsite degrees of freedom on the same footing
by having 4x4 matrix onsites, or you can "split off" the particle-hole
degrees of freedom onto separate lattices, and keep a 2x2 onsite
structure for the spin.

Hope that helps,

Joe


signature.asc
Description: PGP signature


Re: [Kwant] Hopping between different lattices and families

2016-11-03 Thread Anton Akhmerov
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,  wrote:

> 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: *[email protected]
> *Cc: *[email protected], "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: *[email protected], "Bas Nijholt" <
>> [email protected]>
>> *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:[email protected]]
>>> *Sent:* 31. oktober 2016 14:41
>>> *To:* Camilla Esped

Re: [Kwant] Hopping between different lattices and families

2016-11-03 Thread antoniolrm
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. 

- Mensagem original -

> De: "Anton Akhmerov" 
> Para: [email protected]
> Cc: [email protected], "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, < [email protected] > 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" < [email protected] >
> > 
> 
> > > Para: "Camilla Espedal" < [email protected] >
> > 
> 
> > > Cc: [email protected] , "Bas Nijholt" <
> > > [email protected] >
> > 
> 
> > > 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 <
> > > [email protected] > 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: [email protected] ]

Re: [Kwant] Hopping between different lattices and families

2016-11-02 Thread Anton Akhmerov
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: *[email protected], "Bas Nijholt"  >
> *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:[email protected]]
>> *Sent:* 31. oktober 2016 14:41
>> *To:* Camilla Espedal ; Anton Akhmerov <
>> [email protected]>
>>
>> *Cc:* [email protected]
>> *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

Re: [Kwant] Hopping between different lattices and families

2016-10-31 Thread antoniolrm
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. 

- Mensagem original -

> De: "Anton Akhmerov" 
> Para: "Camilla Espedal" 
> Cc: [email protected], "Bas Nijholt"
> 
> 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 <
> [email protected] > 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: [email protected] ]
> 
> > Sent: 31. oktober 2016 14:41
> 
> > To: Camilla Espedal < [email protected] >; Anton Akhmerov <
> > [email protected] >
> 

> > Cc: [email protected]
> 
> > 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 < 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:
> > 
> 
> >

Re: [Kwant] Hopping between different lattices and families

2016-10-31 Thread Anton Akhmerov
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:[email protected]]
> *Sent:* 31. oktober 2016 14:41
> *To:* Camilla Espedal ; Anton Akhmerov <
> [email protected]>
>
> *Cc:* [email protected]
> *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:[email protected]]
> Sent: 31. oktober 2016 12:04
> To: Camilla Espedal 
> Cc: [email protected]
> 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 
> 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:[email protected]]
> > Sent: 31. oktober 2016 11:48
> > To: Camilla Espedal 
> > Cc: [email protected]
> > Subject: Re: [Kwant] Hopping between different lattices and families
> >
> > Hi Camilla,
> >
> > It's exactly lik

Re: [Kwant] Hopping between different lattices and families

2016-10-31 Thread Camilla Espedal
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:[email protected]]
Sent: 31. oktober 2016 14:41
To: Camilla Espedal ; Anton Akhmerov 

Cc: [email protected]
Subject: Re: [Kwant] Hopping between different lattices and families

[https://share.polymail.io/v2/z/a/NTgxNzQ5YTNkNTEz/xUmVK-i26NNEAv--i_LM1Plxebyu8uAoC6DbmD79H5dGTrf-kVfHcrHgZTNWF_OjMz4geOWxyljAMWAlegWTqcgJMJI8eMyXr-Ez8eIHo-gW3HG5GbkpLLAdt_w22PY3DobInlRQhU_v_vUt_PJ9RMFO.png]
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 mailto:camilla%20espedal%20%[email protected]%3e> > 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:[email protected]<mailto:[email protected]>]
Sent: 31. oktober 2016 12:04
To: Camilla Espedal mailto:[email protected]>>
Cc: [email protected]<mailto:[email protected]>
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 
mailto:[email protected]>> 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:[email protected]<mailto:[email protected]>]
> Sent: 31. oktober 2016 11:48
> To: Camilla Espedal mailto:[email protected]>>
> Cc: [email protected]<mailto:[email protected]>
> 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 
> mailto:[email protected]>> 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.subla

Re: [Kwant] Hopping between different lattices and families

2016-10-31 Thread Bas Nijholt
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

<
mailto:Camilla Espedal 
> wrote:

a, pre, code, a:link, body { word-wrap: break-word !important; }

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:
mailto:[email protected]
]

Sent: 31. oktober 2016 12:04

To: Camilla Espedal <
mailto:[email protected]
>

Cc:
mailto:[email protected]
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 <
mailto:[email protected]
> 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:
mailto:[email protected]
]

> Sent: 31. oktober 2016 11:48

> To: Camilla Espedal <
mailto:[email protected]
>

> Cc:
mailto:[email protected]
> 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 <
mailto:[email protected]
> 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

Re: [Kwant] Hopping between different lattices and families

2016-10-31 Thread Camilla Espedal
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:[email protected]] 
Sent: 31. oktober 2016 12:04
To: Camilla Espedal 
Cc: [email protected]
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  
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:[email protected]]
> Sent: 31. oktober 2016 11:48
> To: Camilla Espedal 
> Cc: [email protected]
> 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  
> 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


Re: [Kwant] Hopping between different lattices and families

2016-10-31 Thread Anton Akhmerov
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
 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-description-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:[email protected]]
> Sent: 31. oktober 2016 11:48
> To: Camilla Espedal 
> Cc: [email protected]
> 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  
> 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


Re: [Kwant] Hopping between different lattices and families

2016-10-31 Thread Camilla Espedal
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-description-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:[email protected]] 
Sent: 31. oktober 2016 11:48
To: Camilla Espedal 
Cc: [email protected]
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  
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


Re: [Kwant] Hopping between different lattices and families

2016-10-31 Thread Anton Akhmerov
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
 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