Dear Sir,
I am a PhD student of Hong Kong University of Science and Technology. I
want to use KWANT to caculate Hall resistance of a Hall bar structure.We
can get the conductance between 6 electrodes, but how to get hall
resistance? Can you give me some help? Thank you very much.
Best Regards,
Zhang Bing

Dear all,
I am using kwant to calculate the transmission of a bulk system. I use "
sys = kwant.wraparound.wraparound(sys) and lead =
kwant.wraparound.wraparound(lead, keep=0)" to change my tight-binding
ribbon system to a bulk system. The transmission is obtained using:
kys = np.arange(-0.5, 0.5, 0.001)
for ky in kys:
smatrix = kwant.smatrix(sys, energy, [ky])
transmission.append(smatrix.transmission(1, 0))
I want to obtain the Transmission vs the incident angle of an electron, and
I also need to do the integration ∫T(ky, E) dky or ∫T(θ,E)cosθdθ. I do not
undstand the ky in the system with kwant.wraparoun, what is the unit of ky,
what is k here for the system. Can you give me some advices on this?Thanks
in advance. The definition of incident angle is shown in the attached
Fig.1， the band structure for my bulk system is shown in attached Fig.2 and
the Tranmission vs ky is shown in Fig.3 (I do not know how the set the
values for ky).
Regards,
Hosein Khani

Dear all,
Now I am trying to understand kwant specially for hexagonal structure.
If you look at my code as the following,
import kwant
import matplotlib.pyplot as plt
import math
d=1.42;
a1=d*math.sqrt(3);
t=-0.033;
latt = kwant.lattice.general([(a1,0),(a1*0.5,a1*math.sqrt(3)/2)],
[(a1/2,-d/2),(a1/2,d/2)])
a,b = latt.sublattices
syst= kwant.Builder()
#...................................................................................
def rectangle(pos):
x, y = pos
z=x**2+y**2
return -4.75*a1<x<4.75*a1 and -8*d<y<8*d
syst[latt.shape(rectangle, (1,1))]=0
def delet(pos):
x, y = pos
z=x**2+y**2
return z<(1*a1)**2
del syst[latt.shape(delet, (1,1))]
#nearest
neighbors.............................................................
syst[[kwant.builder.HoppingKind((0,0),a,b)]] =t
syst[[kwant.builder.HoppingKind((0,1),a,b)]] =t
syst[[kwant.builder.HoppingKind((-1,1),a,b)]] =t
sym = kwant.TranslationalSymmetry(latt.vec((-4,0)))
sym.add_site_family(latt.sublattices[0], other_vectors=[(-1, 2)])
sym.add_site_family(latt.sublattices[1], other_vectors=[(-1, 2)])
lead = kwant.Builder(sym)
def lead_shape(pos):
x, y = pos
return -8*d<y<8*d
lead[latt.shape(lead_shape, (1,1))] = 0
def delet_lead(pos):
x, y = pos
z=x**2+y**2
return z<(1*a1)**2
del lead[latt.shape(delet_lead, (1,1))]
lead[[kwant.builder.HoppingKind((0,0),a,b)]] =t
lead[[kwant.builder.HoppingKind((0,1),a,b)]] =t
lead[[kwant.builder.HoppingKind((-1,1),a,b)]] =t
syst.attach_lead(lead,add_cells=3)
syst.attach_lead(lead.reversed(),add_cells=3)
ax=kwant.plot(syst);
I used
sym.add_site_family(latt.sublattices[0], other_vectors=[(2,1)])
sym.add_site_family(latt.sublattices[1], other_vectors=[(2,1)])
but I do not exactly why I used these vectors. These vectors are for
zigzag nanoribbon, can we use them for armchair nanoribbon?
Do you know any information about an armchair nanoribbon?
Best,
Nafise
On Thu, Oct 31, 2019 at 1:08 AM Adel Belayadi <adelphys(a)gmail.com> wrote:
> Hey naffisse.
> Sure!. I have prepared a detailed explanation with codes as illustrations.
> Please ask the question publicly (I mean add kwant.discuss) and I will
> answer you so maybe others will benefit and my efforts would be fruitful
> for others.
> Waiting you question again
> Regards
>
> Le mar. 22 oct. 2019 à 14:03, Nafise Nouri <nafise.nour(a)gmail.com> a
> écrit :
>
>> Hi Adel,
>>
>> Of course, maybe in future we can have a good collaboration. Now I am
>> trying to understand kwant specially for hexagonal structure.
>>
>> If you look at my code in the proviso emails, I used
>> sym.add_site_family(latt.sublattices[0], other_vectors=[(2,1)])
>> sym.add_site_family(latt.sublattices[1], other_vectors=[(2,1)])
>> but I do not exactly why I used these vectors. These vectors are for
>> zigzag nanoribbon, can we use them for armchair nanoribbon?
>> Do you know any information about an armchair nanoribbon?
>>
>> Best,
>> Nafise
>>
>> On Mon, Oct 21, 2019 at 10:17 PM Adel Belayadi <adelphys(a)gmail.com>
>> wrote:
>>
>>> Hello Nafise
>>> Sorry for my late reply.Yes, that is correct.
>>> About the result, my be because of the tight-binding parameters, or due
>>> to the masse terme (inversion symmetry) or other things such as SOC.
>>> I connot help from now thing. maybe if you email the paper would be
>>> better.
>>> If you are interested in collaboration, I am willing to work and
>>> collaborate.
>>> Best regards, Adel
>>>
>>> Le mer. 16 oct. 2019 à 09:42, Nafise Nouri <nafise.nour(a)gmail.com> a
>>> écrit :
>>>
>>>> Dear Adel Belayadi
>>>>
>>>> That is very kind of you for your explanation.
>>>> As I understand that the definition of limitation of scattering
>>>> region in direction of x (the direction that we exert periodic border
>>>> condition, here is x direction) is not important because the number of
>>>> symmetry vector defines the limitation of x direction in the scattering
>>>> region. Am I right?
>>>>
>>>> I am trying to reproduce of the result of a article for graphene
>>>> nanoribbon with hole, the shape of structure in kwant is OK,but the band
>>>> structure is not the same as article's. I do not know where is the problem.
>>>>
>>>> Best,
>>>> Nafise
>>>>
>>>> On Fri, Oct 11, 2019 at 11:22 PM Adel Belayadi <adelphys(a)gmail.com>
>>>> wrote:
>>>>
>>>>> Hey again,
>>>>>
>>>>> I am so glad that my contribution was beneficial to you.
>>>>>
>>>>> *1- * *Why did you choose a new super cell. What is a problem when we
>>>>> use honeycomb unit cell?*
>>>>>
>>>>> In fat, it is the same thing since we have (i) a finite system and
>>>>> (ii) the obtained system has the honeycomb shape
>>>>>
>>>>> whether using honeycomb lattice or the provides supercell.
>>>>>
>>>>> In fact, the supercell where created carefully to provide the same
>>>>> shape of honeycomb lattice.
>>>>>
>>>>> However, if the case of a periodic system, the use of supercell will
>>>>> be wrong since the number of atom in the unit cell is a key factor.
>>>>>
>>>>> *2-If we change symmetry vector (for **example try it by simple
>>>>> graphene nanoribbon) some physical properties like*
>>>>>
>>>>> * band structure IS changed? why does it happen?*
>>>>>
>>>>> I have small experience in kwant since I am a new user, but
>>>>> technically let us say:
>>>>>
>>>>> (a) The lead is considered as an infinite system, so the number of
>>>>> atom in the unit cell should be carefully selected or we will get extra
>>>>> usefulness
>>>>>
>>>>> modes in bands. For example, In the case of perfect lead, we do have
>>>>> to set sym = kwant.TranslationalSymmetry(Super_cell_latt.vec((Num=-1,0)))
>>>>>
>>>>> since for Num =1 is the primitive unit cell which provide the whole
>>>>> lead. However, If we set (Num=-2 or more), we will get the same lead
>>>>>
>>>>> but with non primitive cell (or let's say Conventional lattice). In
>>>>> this case, you will get extract evanescent and propagating modes
>>>>> which are unnecessary.
>>>>>
>>>>>
>>>>> (b) in your case the lead is not perfect since it contains some holes
>>>>> in. For this reason you have to define Conventional lattice or shape which
>>>>> provide
>>>>>
>>>>> or insure periodicity to get the whole lead.
>>>>>
>>>>>
>>>>> Please see attached Pdf.file to have an idea about primitive cell and
>>>>> conventional cell (see the fcc case).
>>>>>
>>>>>
>>>>> Ps1 few examples of bands using primitive and conventional unit cell
>>>>>
>>>>>
>>>>> ### Primitive unit cell where Num is set to -1. Here 6 bands are found
>>>>>
>>>>> import kwant
>>>>>
>>>>> import matplotlib.pyplot as plt
>>>>>
>>>>> import math
>>>>>
>>>>>
>>>>> d=1.42;
>>>>>
>>>>> a1=d*math.sqrt(3);
>>>>>
>>>>> t=-0.033;
>>>>>
>>>>> latt = kwant.lattice.general([(a1,0),(a1*0.5,a1*math.sqrt(3)/2)],
>>>>>
>>>>> [(a1/2,-d/2),(a1/2,d/2)])
>>>>>
>>>>> a,b = latt.sublattices
>>>>>
>>>>> syst= kwant.Builder()
>>>>>
>>>>> def lead_shape(pos):
>>>>>
>>>>> return -3<pos[1]<3
>>>>>
>>>>> Num = -1
>>>>>
>>>>> sym = kwant.TranslationalSymmetry(latt.vec((Num,0)))
>>>>>
>>>>> sym.add_site_family(latt.sublattices[0], other_vectors=[(-1, 2)])
>>>>>
>>>>> sym.add_site_family(latt.sublattices[1], other_vectors=[(-1, 2)])
>>>>>
>>>>> lead = kwant.Builder(sym)
>>>>>
>>>>>
>>>>> lead[latt.shape(lead_shape, (1,1))] = 0
>>>>>
>>>>> lead[[kwant.builder.HoppingKind((0,0),a,b)]] =t
>>>>>
>>>>> lead[[kwant.builder.HoppingKind((0,1),a,b)]] =t
>>>>>
>>>>> lead[[kwant.builder.HoppingKind((-1,1),a,b)]] =t
>>>>>
>>>>> kwant.plot(lead)
>>>>>
>>>>> plt.show()
>>>>>
>>>>>
>>>>> ## The unit cell of the lead is composed of 6 atoms, hence 6 bands
>>>>> could be find
>>>>>
>>>>> lead_Num1 = lead.finalized()
>>>>>
>>>>> kwant.plotter.bands(lead_Num1, show=False)
>>>>>
>>>>> plt.xlabel("momentum [(lattice constant)^-1]")
>>>>>
>>>>> plt.ylabel("energy [t]")
>>>>>
>>>>> plt.show()
>>>>>
>>>>>
>>>>>
>>>>> ## the conventional unit cell where Num is set to -2. Here 6*2=12
>>>>> bands are found. We have 6 extrat bands which have nothing
>>>>>
>>>>> ##to do in the case of a perfect lead
>>>>>
>>>>> import kwant
>>>>>
>>>>> import matplotlib.pyplot as plt
>>>>>
>>>>> import math
>>>>>
>>>>>
>>>>> d=1.42;
>>>>>
>>>>> a1=d*math.sqrt(3);
>>>>>
>>>>> t=-0.033;
>>>>>
>>>>> latt = kwant.lattice.general([(a1,0),(a1*0.5,a1*math.sqrt(3)/2)],
>>>>>
>>>>> [(a1/2,-d/2),(a1/2,d/2)])
>>>>>
>>>>> a,b = latt.sublattices
>>>>>
>>>>> syst= kwant.Builder()
>>>>>
>>>>> def lead_shape(pos):
>>>>>
>>>>> return -3<pos[1]<3
>>>>>
>>>>> Num = -2
>>>>>
>>>>> sym = kwant.TranslationalSymmetry(latt.vec((Num,0)))
>>>>>
>>>>> sym.add_site_family(latt.sublattices[0], other_vectors=[(-1, 2)])
>>>>>
>>>>> sym.add_site_family(latt.sublattices[1], other_vectors=[(-1, 2)])
>>>>>
>>>>> lead = kwant.Builder(sym)
>>>>>
>>>>>
>>>>> lead[latt.shape(lead_shape, (1,1))] = 0
>>>>>
>>>>> lead[[kwant.builder.HoppingKind((0,0),a,b)]] =t
>>>>>
>>>>> lead[[kwant.builder.HoppingKind((0,1),a,b)]] =t
>>>>>
>>>>> lead[[kwant.builder.HoppingKind((-1,1),a,b)]] =t
>>>>>
>>>>> kwant.plot(lead)
>>>>>
>>>>> plt.show()
>>>>>
>>>>>
>>>>> ## The unit cell of the lead is composed of 6*2 atoms, hence 6 bands
>>>>> could be find
>>>>>
>>>>> lead_Num1 = lead.finalized()
>>>>>
>>>>> kwant.plotter.bands(lead_Num1, show=False)
>>>>>
>>>>> plt.xlabel("momentum [(lattice constant)^-1]")
>>>>>
>>>>> plt.ylabel("energy [t]")
>>>>>
>>>>> plt.show()
>>>>>
>>>>>
>>>>>
>>>>> Ps2 few examples of bands using honycomb or supper celll
>>>>>
>>>>>
>>>>> ##In the following we will compare the your honycombe lattice Num =-1
>>>>> and the proposed supper cell.
>>>>>
>>>>> ##You will see that we will get the same results in terms of bands
>>>>>
>>>>>
>>>>> import kwant
>>>>>
>>>>> import matplotlib.pyplot as plt
>>>>>
>>>>> from math import sqrt
>>>>>
>>>>>
>>>>> d = 1.42;
>>>>>
>>>>> t=-0.033;
>>>>>
>>>>> ## So let us start
>>>>>
>>>>> a1 = d*sqrt(3);
>>>>>
>>>>> a2 = 3*d;
>>>>>
>>>>> primitive_vector_1 = (a1, 0);
>>>>>
>>>>> primitive_vector_2 = (0, a2);
>>>>>
>>>>> ### here premitive vectors are perpondicular:
>>>>> primitive_vector_1.primitive_vector_1 = 0
>>>>>
>>>>>
>>>>> ## Now let us define the atoms positions of the unit cell
>>>>>
>>>>> Pos_A1 = ( 0, -d/2)
>>>>>
>>>>> Pos_B1 = ( 0, d/2)
>>>>>
>>>>> Pos_A2 = ( a1/2, d)
>>>>>
>>>>> Pos_B2 = ( a1/2, 2*d)
>>>>>
>>>>>
>>>>> Super_cell_latt = kwant.lattice.general([primitive_vector_1,
>>>>> primitive_vector_2],
>>>>>
>>>>> [Pos_A1, Pos_B1, Pos_A2, Pos_B2])
>>>>>
>>>>> Sub_A1, Sub_B1, Sub_A2, Sub_B2 = Super_cell_latt.sublattices
>>>>>
>>>>>
>>>>> syst= kwant.Builder()
>>>>>
>>>>> Num = -1;
>>>>>
>>>>> sym = kwant.TranslationalSymmetry(Super_cell_latt.vec((Num,0)))
>>>>>
>>>>> lead = kwant.Builder(sym)
>>>>>
>>>>>
>>>>> def lead_shape(pos):
>>>>>
>>>>> return -3<pos[1]<3
>>>>>
>>>>>
>>>>> lead[Super_cell_latt.shape(lead_shape, (1,1))] = 0
>>>>>
>>>>>
>>>>>
>>>>> ## =========================================================
>>>>>
>>>>> ## Hopping within unit cell ================================
>>>>>
>>>>> lead[[kwant.builder.HoppingKind((0,0),Sub_A1,Sub_B1)]] = t
>>>>>
>>>>> lead[[kwant.builder.HoppingKind((0,0),Sub_B1,Sub_A2)]] = t
>>>>>
>>>>> lead[[kwant.builder.HoppingKind((0,0),Sub_A2,Sub_B2)]] = t
>>>>>
>>>>> ## Hopping between neighbouring unit cell=======================
>>>>>
>>>>> lead[[kwant.builder.HoppingKind((+1, +1),Sub_A1,Sub_B2)]] = t
>>>>>
>>>>> lead[[kwant.builder.HoppingKind(( 0, +1),Sub_A1,Sub_B2)]] = t
>>>>>
>>>>> lead[[kwant.builder.HoppingKind((+1, 0),Sub_B1,Sub_A2)]] = t
>>>>>
>>>>>
>>>>> kwant.plot(lead)
>>>>>
>>>>> plt.show()
>>>>>
>>>>>
>>>>> ## The unit cell of the lead is composed of 6 atoms, hence 6 bands
>>>>> could be find
>>>>>
>>>>> lead_Num1 = lead.finalized()
>>>>>
>>>>> kwant.plotter.bands(lead_Num1, show=False)
>>>>>
>>>>> plt.xlabel("momentum [(lattice constant)^-1]")
>>>>>
>>>>> plt.ylabel("energy [t]")
>>>>>
>>>>> plt.show()
>>>>>
>>>>> Le ven. 11 oct. 2019 à 09:24, Nafise Nouri <nafise.nour(a)gmail.com> a
>>>>> écrit :
>>>>>
>>>>>> Dear Adel Belayadi
>>>>>> Thank you so much for your benefit response. But I did not
>>>>>> understand completely. Why did you choose a new super cell? What is a
>>>>>> problem when we use honeycomb unit cell?
>>>>>>
>>>>>> Also I have one more question, That is very kind of you if you help m:
>>>>>> * If we change symmetry vector (for **example** try it by simple
>>>>>> graphene nanoribbon) some physical properties like band structure IS
>>>>>> changed? why does it happen?*
>>>>>> * Do you know what is the concept of symmetry vector in kwant?*
>>>>>>
>>>>>> *Thank you in advance for your help.*
>>>>>>
>>>>>> *Best wishes,*
>>>>>> *Nafise*
>>>>>>
>>>>>> On Fri, Oct 11, 2019 at 3:56 AM Adel Belayadi <adelphys(a)gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Dear Abbout, Josef and Nafiss,
>>>>>>>
>>>>>>> Good day. As it was stated by Mr. Abbout adel, it seems somehow
>>>>>>> tricky to do it. In my point of view this is because we are dealing with no
>>>>>>> orthogonal primitive vectors.
>>>>>>> I have fixed this issue by ussing orthogonal primitive vectors.
>>>>>>> However in this case, we have to use super-cell instead of a simple
>>>>>>> honeycomb lattice.
>>>>>>>
>>>>>>> Please, In the script bellow we will find the code.In the comment, a
>>>>>>> little explanation of each part of the code is provided. Additionally, you
>>>>>>> might find the enclosed file which contains the python script of the code.
>>>>>>>
>>>>>>> On think to care about. In the
>>>>>>> sym = kwant.TranslationalSymmetry(Super_cell_latt.vec((-Num,0))),
>>>>>>> Num should be carefully chosen since it depends on the boundaries
>>>>>>> rectangle shape.
>>>>>>>
>>>>>>> Finally, If you need to have only two families in the plot. Simply
>>>>>>> use
>>>>>>>
>>>>>>> def family_colors(site): return 0 or give a color you like if
>>>>>>> site.family == Sub_A1 or Sub_A2 else 1 or give another color you like
>>>>>>>
>>>>>>> Finally, I hope this is useful for you. Here you are the script
>>>>>>>
>>>>>>>
>>>>>>> #############################################################################################
>>>>>>>
>>>>>>> ### I think to solve the problem we need to creat supercell with
>>>>>>> orthogonal primitive vector
>>>>>>> import kwant
>>>>>>> import matplotlib.pyplot as plt
>>>>>>> from math import sqrt
>>>>>>>
>>>>>>> d = 1.42;
>>>>>>> hbar_square_over_m = 7.62
>>>>>>> Ep = -11.07;
>>>>>>> Vpppi = -0.63*hbar_square_over_m*(1/d)*2
>>>>>>>
>>>>>>> ## In the following, we will define a super cell of 4 atoms
>>>>>>> ## we define four atoms in the unit cell where A2 equivalent(==) to
>>>>>>> A1 and B2==B1.
>>>>>>> ## Bear in minde that this kind ofthinking is generally used in
>>>>>>> python as aliases
>>>>>>> ## In kwant i dont know how to use aliases but we will assume the A2
>>>>>>> and A1 have the same on-site energy
>>>>>>> ## (or let us say the same familly). Also the the B2 and B1 have the
>>>>>>> same on-site energy
>>>>>>>
>>>>>>> ## So let us start
>>>>>>> a1 = d*sqrt(3);
>>>>>>> a2 = 3*d;
>>>>>>> primitive_vector_1 = (a1, 0);
>>>>>>> primitive_vector_2 = (0, a2);
>>>>>>> ### here premitive vectors are perpondicular:
>>>>>>> primitive_vector_1.primitive_vector_1 = 0
>>>>>>>
>>>>>>> ## Now let us define the atoms positions of the unit cell
>>>>>>> Pos_A1 = ( 0, -d/2)
>>>>>>> Pos_B1 = ( 0, d/2)
>>>>>>> Pos_A2 = ( a1/2, d)
>>>>>>> Pos_B2 = ( a1/2, 2*d)
>>>>>>>
>>>>>>>
>>>>>>> Super_cell_latt = kwant.lattice.general([primitive_vector_1,
>>>>>>> primitive_vector_2],
>>>>>>> [Pos_A1, Pos_B1, Pos_A2,
>>>>>>> Pos_B2])
>>>>>>> Sub_A1, Sub_B1, Sub_A2, Sub_B2 = Super_cell_latt.sublattices
>>>>>>>
>>>>>>> syst= kwant.Builder()
>>>>>>>
>>>>>>> #...................................................................................
>>>>>>> def rectangle(pos):
>>>>>>> x, y = pos
>>>>>>> z=x**2+y**2
>>>>>>> return -4.75*a1<x<4.75*a1 and -8*d<y<8*d
>>>>>>>
>>>>>>> syst[Super_cell_latt.shape(rectangle, (1,1))]=Ep
>>>>>>>
>>>>>>> def delet(pos):
>>>>>>> x, y = pos
>>>>>>> z=x**2+y**2
>>>>>>> return z<(1*a1)**2
>>>>>>>
>>>>>>> del syst[Super_cell_latt.shape(delet, (1,1))]
>>>>>>>
>>>>>>> #nearest
>>>>>>> neighbors.............................................................
>>>>>>> ## Be carfull if you consider second nearest neighbors
>>>>>>> ## =========================================================
>>>>>>> ## Hopping within unit cell ================================
>>>>>>> syst[[kwant.builder.HoppingKind((0,0),Sub_A1,Sub_B1)]] = Vpppi
>>>>>>> syst[[kwant.builder.HoppingKind((0,0),Sub_B1,Sub_A2)]] = Vpppi
>>>>>>> syst[[kwant.builder.HoppingKind((0,0),Sub_A2,Sub_B2)]] = Vpppi
>>>>>>> ## Hopping between neighbouring unit cell=======================
>>>>>>> syst[[kwant.builder.HoppingKind((+1, +1),Sub_A1,Sub_B2)]] = Vpppi
>>>>>>> syst[[kwant.builder.HoppingKind(( 0, +1),Sub_A1,Sub_B2)]] = Vpppi
>>>>>>> syst[[kwant.builder.HoppingKind((+1, 0),Sub_B1,Sub_A2)]] = Vpppi
>>>>>>>
>>>>>>> # Plot the closed system without leads.
>>>>>>> kwant.plot(syst)
>>>>>>>
>>>>>>> Num = 8;
>>>>>>> sym = kwant.TranslationalSymmetry(Super_cell_latt.vec((-Num,0)))
>>>>>>> lead = kwant.Builder(sym)
>>>>>>>
>>>>>>> def lead_shape(pos):
>>>>>>> x, y = pos
>>>>>>> return -8*d<y<8*d
>>>>>>>
>>>>>>> lead[Super_cell_latt.shape(lead_shape, (1,1))] = Ep
>>>>>>>
>>>>>>> del lead[Super_cell_latt.shape(delet, (1,1))]
>>>>>>>
>>>>>>> ## =========================================================
>>>>>>> ## Hopping within unit cell ================================
>>>>>>> lead[[kwant.builder.HoppingKind((0,0),Sub_A1,Sub_B1)]] = Vpppi
>>>>>>> lead[[kwant.builder.HoppingKind((0,0),Sub_B1,Sub_A2)]] = Vpppi
>>>>>>> lead[[kwant.builder.HoppingKind((0,0),Sub_A2,Sub_B2)]] = Vpppi
>>>>>>> ## Hopping between neighbouring unit cell=======================
>>>>>>> lead[[kwant.builder.HoppingKind((+1, +1),Sub_A1,Sub_B2)]] = Vpppi
>>>>>>> lead[[kwant.builder.HoppingKind(( 0, +1),Sub_A1,Sub_B2)]] = Vpppi
>>>>>>> lead[[kwant.builder.HoppingKind((+1, 0),Sub_B1,Sub_A2)]] = Vpppi
>>>>>>>
>>>>>>>
>>>>>>> syst.attach_lead(lead,add_cells=3)
>>>>>>> syst.attach_lead(lead.reversed(),add_cells=3)
>>>>>>>
>>>>>>> # Plot the closed system without leads.
>>>>>>> kwant.plot(syst)
>>>>>>> plt.show()
>>>>>>>
>>>>>>>
>>>>>>> Best
>>>>>>>
>>>>>>> A. BELAYADI
>>>>>>>
>>>>>>> Le jeu. 10 oct. 2019 à 22:44, Abbout Adel <abbout.adel(a)gmail.com> a
>>>>>>> écrit :
>>>>>>>
>>>>>>>> Dear Nafise,
>>>>>>>>
>>>>>>>> You are right, this might be annoying when you try to construct a
>>>>>>>> uniform system (central+leads). Indeed, a lot of concentration is needed in
>>>>>>>> some cases because the lead usually adds some extra sites until it meats
>>>>>>>> the system.
>>>>>>>> There is an easy trick to overcome this small issue.
>>>>>>>>
>>>>>>>> 1) Create a system which can stop a lead (any shape for the system).
>>>>>>>> 2) Attach one lead: syst.attach_lead(lead,add_cells=0)
>>>>>>>> 3) Save the sites of the system: sites=list(syst.finalized().sites)
>>>>>>>> 4) Delete the lead: del syst.leads[0]
>>>>>>>> 5) Attach again the lead with one extra
>>>>>>>> cell: syst.attach_lead(lead,add_cells=1)
>>>>>>>> 6) Delete the previous sites of the system: del syst[sites]
>>>>>>>>
>>>>>>>> By doing this last step, all the previous sites are deleted and
>>>>>>>> only one full unit cell remains in the central system (the one added by the
>>>>>>>> lead).
>>>>>>>> 7) the last step is : syst.attach_lead(lead.reversed(),add_cells=1)
>>>>>>>>
>>>>>>>> And that is it!
>>>>>>>> Your program is summarized below.
>>>>>>>> I hope this helps,
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>> Adel
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> #########################################################################################
>>>>>>>> import kwant
>>>>>>>> import matplotlib.pyplot as plt
>>>>>>>> import math
>>>>>>>>
>>>>>>>> d=1.42;
>>>>>>>> a1=d*math.sqrt(3);
>>>>>>>> t=-0.033;
>>>>>>>>
>>>>>>>> latt = kwant.lattice.general([(a1,0),(a1*0.5,a1*math.sqrt(3)/2)],
>>>>>>>> [(a1/2,-d/2),(a1/2,d/2)])
>>>>>>>> a,b = latt.sublattices
>>>>>>>> syst= kwant.Builder()
>>>>>>>>
>>>>>>>>
>>>>>>>> #...................................................................................
>>>>>>>> def rectangle(pos):
>>>>>>>> x, y = pos
>>>>>>>> z=x**2+y**2
>>>>>>>> return -4.75*a1<x<4.75*a1 and -8*d<y<8*d
>>>>>>>>
>>>>>>>> syst[latt.shape(rectangle, (1,1))]=0
>>>>>>>>
>>>>>>>> def delet(pos):
>>>>>>>> x, y = pos
>>>>>>>> z=x**2+y**2
>>>>>>>> return z<(1*a1)**2
>>>>>>>>
>>>>>>>> del syst[latt.shape(delet, (1,1))]
>>>>>>>>
>>>>>>>>
>>>>>>>> #nearest
>>>>>>>> neighbors.............................................................
>>>>>>>> syst[[kwant.builder.HoppingKind((0,0),a,b)]] =t
>>>>>>>> syst[[kwant.builder.HoppingKind((0,1),a,b)]] =t
>>>>>>>> syst[[kwant.builder.HoppingKind((-1,1),a,b)]] =t
>>>>>>>>
>>>>>>>>
>>>>>>>> sym = kwant.TranslationalSymmetry(latt.vec((-4,0)))
>>>>>>>>
>>>>>>>> sym.add_site_family(latt.sublattices[0], other_vectors=[(-1, 2)])
>>>>>>>> sym.add_site_family(latt.sublattices[1], other_vectors=[(-1, 2)])
>>>>>>>> lead = kwant.Builder(sym)
>>>>>>>>
>>>>>>>>
>>>>>>>> def lead_shape(pos):
>>>>>>>> x, y = pos
>>>>>>>> return -8*d<y<8*d
>>>>>>>>
>>>>>>>> lead[latt.shape(lead_shape, (1,1))] = 0
>>>>>>>>
>>>>>>>> def delet_lead(pos):
>>>>>>>> x, y = pos
>>>>>>>> z=x**2+y**2
>>>>>>>> return z<(1*a1)**2
>>>>>>>>
>>>>>>>> del lead[latt.shape(delet_lead, (1,1))]
>>>>>>>>
>>>>>>>> lead[[kwant.builder.HoppingKind((0,0),a,b)]] =t
>>>>>>>> lead[[kwant.builder.HoppingKind((0,1),a,b)]] =t
>>>>>>>> lead[[kwant.builder.HoppingKind((-1,1),a,b)]] =t
>>>>>>>>
>>>>>>>> syst.attach_lead(lead,add_cells=0)
>>>>>>>> del syst.leads[0]
>>>>>>>> sites=list(syst.finalized().sites)
>>>>>>>> syst.attach_lead(lead,add_cells=1)
>>>>>>>>
>>>>>>>> del syst[sites]
>>>>>>>> #syst.attach_lead(lead.reversed(),add_cells=3)
>>>>>>>> syst.attach_lead(lead.reversed(),add_cells=1)
>>>>>>>> ax=kwant.plot(syst);
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> del syst[sites]
>>>>>>>>
>>>>>>>> On Thu, Oct 10, 2019 at 11:01 AM Nafise Nouri <
>>>>>>>> nafise.nour(a)gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Dear Joseph Weston
>>>>>>>>> Thank you very much for your quick response.
>>>>>>>>> Of course, I can post you my cod example. It is in the following:
>>>>>>>>>
>>>>>>>>> import kwant
>>>>>>>>> import matplotlib.pyplot as plt
>>>>>>>>> import math
>>>>>>>>>
>>>>>>>>> d=1.42;
>>>>>>>>> a1=d*math.sqrt(3);
>>>>>>>>> t=-0.033;
>>>>>>>>>
>>>>>>>>> latt = kwant.lattice.general([(a1,0),(a1*0.5,a1*math.sqrt(3)/2)],
>>>>>>>>> [(a1/2,-d/2),(a1/2,d/2)])
>>>>>>>>> a,b = latt.sublattices
>>>>>>>>> syst= kwant.Builder()
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> #...................................................................................
>>>>>>>>> def rectangle(pos):
>>>>>>>>> x, y = pos
>>>>>>>>> z=x**2+y**2
>>>>>>>>> return -4.75*a1<x<4.75*a1 and -8*d<y<8*d
>>>>>>>>>
>>>>>>>>> syst[latt.shape(rectangle, (1,1))]=0
>>>>>>>>>
>>>>>>>>> def delet(pos):
>>>>>>>>> x, y = pos
>>>>>>>>> z=x**2+y**2
>>>>>>>>> return z<(1*a1)**2
>>>>>>>>>
>>>>>>>>> del syst[latt.shape(delet, (1,1))]
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> #nearest
>>>>>>>>> neighbors.............................................................
>>>>>>>>> syst[[kwant.builder.HoppingKind((0,0),a,b)]] =t
>>>>>>>>> syst[[kwant.builder.HoppingKind((0,1),a,b)]] =t
>>>>>>>>> syst[[kwant.builder.HoppingKind((-1,1),a,b)]] =t
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> sym = kwant.TranslationalSymmetry(latt.vec((-4,0)))
>>>>>>>>>
>>>>>>>>> sym.add_site_family(latt.sublattices[0], other_vectors=[(-1, 2)])
>>>>>>>>> sym.add_site_family(latt.sublattices[1], other_vectors=[(-1, 2)])
>>>>>>>>> lead = kwant.Builder(sym)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> def lead_shape(pos):
>>>>>>>>> x, y = pos
>>>>>>>>> return -8*d<y<8*d
>>>>>>>>>
>>>>>>>>> lead[latt.shape(lead_shape, (1,1))] = 0
>>>>>>>>>
>>>>>>>>> def delet_lead(pos):
>>>>>>>>> x, y = pos
>>>>>>>>> z=x**2+y**2
>>>>>>>>> return z<(1*a1)**2
>>>>>>>>>
>>>>>>>>> del lead[latt.shape(delet_lead, (1,1))]
>>>>>>>>>
>>>>>>>>> lead[[kwant.builder.HoppingKind((0,0),a,b)]] =t
>>>>>>>>> lead[[kwant.builder.HoppingKind((0,1),a,b)]] =t
>>>>>>>>> lead[[kwant.builder.HoppingKind((-1,1),a,b)]] =t
>>>>>>>>>
>>>>>>>>> syst.attach_lead(lead,add_cells=3)
>>>>>>>>> syst.attach_lead(lead.reversed(),add_cells=3)
>>>>>>>>>
>>>>>>>>> ax=kwant.plot(syst);
>>>>>>>>>
>>>>>>>>> Best wishes,
>>>>>>>>> Nafise
>>>>>>>>>
>>>>>>>>> Sorry for double email. The first email was not as reply.
>>>>>>>>>
>>>>>>>>> Best,
>>>>>>>>> Nafise
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Tue, Oct 8, 2019 at 3:08 PM Nafise Nouri <nafise.nour(a)gmail.com>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>> Of course.
>>>>>>>>>> I sent it to you and also to the mailing list,
>>>>>>>>>>
>>>>>>>>>> Best regards,
>>>>>>>>>> Nafise
>>>>>>>>>>
>>>>>>>>>> On Tue, Oct 8, 2019 at 11:31 AM Joseph Weston <
>>>>>>>>>> joseph.weston08(a)gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>> Can you post this as a reply to your query in the mailing list?
>>>>>>>>>>> I accidentally replied directly to you when I should have CC'd the mailing
>>>>>>>>>>> list also.
>>>>>>>>>>>
>>>>>>>>>>> Thanks,
>>>>>>>>>>>
>>>>>>>>>>> Joe
>>>>>>>>>>> On 10/6/19 7:43 AM, Nafise Nouri wrote:
>>>>>>>>>>>
>>>>>>>>>>> Dear Joseph Weston
>>>>>>>>>>> Thank you very much for your quick response.
>>>>>>>>>>> Of course, I can post you my cod example. It is in the
>>>>>>>>>>> following:
>>>>>>>>>>>
>>>>>>>>>>> import kwant
>>>>>>>>>>> import matplotlib.pyplot as plt
>>>>>>>>>>> import math
>>>>>>>>>>>
>>>>>>>>>>> d=1.42;
>>>>>>>>>>> a1=d*math.sqrt(3);
>>>>>>>>>>> t=-0.033;
>>>>>>>>>>>
>>>>>>>>>>> latt = kwant.lattice.general([(a1,0),(a1*0.5,a1*math.sqrt(3)/2)],
>>>>>>>>>>> [(a1/2,-d/2),(a1/2,d/2)])
>>>>>>>>>>> a,b = latt.sublattices
>>>>>>>>>>> syst= kwant.Builder()
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> #...................................................................................
>>>>>>>>>>> def rectangle(pos):
>>>>>>>>>>> x, y = pos
>>>>>>>>>>> z=x**2+y**2
>>>>>>>>>>> return -4.75*a1<x<4.75*a1 and -8*d<y<8*d
>>>>>>>>>>>
>>>>>>>>>>> syst[latt.shape(rectangle, (1,1))]=0
>>>>>>>>>>>
>>>>>>>>>>> def delet(pos):
>>>>>>>>>>> x, y = pos
>>>>>>>>>>> z=x**2+y**2
>>>>>>>>>>> return z<(1*a1)**2
>>>>>>>>>>>
>>>>>>>>>>> del syst[latt.shape(delet, (1,1))]
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> #nearest
>>>>>>>>>>> neighbors.............................................................
>>>>>>>>>>> syst[[kwant.builder.HoppingKind((0,0),a,b)]] =t
>>>>>>>>>>> syst[[kwant.builder.HoppingKind((0,1),a,b)]] =t
>>>>>>>>>>> syst[[kwant.builder.HoppingKind((-1,1),a,b)]] =t
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> sym = kwant.TranslationalSymmetry(latt.vec((-4,0)))
>>>>>>>>>>>
>>>>>>>>>>> sym.add_site_family(latt.sublattices[0], other_vectors=[(-1, 2)])
>>>>>>>>>>> sym.add_site_family(latt.sublattices[1], other_vectors=[(-1, 2)])
>>>>>>>>>>> lead = kwant.Builder(sym)
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> def lead_shape(pos):
>>>>>>>>>>> x, y = pos
>>>>>>>>>>> return -8*d<y<8*d
>>>>>>>>>>>
>>>>>>>>>>> lead[latt.shape(lead_shape, (1,1))] = 0
>>>>>>>>>>>
>>>>>>>>>>> def delet_lead(pos):
>>>>>>>>>>> x, y = pos
>>>>>>>>>>> z=x**2+y**2
>>>>>>>>>>> return z<(1*a1)**2
>>>>>>>>>>>
>>>>>>>>>>> del lead[latt.shape(delet_lead, (1,1))]
>>>>>>>>>>>
>>>>>>>>>>> lead[[kwant.builder.HoppingKind((0,0),a,b)]] =t
>>>>>>>>>>> lead[[kwant.builder.HoppingKind((0,1),a,b)]] =t
>>>>>>>>>>> lead[[kwant.builder.HoppingKind((-1,1),a,b)]] =t
>>>>>>>>>>>
>>>>>>>>>>> syst.attach_lead(lead,add_cells=3)
>>>>>>>>>>> syst.attach_lead(lead.reversed(),add_cells=3)
>>>>>>>>>>>
>>>>>>>>>>> ax=kwant.plot(syst);
>>>>>>>>>>>
>>>>>>>>>>> Best wishes,
>>>>>>>>>>> Nafise
>>>>>>>>>>>
>>>>>>>>>>> On Sat, Oct 5, 2019 at 12:57 PM Joseph Weston <
>>>>>>>>>>> joseph.weston08(a)gmail.com> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi Nafise
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> I need to make a periodic lattice with hole. In fact I should make holes on the scattering region and also on the leads. Although I can make this kind of lattice by kwant, I have problem about the distances between holes. I want to make a periodic holes on the nanoribbon but the distance between holes in the scattering region is different from the distance between holes in the other regions. Would you please let me know How Can I make a same distance between holes? Should I work on the translational symmetry in the leads?
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Because the leads need to be translationally invariant if you
>>>>>>>>>>>> want a very large distance between defects then your unit cell in the leads
>>>>>>>>>>>> needs to be correspondingly large.
>>>>>>>>>>>>
>>>>>>>>>>>> If you post a code example of what your problem is specifically
>>>>>>>>>>>> we may be able to help more.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Happy Kwanting,
>>>>>>>>>>>>
>>>>>>>>>>>> Joe
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> P.S. sorry for the double reply; I forgot to send to the
>>>>>>>>>>>> mailing list also
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Abbout Adel
>>>>>>>>
>>>>>>>

Dear Adel,
Thank you very much for your kind help.I want to use kwant to calculate the
transmission for bulk system because of the paper Phys. Rev. B 86, 115455.
However, ky for the lead and the scattering region is not very clear in
Kwant when we use kwant.wraparound. When we use smatrix =
kwant.smatrix(sys, energy, [ky]) to calculate the transmission of the bulk
system,we do not know if the ky here can affect the scattering region or
not. I have tried a system with more args, for example smatrix =
kwant.smatrix(sys, energy, [VG1,VG2,ky]), (Here ky must be put as the third
one), the definition of the onsite potential should be given as “def
onsitepotential(site,VG1,VG2)”. I do not know if it is a bug or I just do
not find the right way to use the kwant.wraparound. I think the developers
may know the reason.
Best,
Khani Hosein

Dear all,
I am trying to make an armchair nanoribbon as following:
import kwant
from math import sqrt
import matplotlib.pyplot as plt
import tinyarray
import numpy as np
import math
import cmath
#import scipy.linalg as la
import matplotlib
d=1.42;
a1=d*math.sqrt(3);
#on-site energy...................................................
t=-2.7;
latt = kwant.lattice.general([(0,a1),(a1*math.sqrt(3)/2,a1*0.5)],
[(-d/2,a1/2),(d/2,a1/2)])
a,b = latt.sublattices
syst= kwant.Builder()
def rectangle(pos):
x, y = pos
return -2.4*a1<x<2.4*a1 and -3*d<y<3*d
syst[latt.shape(rectangle, (1,1))]=0
#nearest neighbors.............................................................
syst[[kwant.builder.HoppingKind((0,0),a,b)]] =t
syst[[kwant.builder.HoppingKind((0,1),a,b)]] =t
syst[[kwant.builder.HoppingKind((-1,1),a,b)]] =t
ax=kwant.plot(syst);
sym = kwant.TranslationalSymmetry(latt.vec((-1,2)))
lead = kwant.Builder(sym)
def lead_shape(pos):
x, y = pos
return -3*d<y<3*d
lead[latt.shape(lead_shape, (1,1))]=0
lead[[kwant.builder.HoppingKind((0,0),a,b)]]=t
lead[[kwant.builder.HoppingKind((0,1),a,b)]]=t
lead[[kwant.builder.HoppingKind((-1,1),a,b)]]=t
syst.attach_lead(lead,add_cells=0)
syst.attach_lead(lead.reversed(),add_cells=0)
ax=kwant.plot(syst);
It is ok and I have no problem with it. I have problem when I tried to make a defect (like making a hole) on the scattering rigion and also lead.
I used a same method for making a defect on both scattering region and lead but the results are not same.
Would you please help me what is a problem. Would you please let me know if symmetry vector (sym = kwant.TranslationalSymmetry(latt.vec((-1,2))))
used is ok?
Best wishes,
Sajad

Dear all,
I am using kwant to calculate the transmission of a bulk system. I use "
sys = kwant.wraparound.wraparound(sys) and lead =
kwant.wraparound.wraparound(lead, keep=0)" to change my tight-binding
ribbon system to a bulk system. The transmission is obtained using:
kys = np.arange(-0.5, 0.5, 0.001)
for ky in kys:
smatrix = kwant.smatrix(sys, energy, [ky])
transmission.append(smatrix.transmission(1, 0))
I want to obtain the Transmission vs the incident angle of an electron, and
I also need to do the integration ∫T(ky, E) dky or ∫T(θ,E)cosθdθ. I do not
undstand the ky in the system with kwant.wraparoun, what is the unit of ky,
what is k here for the system, how to obtain T(θ,E) .Can you give me some
advices on this?Thanks in advance. The definition of incident angle is
shown in the attached Fig.1， the band structure for my bulk system is shown
in attached Fig.2 and the Tranmission vs ky is shown in Fig.3 (I do not
know how to set the values for ky).
Regards,
Hosein Khani

Hello,
I previously asked how to get the corresponding .tex file of the system I want to study.
For example, using the tikzplolib package, I can write the following code:
figLattice = kwant.plot( sys )
tikzplotlib.save( nameGeometry+'.tex' )
However, the corresponding .tex file is empty (see the attached file).
How can I solve that problem ?
Thank you and have a good day,
Alexandre

Hello,
I previously asked how to get the corresponding .tex file of the system I want to study.
For example, using the tikzplolib package, I can write the following code:
figLattice = kwant.plot( sys )
tikzplotlib.save( nameGeometry+'.tex' )
However, the corresponding .tex file is empty (see the attached file).
How can I solve that problem ?
Thank you and have a good day,
Alexandre

Hello,
My name is Alexandre and I would like to know if the file produced by the line
figLattice = kwant.plot( sys, file = 'test.pdf' )
could give the corresponding plot in .tex file (the same way as tikzplotlib works) so that it can be plotted using tikzpicture for example ?
If not, is there a way to get rid of all the "useless" white space around the figure ?
Thank you and have a good day,
Alexandre

Hey again,
I am so glad that my contribution was beneficial to you.
*1- * *Why did you choose a new super cell. What is a problem when we use
honeycomb unit cell?*
In fat, it is the same thing since we have (i) a finite system and (ii) the
obtained system has the honeycomb shape
whether using honeycomb lattice or the provides supercell.
In fact, the supercell where created carefully to provide the same shape of
honeycomb lattice.
However, if the case of a periodic system, the use of supercell will be
wrong since the number of atom in the unit cell is a key factor.
*2-If we change symmetry vector (for **example try it by simple graphene
nanoribbon) some physical properties like*
* band structure IS changed? why does it happen?*
I have small experience in kwant since I am a new user, but technically let
us say:
(a) The lead is considered as an infinite system, so the number of atom in
the unit cell should be carefully selected or we will get extra usefulness
modes in bands. For example, In the case of perfect lead, we do have to
set sym = kwant.TranslationalSymmetry(Super_cell_latt.vec((Num=-1,0)))
since for Num =1 is the primitive unit cell which provide the whole lead.
However, If we set (Num=-2 or more), we will get the same lead
but with non primitive cell (or let's say Conventional lattice). In this
case, you will get extract evanescent and propagating modes which are
unnecessary.
(b) in your case the lead is not perfect since it contains some holes in.
For this reason you have to define Conventional lattice or shape which
provide
or insure periodicity to get the whole lead.
Please see attached Pdf.file to have an idea about primitive cell and
conventional cell (see the fcc case).
Ps1 few examples of bands using primitive and conventional unit cell
### Primitive unit cell where Num is set to -1. Here 6 bands are found
import kwant
import matplotlib.pyplot as plt
import math
d=1.42;
a1=d*math.sqrt(3);
t=-0.033;
latt = kwant.lattice.general([(a1,0),(a1*0.5,a1*math.sqrt(3)/2)],
[(a1/2,-d/2),(a1/2,d/2)])
a,b = latt.sublattices
syst= kwant.Builder()
def lead_shape(pos):
return -3<pos[1]<3
Num = -1
sym = kwant.TranslationalSymmetry(latt.vec((Num,0)))
sym.add_site_family(latt.sublattices[0], other_vectors=[(-1, 2)])
sym.add_site_family(latt.sublattices[1], other_vectors=[(-1, 2)])
lead = kwant.Builder(sym)
lead[latt.shape(lead_shape, (1,1))] = 0
lead[[kwant.builder.HoppingKind((0,0),a,b)]] =t
lead[[kwant.builder.HoppingKind((0,1),a,b)]] =t
lead[[kwant.builder.HoppingKind((-1,1),a,b)]] =t
kwant.plot(lead)
plt.show()
## The unit cell of the lead is composed of 6 atoms, hence 6 bands could be
find
lead_Num1 = lead.finalized()
kwant.plotter.bands(lead_Num1, show=False)
plt.xlabel("momentum [(lattice constant)^-1]")
plt.ylabel("energy [t]")
plt.show()
## the conventional unit cell where Num is set to -2. Here 6*2=12 bands are
found. We have 6 extrat bands which have nothing
##to do in the case of a perfect lead
import kwant
import matplotlib.pyplot as plt
import math
d=1.42;
a1=d*math.sqrt(3);
t=-0.033;
latt = kwant.lattice.general([(a1,0),(a1*0.5,a1*math.sqrt(3)/2)],
[(a1/2,-d/2),(a1/2,d/2)])
a,b = latt.sublattices
syst= kwant.Builder()
def lead_shape(pos):
return -3<pos[1]<3
Num = -2
sym = kwant.TranslationalSymmetry(latt.vec((Num,0)))
sym.add_site_family(latt.sublattices[0], other_vectors=[(-1, 2)])
sym.add_site_family(latt.sublattices[1], other_vectors=[(-1, 2)])
lead = kwant.Builder(sym)
lead[latt.shape(lead_shape, (1,1))] = 0
lead[[kwant.builder.HoppingKind((0,0),a,b)]] =t
lead[[kwant.builder.HoppingKind((0,1),a,b)]] =t
lead[[kwant.builder.HoppingKind((-1,1),a,b)]] =t
kwant.plot(lead)
plt.show()
## The unit cell of the lead is composed of 6*2 atoms, hence 6 bands could
be find
lead_Num1 = lead.finalized()
kwant.plotter.bands(lead_Num1, show=False)
plt.xlabel("momentum [(lattice constant)^-1]")
plt.ylabel("energy [t]")
plt.show()
Ps2 few examples of bands using honycomb or supper celll
##In the following we will compare the your honycombe lattice Num =-1 and
the proposed supper cell.
##You will see that we will get the same results in terms of bands
import kwant
import matplotlib.pyplot as plt
from math import sqrt
d = 1.42;
t=-0.033;
## So let us start
a1 = d*sqrt(3);
a2 = 3*d;
primitive_vector_1 = (a1, 0);
primitive_vector_2 = (0, a2);
### here premitive vectors are perpondicular:
primitive_vector_1.primitive_vector_1 = 0
## Now let us define the atoms positions of the unit cell
Pos_A1 = ( 0, -d/2)
Pos_B1 = ( 0, d/2)
Pos_A2 = ( a1/2, d)
Pos_B2 = ( a1/2, 2*d)
Super_cell_latt = kwant.lattice.general([primitive_vector_1,
primitive_vector_2],
[Pos_A1, Pos_B1, Pos_A2, Pos_B2])
Sub_A1, Sub_B1, Sub_A2, Sub_B2 = Super_cell_latt.sublattices
syst= kwant.Builder()
Num = -1;
sym = kwant.TranslationalSymmetry(Super_cell_latt.vec((Num,0)))
lead = kwant.Builder(sym)
def lead_shape(pos):
return -3<pos[1]<3
lead[Super_cell_latt.shape(lead_shape, (1,1))] = 0
## =========================================================
## Hopping within unit cell ================================
lead[[kwant.builder.HoppingKind((0,0),Sub_A1,Sub_B1)]] = t
lead[[kwant.builder.HoppingKind((0,0),Sub_B1,Sub_A2)]] = t
lead[[kwant.builder.HoppingKind((0,0),Sub_A2,Sub_B2)]] = t
## Hopping between neighbouring unit cell=======================
lead[[kwant.builder.HoppingKind((+1, +1),Sub_A1,Sub_B2)]] = t
lead[[kwant.builder.HoppingKind(( 0, +1),Sub_A1,Sub_B2)]] = t
lead[[kwant.builder.HoppingKind((+1, 0),Sub_B1,Sub_A2)]] = t
kwant.plot(lead)
plt.show()
## The unit cell of the lead is composed of 6 atoms, hence 6 bands could be
find
lead_Num1 = lead.finalized()
kwant.plotter.bands(lead_Num1, show=False)
plt.xlabel("momentum [(lattice constant)^-1]")
plt.ylabel("energy [t]")
plt.show()
Le ven. 11 oct. 2019 à 09:24, Nafise Nouri <nafise.nour(a)gmail.com> a écrit :
> Dear Adel Belayadi
> Thank you so much for your benefit response. But I did not
> understand completely. Why did you choose a new super cell? What is a
> problem when we use honeycomb unit cell?
>
> Also I have one more question, That is very kind of you if you help m:
> * If we change symmetry vector (for **example** try it by simple graphene
> nanoribbon) some physical properties like band structure IS changed? why
> does it happen?*
> * Do you know what is the concept of symmetry vector in kwant?*
>
> *Thank you in advance for your help.*
>
> *Best wishes,*
> *Nafise*
>
> On Fri, Oct 11, 2019 at 3:56 AM Adel Belayadi <adelphys(a)gmail.com> wrote:
>
>> Dear Abbout, Josef and Nafiss,
>>
>> Good day. As it was stated by Mr. Abbout adel, it seems somehow tricky to
>> do it. In my point of view this is because we are dealing with no
>> orthogonal primitive vectors.
>> I have fixed this issue by ussing orthogonal primitive vectors. However
>> in this case, we have to use super-cell instead of a simple honeycomb
>> lattice.
>>
>> Please, In the script bellow we will find the code.In the comment, a
>> little explanation of each part of the code is provided. Additionally, you
>> might find the enclosed file which contains the python script of the code.
>>
>> On think to care about. In the
>> sym = kwant.TranslationalSymmetry(Super_cell_latt.vec((-Num,0))), Num
>> should be carefully chosen since it depends on the boundaries rectangle
>> shape.
>>
>> Finally, If you need to have only two families in the plot. Simply use
>>
>> def family_colors(site): return 0 or give a color you like if site.family
>> == Sub_A1 or Sub_A2 else 1 or give another color you like
>>
>> Finally, I hope this is useful for you. Here you are the script
>>
>>
>> #############################################################################################
>>
>> ### I think to solve the problem we need to creat supercell with
>> orthogonal primitive vector
>> import kwant
>> import matplotlib.pyplot as plt
>> from math import sqrt
>>
>> d = 1.42;
>> hbar_square_over_m = 7.62
>> Ep = -11.07;
>> Vpppi = -0.63*hbar_square_over_m*(1/d)*2
>>
>> ## In the following, we will define a super cell of 4 atoms
>> ## we define four atoms in the unit cell where A2 equivalent(==) to A1
>> and B2==B1.
>> ## Bear in minde that this kind ofthinking is generally used in python as
>> aliases
>> ## In kwant i dont know how to use aliases but we will assume the A2 and
>> A1 have the same on-site energy
>> ## (or let us say the same familly). Also the the B2 and B1 have the same
>> on-site energy
>>
>> ## So let us start
>> a1 = d*sqrt(3);
>> a2 = 3*d;
>> primitive_vector_1 = (a1, 0);
>> primitive_vector_2 = (0, a2);
>> ### here premitive vectors are perpondicular:
>> primitive_vector_1.primitive_vector_1 = 0
>>
>> ## Now let us define the atoms positions of the unit cell
>> Pos_A1 = ( 0, -d/2)
>> Pos_B1 = ( 0, d/2)
>> Pos_A2 = ( a1/2, d)
>> Pos_B2 = ( a1/2, 2*d)
>>
>>
>> Super_cell_latt = kwant.lattice.general([primitive_vector_1,
>> primitive_vector_2],
>> [Pos_A1, Pos_B1, Pos_A2, Pos_B2])
>> Sub_A1, Sub_B1, Sub_A2, Sub_B2 = Super_cell_latt.sublattices
>>
>> syst= kwant.Builder()
>>
>> #...................................................................................
>> def rectangle(pos):
>> x, y = pos
>> z=x**2+y**2
>> return -4.75*a1<x<4.75*a1 and -8*d<y<8*d
>>
>> syst[Super_cell_latt.shape(rectangle, (1,1))]=Ep
>>
>> def delet(pos):
>> x, y = pos
>> z=x**2+y**2
>> return z<(1*a1)**2
>>
>> del syst[Super_cell_latt.shape(delet, (1,1))]
>>
>> #nearest
>> neighbors.............................................................
>> ## Be carfull if you consider second nearest neighbors
>> ## =========================================================
>> ## Hopping within unit cell ================================
>> syst[[kwant.builder.HoppingKind((0,0),Sub_A1,Sub_B1)]] = Vpppi
>> syst[[kwant.builder.HoppingKind((0,0),Sub_B1,Sub_A2)]] = Vpppi
>> syst[[kwant.builder.HoppingKind((0,0),Sub_A2,Sub_B2)]] = Vpppi
>> ## Hopping between neighbouring unit cell=======================
>> syst[[kwant.builder.HoppingKind((+1, +1),Sub_A1,Sub_B2)]] = Vpppi
>> syst[[kwant.builder.HoppingKind(( 0, +1),Sub_A1,Sub_B2)]] = Vpppi
>> syst[[kwant.builder.HoppingKind((+1, 0),Sub_B1,Sub_A2)]] = Vpppi
>>
>> # Plot the closed system without leads.
>> kwant.plot(syst)
>>
>> Num = 8;
>> sym = kwant.TranslationalSymmetry(Super_cell_latt.vec((-Num,0)))
>> lead = kwant.Builder(sym)
>>
>> def lead_shape(pos):
>> x, y = pos
>> return -8*d<y<8*d
>>
>> lead[Super_cell_latt.shape(lead_shape, (1,1))] = Ep
>>
>> del lead[Super_cell_latt.shape(delet, (1,1))]
>>
>> ## =========================================================
>> ## Hopping within unit cell ================================
>> lead[[kwant.builder.HoppingKind((0,0),Sub_A1,Sub_B1)]] = Vpppi
>> lead[[kwant.builder.HoppingKind((0,0),Sub_B1,Sub_A2)]] = Vpppi
>> lead[[kwant.builder.HoppingKind((0,0),Sub_A2,Sub_B2)]] = Vpppi
>> ## Hopping between neighbouring unit cell=======================
>> lead[[kwant.builder.HoppingKind((+1, +1),Sub_A1,Sub_B2)]] = Vpppi
>> lead[[kwant.builder.HoppingKind(( 0, +1),Sub_A1,Sub_B2)]] = Vpppi
>> lead[[kwant.builder.HoppingKind((+1, 0),Sub_B1,Sub_A2)]] = Vpppi
>>
>>
>> syst.attach_lead(lead,add_cells=3)
>> syst.attach_lead(lead.reversed(),add_cells=3)
>>
>> # Plot the closed system without leads.
>> kwant.plot(syst)
>> plt.show()
>>
>>
>> Best
>>
>> A. BELAYADI
>>
>> Le jeu. 10 oct. 2019 à 22:44, Abbout Adel <abbout.adel(a)gmail.com> a
>> écrit :
>>
>>> Dear Nafise,
>>>
>>> You are right, this might be annoying when you try to construct a
>>> uniform system (central+leads). Indeed, a lot of concentration is needed in
>>> some cases because the lead usually adds some extra sites until it meats
>>> the system.
>>> There is an easy trick to overcome this small issue.
>>>
>>> 1) Create a system which can stop a lead (any shape for the system).
>>> 2) Attach one lead: syst.attach_lead(lead,add_cells=0)
>>> 3) Save the sites of the system: sites=list(syst.finalized().sites)
>>> 4) Delete the lead: del syst.leads[0]
>>> 5) Attach again the lead with one extra
>>> cell: syst.attach_lead(lead,add_cells=1)
>>> 6) Delete the previous sites of the system: del syst[sites]
>>>
>>> By doing this last step, all the previous sites are deleted and only one
>>> full unit cell remains in the central system (the one added by the lead).
>>> 7) the last step is : syst.attach_lead(lead.reversed(),add_cells=1)
>>>
>>> And that is it!
>>> Your program is summarized below.
>>> I hope this helps,
>>>
>>> Regards,
>>> Adel
>>>
>>>
>>>
>>> #########################################################################################
>>> import kwant
>>> import matplotlib.pyplot as plt
>>> import math
>>>
>>> d=1.42;
>>> a1=d*math.sqrt(3);
>>> t=-0.033;
>>>
>>> latt = kwant.lattice.general([(a1,0),(a1*0.5,a1*math.sqrt(3)/2)],
>>> [(a1/2,-d/2),(a1/2,d/2)])
>>> a,b = latt.sublattices
>>> syst= kwant.Builder()
>>>
>>>
>>> #...................................................................................
>>> def rectangle(pos):
>>> x, y = pos
>>> z=x**2+y**2
>>> return -4.75*a1<x<4.75*a1 and -8*d<y<8*d
>>>
>>> syst[latt.shape(rectangle, (1,1))]=0
>>>
>>> def delet(pos):
>>> x, y = pos
>>> z=x**2+y**2
>>> return z<(1*a1)**2
>>>
>>> del syst[latt.shape(delet, (1,1))]
>>>
>>>
>>> #nearest
>>> neighbors.............................................................
>>> syst[[kwant.builder.HoppingKind((0,0),a,b)]] =t
>>> syst[[kwant.builder.HoppingKind((0,1),a,b)]] =t
>>> syst[[kwant.builder.HoppingKind((-1,1),a,b)]] =t
>>>
>>>
>>> sym = kwant.TranslationalSymmetry(latt.vec((-4,0)))
>>>
>>> sym.add_site_family(latt.sublattices[0], other_vectors=[(-1, 2)])
>>> sym.add_site_family(latt.sublattices[1], other_vectors=[(-1, 2)])
>>> lead = kwant.Builder(sym)
>>>
>>>
>>> def lead_shape(pos):
>>> x, y = pos
>>> return -8*d<y<8*d
>>>
>>> lead[latt.shape(lead_shape, (1,1))] = 0
>>>
>>> def delet_lead(pos):
>>> x, y = pos
>>> z=x**2+y**2
>>> return z<(1*a1)**2
>>>
>>> del lead[latt.shape(delet_lead, (1,1))]
>>>
>>> lead[[kwant.builder.HoppingKind((0,0),a,b)]] =t
>>> lead[[kwant.builder.HoppingKind((0,1),a,b)]] =t
>>> lead[[kwant.builder.HoppingKind((-1,1),a,b)]] =t
>>>
>>> syst.attach_lead(lead,add_cells=0)
>>> del syst.leads[0]
>>> sites=list(syst.finalized().sites)
>>> syst.attach_lead(lead,add_cells=1)
>>>
>>> del syst[sites]
>>> #syst.attach_lead(lead.reversed(),add_cells=3)
>>> syst.attach_lead(lead.reversed(),add_cells=1)
>>> ax=kwant.plot(syst);
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> del syst[sites]
>>>
>>> On Thu, Oct 10, 2019 at 11:01 AM Nafise Nouri <nafise.nour(a)gmail.com>
>>> wrote:
>>>
>>>> Dear Joseph Weston
>>>> Thank you very much for your quick response.
>>>> Of course, I can post you my cod example. It is in the following:
>>>>
>>>> import kwant
>>>> import matplotlib.pyplot as plt
>>>> import math
>>>>
>>>> d=1.42;
>>>> a1=d*math.sqrt(3);
>>>> t=-0.033;
>>>>
>>>> latt = kwant.lattice.general([(a1,0),(a1*0.5,a1*math.sqrt(3)/2)],
>>>> [(a1/2,-d/2),(a1/2,d/2)])
>>>> a,b = latt.sublattices
>>>> syst= kwant.Builder()
>>>>
>>>>
>>>> #...................................................................................
>>>> def rectangle(pos):
>>>> x, y = pos
>>>> z=x**2+y**2
>>>> return -4.75*a1<x<4.75*a1 and -8*d<y<8*d
>>>>
>>>> syst[latt.shape(rectangle, (1,1))]=0
>>>>
>>>> def delet(pos):
>>>> x, y = pos
>>>> z=x**2+y**2
>>>> return z<(1*a1)**2
>>>>
>>>> del syst[latt.shape(delet, (1,1))]
>>>>
>>>>
>>>> #nearest
>>>> neighbors.............................................................
>>>> syst[[kwant.builder.HoppingKind((0,0),a,b)]] =t
>>>> syst[[kwant.builder.HoppingKind((0,1),a,b)]] =t
>>>> syst[[kwant.builder.HoppingKind((-1,1),a,b)]] =t
>>>>
>>>>
>>>> sym = kwant.TranslationalSymmetry(latt.vec((-4,0)))
>>>>
>>>> sym.add_site_family(latt.sublattices[0], other_vectors=[(-1, 2)])
>>>> sym.add_site_family(latt.sublattices[1], other_vectors=[(-1, 2)])
>>>> lead = kwant.Builder(sym)
>>>>
>>>>
>>>> def lead_shape(pos):
>>>> x, y = pos
>>>> return -8*d<y<8*d
>>>>
>>>> lead[latt.shape(lead_shape, (1,1))] = 0
>>>>
>>>> def delet_lead(pos):
>>>> x, y = pos
>>>> z=x**2+y**2
>>>> return z<(1*a1)**2
>>>>
>>>> del lead[latt.shape(delet_lead, (1,1))]
>>>>
>>>> lead[[kwant.builder.HoppingKind((0,0),a,b)]] =t
>>>> lead[[kwant.builder.HoppingKind((0,1),a,b)]] =t
>>>> lead[[kwant.builder.HoppingKind((-1,1),a,b)]] =t
>>>>
>>>> syst.attach_lead(lead,add_cells=3)
>>>> syst.attach_lead(lead.reversed(),add_cells=3)
>>>>
>>>> ax=kwant.plot(syst);
>>>>
>>>> Best wishes,
>>>> Nafise
>>>>
>>>> Sorry for double email. The first email was not as reply.
>>>>
>>>> Best,
>>>> Nafise
>>>>
>>>>
>>>> On Tue, Oct 8, 2019 at 3:08 PM Nafise Nouri <nafise.nour(a)gmail.com>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>> Of course.
>>>>> I sent it to you and also to the mailing list,
>>>>>
>>>>> Best regards,
>>>>> Nafise
>>>>>
>>>>> On Tue, Oct 8, 2019 at 11:31 AM Joseph Weston <
>>>>> joseph.weston08(a)gmail.com> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Can you post this as a reply to your query in the mailing list? I
>>>>>> accidentally replied directly to you when I should have CC'd the mailing
>>>>>> list also.
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Joe
>>>>>> On 10/6/19 7:43 AM, Nafise Nouri wrote:
>>>>>>
>>>>>> Dear Joseph Weston
>>>>>> Thank you very much for your quick response.
>>>>>> Of course, I can post you my cod example. It is in the following:
>>>>>>
>>>>>> import kwant
>>>>>> import matplotlib.pyplot as plt
>>>>>> import math
>>>>>>
>>>>>> d=1.42;
>>>>>> a1=d*math.sqrt(3);
>>>>>> t=-0.033;
>>>>>>
>>>>>> latt = kwant.lattice.general([(a1,0),(a1*0.5,a1*math.sqrt(3)/2)],
>>>>>> [(a1/2,-d/2),(a1/2,d/2)])
>>>>>> a,b = latt.sublattices
>>>>>> syst= kwant.Builder()
>>>>>>
>>>>>>
>>>>>> #...................................................................................
>>>>>> def rectangle(pos):
>>>>>> x, y = pos
>>>>>> z=x**2+y**2
>>>>>> return -4.75*a1<x<4.75*a1 and -8*d<y<8*d
>>>>>>
>>>>>> syst[latt.shape(rectangle, (1,1))]=0
>>>>>>
>>>>>> def delet(pos):
>>>>>> x, y = pos
>>>>>> z=x**2+y**2
>>>>>> return z<(1*a1)**2
>>>>>>
>>>>>> del syst[latt.shape(delet, (1,1))]
>>>>>>
>>>>>>
>>>>>> #nearest
>>>>>> neighbors.............................................................
>>>>>> syst[[kwant.builder.HoppingKind((0,0),a,b)]] =t
>>>>>> syst[[kwant.builder.HoppingKind((0,1),a,b)]] =t
>>>>>> syst[[kwant.builder.HoppingKind((-1,1),a,b)]] =t
>>>>>>
>>>>>>
>>>>>> sym = kwant.TranslationalSymmetry(latt.vec((-4,0)))
>>>>>>
>>>>>> sym.add_site_family(latt.sublattices[0], other_vectors=[(-1, 2)])
>>>>>> sym.add_site_family(latt.sublattices[1], other_vectors=[(-1, 2)])
>>>>>> lead = kwant.Builder(sym)
>>>>>>
>>>>>>
>>>>>> def lead_shape(pos):
>>>>>> x, y = pos
>>>>>> return -8*d<y<8*d
>>>>>>
>>>>>> lead[latt.shape(lead_shape, (1,1))] = 0
>>>>>>
>>>>>> def delet_lead(pos):
>>>>>> x, y = pos
>>>>>> z=x**2+y**2
>>>>>> return z<(1*a1)**2
>>>>>>
>>>>>> del lead[latt.shape(delet_lead, (1,1))]
>>>>>>
>>>>>> lead[[kwant.builder.HoppingKind((0,0),a,b)]] =t
>>>>>> lead[[kwant.builder.HoppingKind((0,1),a,b)]] =t
>>>>>> lead[[kwant.builder.HoppingKind((-1,1),a,b)]] =t
>>>>>>
>>>>>> syst.attach_lead(lead,add_cells=3)
>>>>>> syst.attach_lead(lead.reversed(),add_cells=3)
>>>>>>
>>>>>> ax=kwant.plot(syst);
>>>>>>
>>>>>> Best wishes,
>>>>>> Nafise
>>>>>>
>>>>>> On Sat, Oct 5, 2019 at 12:57 PM Joseph Weston <
>>>>>> joseph.weston08(a)gmail.com> wrote:
>>>>>>
>>>>>>> Hi Nafise
>>>>>>>
>>>>>>>
>>>>>>> I need to make a periodic lattice with hole. In fact I should make holes on the scattering region and also on the leads. Although I can make this kind of lattice by kwant, I have problem about the distances between holes. I want to make a periodic holes on the nanoribbon but the distance between holes in the scattering region is different from the distance between holes in the other regions. Would you please let me know How Can I make a same distance between holes? Should I work on the translational symmetry in the leads?
>>>>>>>
>>>>>>>
>>>>>>> Because the leads need to be translationally invariant if you want a
>>>>>>> very large distance between defects then your unit cell in the leads needs
>>>>>>> to be correspondingly large.
>>>>>>>
>>>>>>> If you post a code example of what your problem is specifically we
>>>>>>> may be able to help more.
>>>>>>>
>>>>>>>
>>>>>>> Happy Kwanting,
>>>>>>>
>>>>>>> Joe
>>>>>>>
>>>>>>>
>>>>>>> P.S. sorry for the double reply; I forgot to send to the mailing
>>>>>>> list also
>>>>>>>
>>>>>>>
>>>
>>> --
>>> Abbout Adel
>>>
>>