Dear Djawad, There was a mistaping for the second option. you use kwant.TranslationalSymmetry((-1,-1,+1) or kwant.TranslationalSymmetry((+1,+ 1,-1) instead of kwant.TranslationalSymmetry((-1,-1,0). Best.
Le lun. 19 juil. 2021 à 17:04, Adel Belayadi <adelp...@gmail.com> a écrit : > > > > > Dear Djawad > > You have to be careful while calling Kwant.TranslationalSymmetry. Try to > see you lattice definition > > > > *lat = kwant.lattice.general([(0, 0.5, 0.5), (0.5, 0, 0.5), (0.5, 0.5, > 0)], [(0, 0, 0), (0.25, 0.25, 0.25)], name=['a1', 'a2']) a1, a2 = > lat.sublattices* > > It is normal to get such a resulting lead in the Z direction since you > have defined your basis vector in the yz, xz, and zy plans. So your > definition of the lattice vectors is somehow tricky if you want to > compare them with a cubic lattice where the basis vectors are (ax, 0, 0), > (0, az, 0) and (0, 0, ac). > > So in your lattice when you call kwant.TranslationalSymmetry((0,0,-1) the > lead will be created along the xy plan since your third lattice vector is > ((0.5, > 0.5, 0)), that is why you get a lead in the Z direction. > > If I am getting your idea you are using a primitive unit cell of > Face-centered Cubic. I guess it is better to work with Conventional > lattices (a, 0, 0), (0, a, 0) and (0, 0, a). > > If your primitive unit cell is (0, a, a), (a, 0, a), (a, a, 0), so your > conventional > lattice will be (2*a, 0, 0), (0, 2*a, 0) and (0, 0, 2*a) where a=0.5 in > your case. In this case, it is correct to use > kwant.TranslationalSymmetry((0,0,-1). > > Second option, if you like to keep your lattice definition and work with a > primitive unit cell, you need simply to use kwant.TranslationalSymmetry((- > 1,-1,0). > > I hope this will help > > Best > > Adel > > Le lun. 19 juil. 2021 à 11:52, tavakkolidjawad <tavakkolidja...@ut.ac.ir> > a écrit : > >> On 2021-07-19 02:21, Adel Belayadi wrote: >> >> Dear Djawad, >> >> Great that you have fixed your previous problem. No back to you issues >> >> A) >> >> *There was no problem with scattering regions and also for lead-related >> to the cubic lattice, but the one which related to my new structure had an >> unexpected shape. You can see both in the attachment. I use the following >> code to define the shape of leads for both structures. If it is possible >> for you please check them and let me know what did I not consider?* >> >> >> For this part, I cannot suggest anything since you have not said anything >> about your new structure. Depicted figure says nothing to me. It is >> better to explain more. >> >> >> *B)* >> >> *When we want to connect two different lattices, we have to do it >> manually. If I connect the two lattices in the following way, I will not >> lose anything?* >> >> *###################* >> >> >> >> *for i in range(-a,a): for j in range(-a,a): for k in range(-a,a):* >> >> Same answer, you are talking about two different lattices but I don't see >> any lattice in your script. However, I can highlight one remark in your >> script. If you are connecting the two lattices in the z directions you >> don't use for *k** in range(-a,a).* you have to provide only the z >> position where the two lattices will be connected. This is fully explained >> in Kwant FAQ. >> >> From my side, what you have given is not clear enough to help. >> >> Best, Adel >> >> Le dim. 18 juil. 2021 à 13:46, tavakkolidjawad <tavakkolidja...@ut.ac.ir> >> a écrit : >> >>> On 2021-06-22 20:26, Adel Belayadi wrote: >>> >>> Dera Djawad, >>> I do not see why the angle is different. From my side, I have updated my >>> system recently and I am having a problem with the 3D plot in kwant >>> ''AttributeError: 'Path3DCollection' object has no >>> attribute'_z_markers_idx'''. >>> >>> >>> However, I can suggest the following propositions. >>> 1. Since you are not using a magnetic field in your system, the angle >>> does not affect your results. In fact the physical quantities would only >>> depend on the hopping, scattering direction and number of sites. So you can >>> step forward with this structure. >>> 2. In the def main():you have written *syst.attach_lead(lead)* I don't >>> see why since you have already attached the lead in your main script. >>> 3. Try to see the following link which provides an example on how to add >>> a lead in a 3d space (scroll down and you will see). >>> >>> >>> *ps * >>> *https://kwant-project.org/doc/dev/tutorial/faq >>> <https://kwant-project.org/doc/dev/tutorial/faq>* >>> >>> Cheers, Adel >>> >>> Le dim. 20 juin 2021 à 10:45, tavakkolidjawad <tavakkolidja...@ut.ac.ir> >>> a écrit : >>> >>>> On 2021-06-19 01:30, Adel Belayadi wrote: >>>> >>>> Dear Javad tavakoli, >>>> >>>> I think you need to see the kwant documentation carefully. From the >>>> first look at your script I can notice the following statements. >>>> >>>> >>>> So let us start with the symmetry and the shape of your lead. >>>> >>>> First you have used * kwant.TranslationalSymmetry((0,0,1))* which >>>> means you are going along the z direction where -2pi/z<Kz<+2pi/z. >>>> >>>> Second you have defined the lead shape as a finite shape since you have >>>> included 10 <= z < 25 >>>> >>>> >>>> >>>> *def lead_shape(pos): x,y,z = pos return 0 <= x < a and 0 <= y < b >>>> and 10 <= z < 25* >>>> >>>> I guess if you omit *10 <= z < 25* from *def lead_shape(pos)* you >>>> would get something meaningful. >>>> >>>> Try to fix this problem and let me know if working or not >>>> Best wishes >>>> Adel >>>> >>>> Le ven. 18 juin 2021 à 22:33, tavakkolidjawad <tavakkolidja...@ut.ac.ir> >>>> a écrit : >>>> >>>>> Dear all >>>>> >>>>> In the following code I have defined a three-dimensional structure. >>>>> The geometry of the lead and the scattering region are the same, but >>>>> the lead is not ploted as I expected. >>>>> I expected the lead to have a cubic structure. >>>>> What is the problem with my code? >>>>> >>>>> Thanks >>>>> >>>>> Javad tavakoli >>>>> >>>>> >>>>> >>>>> ############################################################################ >>>>> >>>>> >>>>> ############################################################################ >>>>> >>>>> import kwant >>>>> >>>>> >>>>> lat = kwant.lattice.general([(0, 0.5, 0.5), (0.5, 0, 0.5), (0.5, 0.5, >>>>> 0)], >>>>> [(0, 0, 10), (0.25, 0.25, 10.25)], name=['a1', 'a2']) >>>>> a1, a2 = lat.sublattices >>>>> >>>>> >>>>> >>>>> def make_system(a=10, b=10, c=30): >>>>> >>>>> syst = kwant.Builder() >>>>> >>>>> def cuboid_shape(pos): >>>>> x, y, z = pos >>>>> return 0 <= x < a and 0 <= y < b and 0 <= z < 10 >>>>> >>>>> syst[a1.shape(cuboid_shape, (0, 0, 0))] = 1 >>>>> syst[a2.shape(cuboid_shape, (0, 0, 0))] = 1 >>>>> syst[lat.neighbors()] = 1 >>>>> >>>>> >>>>> def lead_shape(pos): >>>>> x,y,z = pos >>>>> return 0 <= x < a and 0 <= y < b and 10 <= z < 25 >>>>> >>>>> lead = kwant.Builder(kwant.TranslationalSymmetry((0,0,1))) >>>>> lead[a1.shape(lead_shape, (0, 0, 10))] = 1 >>>>> lead[a2.shape(lead_shape, (0, 0, 10))] = 1 >>>>> lead[lat.neighbors()] = 1 >>>>> >>>>> >>>>> syst.attach_lead(lead) >>>>> syst.attach_lead(lead.reversed()) >>>>> >>>>> >>>>> return syst , lead >>>>> >>>>> >>>>> def main(): >>>>> >>>>> syst,lead= make_system() >>>>> >>>>> kwant.plot(syst) >>>>> >>>>> syst,lead = make_system(a=1.1, b=1.1, c=1.1) >>>>> >>>>> syst.attach_lead(lead) >>>>> >>>>> if __name__ == '__main__': >>>>> main() >>>>> >>>>> >>>>> ########################################################################### >>>>> >>>> >>>> >>>> Dear Adel >>>> >>>> I greatly appreciate your consideration. >>>> >>>> I fix the problem. Now I have the same shape in the scattering region >>>> and lead. >>>> >>>> A new problem that arises is that the angles of the structure are >>>> different. >>>> >>> >>> >>> dear Adel >>> >>> Thank you for your response. >>> This email has two parts. The first part is related to the previous >>> email and in the second part, I asked about hopping between sites of two >>> different lattices. >>> >>> >>> A) >>> >>> As you suggested, I read the documentation again. >>> I can straightforwardly work with cubic lattice and build the scattering >>> region and leads properly. >>> As I mentioned in my previous email, the structure had different angles. >>> I try to plot the scattering region and lead separately for both cubic >>> lattice and my new structure. There was no problem with scattering regions >>> and also for lead-related to the cubic lattice, but the one which related >>> to my new structure had an unexpected shape. you can see both in the >>> attachment. I use the following code to define the shape of leads for both >>> structures. If it is possible for you please check them and let me know >>> what did I not consider? >>> >>> ###################################### >>> >>> def lead_shape(pos): >>> x,y,z= pos >>> return 0 <= x < 15 and 0 <= y < 15 >>> >>> lead = kwant.Builder(kwant.TranslationalSymmetry((0,0,1))) >>> lead[a1.shape(lead_shape, (0, 0, 25))] = 4 >>> lead[a2.shape(lead_shape, (0, 0, 25))] = 4 >>> lead[lat.neighbors()] = 1 >>> >>> ====================================== >>> >>> def lead_shape(pos): >>> x,y,z = pos >>> return 0 <= x < 15 and 0 <= y < 15 >>> >>> lead = kwant.Builder(kwant.TranslationalSymmetry((0,0,1))) >>> lead[lat.shape(lead_shape, (0, 0, 25))] = 4 >>> lead[lat.neighbors()] = 1 >>> >>> ###################################### >>> >>> >>> B) >>> >>> When we want to connect two different lattices, we have to do it >>> manually. If I connect the two lattices in the following way, I will not >>> lose anything? >>> >>> ################### >>> >>> for i in range(-a,a): >>> for j in range(-a,a): >>> for k in range(-a,a): >>> try: >>> syst[(a1(i,j,k), subA(i,j))] = 1j >>> syst[(a2(i,j,k), subB(i,j))] = 1j >>> syst[(a1(i,j,k), subB(i,j))] = 1j >>> syst[(a2(i,j,k), subA(i,j))] = 1j >>> except: >>> pass >>> ################### >>> >>> Regards >>> Javad >>> >> >> dear Adel >> >> for more explanation of part one, I defined a lead in the polyatomic >> lattice: >> >> >> ############################################################### >> >> import kwant >> >> >> lat = kwant.lattice.general([(0, 0.5, 0.5), (0.5, 0, 0.5), (0.5, 0.5, 0)], >> [(0, 0, 0), (0.25, 0.25, 0.25)], name=['a1', 'a2']) >> a1, a2 = lat.sublattices >> >> def make_system(a=10, b=10, c=30): >> >> syst = kwant.Builder() >> >> def cuboid_shape(pos): >> x, y, z = pos >> return 0 <= x < a and 0 <= y < b and 0 <= z < 10 >> >> syst[a1.shape(cuboid_shape, (0, 0, 0))] = 1 >> syst[a2.shape(cuboid_shape, (0, 0, 0))] = 1 >> syst[lat.neighbors()] = 1 >> >> >> def lead_shape(pos): >> x,y,z = pos >> return 0 <= x < a and 0 <= y < b >> >> lead = kwant.Builder(kwant.TranslationalSymmetry((0,0,-1))) >> lead[a1.shape(lead_shape, (0, 0, 0))] = 1 >> lead[a2.shape(lead_shape, (0, 0, 0))] = 1 >> lead[lat.neighbors()] = 1 >> >> >> syst.attach_lead(lead) >> syst.attach_lead(lead.reversed()) >> >> >> return syst , lead >> >> >> def main(): >> >> syst,lead= make_system() >> >> kwant.plot(syst) >> >> kwant.plot(lead) >> >> if __name__ == '__main__': >> main() >> >> ############################################################### >> >> >> I want to know in spite of that I don't consider Z direction in the shape >> function (15,15,0), why the resulting lead has value in the Z direction? >> >> I was expecting to get a square lead in the X and Y direction just like >> the one I get with the same idea from the cubic lattice. >> >> You can also see the cube structure code below which worked well as I >> expected. If you run the following code you will see a square lead in the >> direction of x, y, and z = 0. >> >> >> ############################################################### >> >> import kwant >> lat = kwant.lattice.cubic(1) >> >> def make_system(l=15 , b=15, c=25): >> >> syst = kwant.Builder() >> >> def cuboid_shape(pos): >> x, y, z = pos >> return 0 <= x < l and 0 <= y < b and 0 <= z < c >> >> syst[lat.shape(cuboid_shape, (0, 0, 0))] = 4 >> syst[lat.neighbors()] = 1 >> >> >> def lead_shape(pos): >> x,y,z = pos >> return 0 <= x < 15 and 0 <= y < 15 >> >> lead = kwant.Builder(kwant.TranslationalSymmetry((0,0,1))) >> lead[lat.shape(lead_shape, (0, 0, 25))] = 4 >> lead[lat.neighbors()] = 1 >> >> return syst , lead >> >> >> def main(): >> >> syst,lead= make_system() >> >> kwant.plot(syst,fig_size=(10,9)) >> kwant.plot(lead) >> >> if __name__ == '__main__': >> main() >> ############################################################### >> >> Finally, thank you very much for your unwavering support. >> >> Regards >> Javad >> >