Re: [Kwant] discontinuity between lead and scattering region
Dear sir, As you said I tried the wraparound module but I got errors while diagonalizing the system. I don't know how to use this module for 3D system. Please help. The code is attached below UserCodeError: Error occurred in user-supplied value function "f". See the upper part of the above backtrace for more information. sys=kwant.Builder(kwant.TranslationalSymmetry((0,0,-1))) lat=kwant.lattice.cubic(norbs=2) sys[(lat(x,y,0) for x in range(L) for y in range(W))]=onsite sys[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = hoppingx sys[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = hoppingy sys[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = hoppingz #lead=kwant.Builder(kwant.TranslationalSymmetry((0,0,-1))) #lead[(lat(x,y,z) for x in range(L) for y in range(W)for z in range(H))]=onsite #lead[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = hoppingx #lead[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = hoppingy #lead[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = hoppingz #sys.attach_lead(lead) #sys.attach_lead(lead.reversed()) sys = kwant.wraparound.wraparound(sys, keep=None) kwant.plot(sys) sysf=sys.finalized() ham_mat = sysf.hamiltonian_submatrix() ev = sla.eigsh(ham_mat, k=31, which='SM') evecs = ev[1] prob_dens = np.abs(evecs[:, 30])**2 #print(prob_dens) #Sites=list(sysf.sites) #rho = kwant.operator.Density(sysf) #density = rho(psi) #wf_sqr = sum(rho(psi) for psi in wf(0)) On Fri, May 8, 2020 at 3:30 AM Abbout Adel wrote: > Sorry, Naveen. I don't have an example ready to use. > > The idea behind is that the wraparound module helps you in getting the > homiltonian for each K point: H(kx,ky,kz) > > Diagonalizing it will give you E(kx,ky,kz) which means a point (or few > points for a multiband system) > the eigenvectors will help you to calculate the density for a given mode. > > I hope this helps, > > Adel > > On Thu, May 7, 2020 at 9:46 PM Naveen Yadav > wrote: > >> Dear sir, >> Could you please provide me an working example of this type? >> >> Best Regards >> Naveen Yadav >> Research Scholar >> Department of Physics & Astrophysics >> University of Delhi >> New Delhi-110007 >> >> On Thu, May 7, 2020, 20:37 Abbout Adel wrote: >> >>> Hi again, >>> >>> I f you want translational symmetry, you need to use wraparound module >>> and you will need to find your result only on one unit cell. >>> You will have also to do integration on the Brillouin zone. >>> >>> I hope this helps >>> Adel >>> >>> On Thu, May 7, 2020 at 5:12 PM Naveen Yadav >>> wrote: >>> >>>> Dear sir, >>>> I understand what you have said. But how can I maintain translation >>>> symmetry ?because my system is 3D and for plotting current I access the >>>> sites of 3D system using *list(sys.sites) *and plot the current for 2D >>>> slice. Please suggest me. >>>> >>>> Best Regards >>>> Naveen Yadav >>>> Research Scholar >>>> Department of Physics & Astrophysics >>>> University of Delhi >>>> New Delhi-110007 >>>> >>>> On Thu, May 7, 2020, 19:06 Abbout Adel wrote: >>>> >>>>> Dear Naveen, >>>>> >>>>> What you get is what is expected. You do not have translational >>>>> symmetry. >>>>> Rewrite your code by keeping only two dimensions and you will see why. >>>>> >>>>> I hope this helps, >>>>> Adel >>>>> >>>>> >>>>> On Thu, May 7, 2020 at 12:52 PM Naveen Yadav >>>>> wrote: >>>>> >>>>>> Dear KWANT Developers, >>>>>> I am trying to plot the current density. The procedure is >>>>>> straightforward. I have attached leads to the scattering region (leads >>>>>> have >>>>>> same onsite and hopping as of the scattering region) as >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> *sys[(lat(z,y,x) for z in range(H) for y in range(W)for x in >>>>>> range(L))]=onsitesys[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = >>>>>> hoppingzsys[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = >>>>>> hoppingysys[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = >>>>>> hoppingxlead=kwant.Builder(kwant.TranslationalSymmetry((1,0,0
Re: [Kwant] discontinuity between lead and scattering region
Dear sir, Could you please provide me an working example of this type? Best Regards Naveen Yadav Research Scholar Department of Physics & Astrophysics University of Delhi New Delhi-110007 On Thu, May 7, 2020, 20:37 Abbout Adel wrote: > Hi again, > > I f you want translational symmetry, you need to use wraparound module and > you will need to find your result only on one unit cell. > You will have also to do integration on the Brillouin zone. > > I hope this helps > Adel > > On Thu, May 7, 2020 at 5:12 PM Naveen Yadav > wrote: > >> Dear sir, >> I understand what you have said. But how can I maintain translation >> symmetry ?because my system is 3D and for plotting current I access the >> sites of 3D system using *list(sys.sites) *and plot the current for 2D >> slice. Please suggest me. >> >> Best Regards >> Naveen Yadav >> Research Scholar >> Department of Physics & Astrophysics >> University of Delhi >> New Delhi-110007 >> >> On Thu, May 7, 2020, 19:06 Abbout Adel wrote: >> >>> Dear Naveen, >>> >>> What you get is what is expected. You do not have translational symmetry. >>> Rewrite your code by keeping only two dimensions and you will see why. >>> >>> I hope this helps, >>> Adel >>> >>> >>> On Thu, May 7, 2020 at 12:52 PM Naveen Yadav >>> wrote: >>> >>>> Dear KWANT Developers, >>>> I am trying to plot the current density. The procedure is >>>> straightforward. I have attached leads to the scattering region (leads have >>>> same onsite and hopping as of the scattering region) as >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> *sys[(lat(z,y,x) for z in range(H) for y in range(W)for x in >>>> range(L))]=onsitesys[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = >>>> hoppingzsys[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = >>>> hoppingysys[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = >>>> hoppingxlead=kwant.Builder(kwant.TranslationalSymmetry((1,0,0)))lead[(lat(z,y,x) >>>> for z in range(H) for y in range(W)for x in >>>> range(L))]=onsitelead[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = >>>> hoppingzlead[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = >>>> hoppingylead[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = >>>> hoppingxsys.attach_lead(lead, >>>> add_cells=80)sys.attach_lead(lead.reversed())* >>>> [image: image.png] >>>> As you can see from the plot there is a discontinuity in the plot at >>>> (W=20). Why it is so even if the scattering region and leads have same >>>> onsite and hopping and there is translation symmetry throughout ? >>>> >>>> -- >>>> Best Regards, >>>> Naveen Yadav >>>> Research Scholar >>>> Department of Physics & Astrophysics >>>> University Of Delhi >>>> New Delhi-110007 >>>> >>> >>> >>> -- >>> Abbout Adel >>> >> > > -- > Abbout Adel >
Re: [Kwant] discontinuity between lead and scattering region
Dear sir, I understand what you have said. But how can I maintain translation symmetry ?because my system is 3D and for plotting current I access the sites of 3D system using *list(sys.sites) *and plot the current for 2D slice. Please suggest me. Best Regards Naveen Yadav Research Scholar Department of Physics & Astrophysics University of Delhi New Delhi-110007 On Thu, May 7, 2020, 19:06 Abbout Adel wrote: > Dear Naveen, > > What you get is what is expected. You do not have translational symmetry. > Rewrite your code by keeping only two dimensions and you will see why. > > I hope this helps, > Adel > > > On Thu, May 7, 2020 at 12:52 PM Naveen Yadav > wrote: > >> Dear KWANT Developers, >> I am trying to plot the current density. The procedure is >> straightforward. I have attached leads to the scattering region (leads have >> same onsite and hopping as of the scattering region) as >> >> >> >> >> >> >> >> >> >> >> >> *sys[(lat(z,y,x) for z in range(H) for y in range(W)for x in >> range(L))]=onsitesys[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = >> hoppingzsys[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = >> hoppingysys[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = >> hoppingxlead=kwant.Builder(kwant.TranslationalSymmetry((1,0,0)))lead[(lat(z,y,x) >> for z in range(H) for y in range(W)for x in >> range(L))]=onsitelead[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = >> hoppingzlead[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = >> hoppingylead[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = >> hoppingxsys.attach_lead(lead, add_cells=80)sys.attach_lead(lead.reversed())* >> [image: image.png] >> As you can see from the plot there is a discontinuity in the plot at >> (W=20). Why it is so even if the scattering region and leads have same >> onsite and hopping and there is translation symmetry throughout ? >> >> -- >> Best Regards, >> Naveen Yadav >> Research Scholar >> Department of Physics & Astrophysics >> University Of Delhi >> New Delhi-110007 >> > > > -- > Abbout Adel >
[Kwant] discontinuity between lead and scattering region
Dear KWANT Developers, I am trying to plot the current density. The procedure is straightforward. I have attached leads to the scattering region (leads have same onsite and hopping as of the scattering region) as *sys[(lat(z,y,x) for z in range(H) for y in range(W)for x in range(L))]=onsitesys[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = hoppingzsys[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = hoppingysys[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = hoppingxlead=kwant.Builder(kwant.TranslationalSymmetry((1,0,0)))lead[(lat(z,y,x) for z in range(H) for y in range(W)for x in range(L))]=onsitelead[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = hoppingzlead[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = hoppingylead[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = hoppingxsys.attach_lead(lead, add_cells=80)sys.attach_lead(lead.reversed())* [image: image.png] As you can see from the plot there is a discontinuity in the plot at (W=20). Why it is so even if the scattering region and leads have same onsite and hopping and there is translation symmetry throughout ? -- Best Regards, Naveen Yadav Research Scholar Department of Physics & Astrophysics University Of Delhi New Delhi-110007
Re: [Kwant] 3D Current Density
Thank you for the clarification. Best Regards Naveen Yadav Research Scholar Department of Physics & Astrophysics University of Delhi New Delhi-110007 On Wed, Mar 25, 2020, 18:50 Ousmane LY wrote: > Dear Naveen, > if you want to use a 2d system to represent local properties of a 3d > system, the former shouldn’t be considered as a physical system. Therefore, > its onsite and hopping values are not relevant and shouldn’t alter your > calculations in any sens. Even attaching leads for the 2d system may not be > necessary. > However, you have to be sure that the 2d system represents well the 2d > plane of the underlying 3d geometry. This would concern mainly the number > of sites and links. > You may have a look to the illustration below. > Happy kwanting, > Ousmane, > > > import kwant > > def make_3d(L=5,W=5,H=5): > # make a 3d system > sys=kwant.Builder() > lat=kwant.lattice.cubic(norbs=1) > sys[(lat(x,y,z) for x in range(L) for y in range(W) for z in > range(H))]=0 > sys[lat.neighbors()]=-1 > > lead=kwant.Builder(kwant.TranslationalSymmetry((-1,0,0))) > lead[(lat(0,y,z) for y in range(W) for z in range(H))] = -1 > lead[lat.neighbors()]=-1 > sys.attach_lead(lead) > > return sys.finalized() > > def make_2d(W=5,H=5): > # make an auxiliary 2d system > sys=kwant.Builder() > lat=kwant.lattice.square() > sys[(lat(y,z) for y in range(W) for z in range(H) )]= " " > sys[lat.neighbors()]= " " > return sys.finalized() > > def main(): > # calculate the current at a given (y,z) plane > given_x=0 # e.g > def where(site1,site2): > return site1.pos[0]==given_x and site2.pos[0]==given_x > > psi=kwant.wave_function(make_3d(),energy=0)(0)[0] # lowest mode of > lead 0 > current=kwant.operator.Current(make_3d(), where=where)(psi) > > # plot the current using the auxiliary 2d system > kwant.plotter.current(make_2d(), current) > > if __name__=='__main__': > main() > > ##
[Kwant] 3D Current Density
Dear KWANT developers, I want to plot the current density for a 3D model with finite width in x and y direction. Below is the energy dispersion of the model Hamiltonian. To calculate the current density profile, I have assumed scattering region with a width of 60 unit cells in z-direction and leads with different onsite and same hoppings (as that of scattering region) are attached. For better understanding the code is attached below. For plotting current density, I have used 2D slices of y-z plane. Now my question is that, while building the second system, what onsite and Hopping terms should I have to use? Because I have already build a 3D system with particular onsite and hopping terms. Can I use onsite =0 for the second system? and what should be the hoppings for the second system? can I use simply lat2.neighbors() for the second system? I tried it in different ways, it gives me different results. I don't know which one correct. please suggest me the correct way. [image: image.png] *import kwantfrom numpy import exp,sin,linspace,sqrt, cos, piimport matplotlib as mplfrom matplotlib import pyplot as pltimport tinyarrayimport pandas as pd* *sigma_0 = tinyarray.array([[1, 0], [0, 1]])sigma_x = tinyarray.array([[0, 1], [1, 0]])sigma_y = tinyarray.array([[0, -1j], [1j, 0]])sigma_z = tinyarray.array([[1, 0], [0, -1]])lat=kwant.lattice.cubic(norbs=2)L=10W=80#H=60def onsite(site): return (1.0 * cos(1.05) + 2 * 1.0) * sigma_z* *def onsite_s(site):return (1.0 * cos(1.05) + 2 * 1.0) * sigma_z - 0.75 * sigma_0def hoppingx(site0, site1):return (-0.5 * 1.0 * sigma_z - 0.5 * 1j * 1.0 * sigma_x)def hoppingy(site0, site1):return -0.5 * 1.0 * sigma_z - 0.5 * 1j * 1.0 * sigma_ydef hoppingz(site0, site1):y = site1.pos[1]return (-0.5 * 1.0 * sigma_z - 0.5 * 1j * 0.25 * sigma_0) * exp(-2 * pi * 1j * 0.001 * 1.0 * (y-40))sys=kwant.Builder()sys[(lat(z,y,x) for z in range(0,10) for y in range(W) for x in range(L))]=onsite_ssys[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = hoppingxsys[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = hoppingysys[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = hoppingzsys[(lat(z,y,x) for z in range(10,70) for y in range(W) for x in range(L))]=onsitesys[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = hoppingxsys[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = hoppingysys[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = hoppingzsys[(lat(z,y,x) for z in range(70,80) for y in range(W) for x in range(L))]=onsite_ssys[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = hoppingxsys[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = hoppingysys[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = hoppingz* *# The scattering region 0 < W_z < 10 and 60 < W_z > 70 have onsite energy of leads.* *lead=kwant.Builder(kwant.TranslationalSymmetry((-1,0,0)))lead[(lat(0,y,x) for y in range(W) for x in range(L))] = onsite_slead[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = hoppingzlead[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = hoppingylead[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = hoppingxsys.attach_lead(lead)sys.attach_lead(lead.reversed())kwant.plot(sys)sysf=sys.finalized()Sites=list(sysf.sites)#print(Sites)wave=kwant.wave_function(sysf, energy=0.1)psi=wave(0)[0]#df = pd.DataFrame(Sites)#df.to_csv('data2.csv',index=False, header=False)def Plot(x,psi): def cut(site0,site1):return site0.pos[2]==x and site1.pos[2]==xJ_0 = kwant.operator.Current(sysf, where=cut) current = J_0(psi)lat2=kwant.lattice.square(norbs=2) sys2=kwant.Builder()sys2[(lat2(site.pos[0],site.pos[1]) for site in Sites if site.pos[2]==x)]=onsite* *#sys2[(lat2(site.pos[0],site.pos[1]) for site in Sites if site.pos[2]==x)]=0* *sys2[kwant.builder.HoppingKind((1, 0), lat2, lat2)] = hoppingz sys2[kwant.builder.HoppingKind((0, 1), lat2, lat2)] = hoppingy* *#sys2[lat2.neighbors()]=-sigma_0* *#lead2=kwant.Builder(kwant.TranslationalSymmetry((-1, 0))) #lead2[(lat2(site.pos[0], site.pos[1]) for site in Sites if site.pos[2]==x)]=onsite_s#lead2[kwant.builder.HoppingKind((1, 0), lat2, lat2)] = hoppingz#lead2[kwant.builder.HoppingKind((0, 1), lat2, lat2)] = hoppingy#sys2.attach_lead(lead2) #sys2.attach_lead(lead2.reversed()) sys2f=sys2.finalized() #kwant.plot(sys2f)kwant.plotter.current(sys2f, current)for i in range(10):Plot(i,psi)* -- With Best Regards Naveen Yadav Ph.D Research Scholar Deptt. Of Physics & Astrophysics University Of Delhi.
[Kwant] Adding long range hopping to the system
Dear Kwant developers, I want to add second neighbour hoppings to the system in the similar way as I did for the first nearest neighbour *syst = kwant.Builder()lat = kwant.lattice.cubic(a)syst[(lat(z, y, x) for z in range(H) for y in range(W) for x in range(L))] = onsite* *syst[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = hoppingx syst[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = hoppingy syst[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = hoppingz* Please suggest if there is a way to do that. Thank you. Naveen
Re: [Kwant] Plotting energy as a function of magnetic field in 3D.
dear sir, I have tried it for 3D BHZ model but it is not working. Does it work for only 2D system. On Thu, Sep 12, 2019 at 1:54 PM Anton Akhmerov wrote: > Great, > > Just to add a concluding remark: Landau fan requires a continuum > approximation of the Hamiltonian. If you start with a tight-binding > Hamiltonian you'd get fractal spectrum and the Hofstadter butterfly > instead. > > Happy Kwanting, > Anton > > On Thu, 12 Sep 2019 at 10:09, Naveen Yadav > wrote: > > > > The second problem is solved. I got the landau fan for BHZ model. > > Thank you for the support. > > > > > > On Thu, Sep 12, 2019, 12:46 Naveen Yadav > wrote: > >> > >> Dear sir, > >> > >> I have updated KWANT, but it shows the AttributeError: module > 'kwant.continuum' has no attribute 'discretize_landau'. And in browser > also, it is showing the same error. I have downloaded the landau_levels.py > file and put it into the continuum folder. But it is not working. > >> > >> > >> On Wed, Sep 11, 2019, 23:47 Naveen Yadav > wrote: > >>> > >>> Dear sir, > >>> > >>> That is exactly what I am looking for. > >>> But in my case Hamiltonian is not polynomial in k. It contains Sine > and Cosine terms. It's a tight binding Hamiltonian having coupling terms > like sigma_x *Sin(kx)+ sigma_y *sin(ky) and mass term in the trignometric > form. So, can I proceed by writing the trignometric terms in some lower > order polynomial terms? Does that make sense? > >>> Please make some comment regarding this. > >>> Thank you very much. > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> Naveen > >>> Department of Physics & Astrophysics > >>> University of Delhi > >>> New Delhi-110007 > >>> > >>> On Wed, Sep 11, 2019, 22:18 Anton Akhmerov < > anton.akhmerov...@gmail.com> wrote: > >>>> > >>>> Dear Naveen, > >>>> > >>>> If you are dealing with a continuum Hamiltonian (so a polynomial in > >>>> k-space), then there is a recent addition to Kwant, that allows to > >>>> compute Landau levels. Please check out if this tutorial is what you > >>>> are looking for: > >>>> > https://kwant-project.org/doc/dev/tutorial/magnetic_field#adding-magnetic-field > >>>> (if you click the "activate thebelab" button, you can also play around > >>>> with the code in your browser). > >>>> > >>>> If that suits your needs, you'd need to either install a development > >>>> version of Kwant or just get this file: > >>>> > https://gitlab.kwant-project.org/kwant/kwant/blob/master/kwant/continuum/landau_levels.py > >>>> > >>>> Let me know if that answers your question, > >>>> Anton > >>>> > >>>> On Wed, 11 Sep 2019 at 18:39, Naveen Yadav > wrote: > >>>> > > >>>> > Dear sir, > >>>> > > >>>> > I understood that this code is off no use. The leads are useless > here. > >>>> > Actually, I want to plot the Landau fan. Can KWANT do the job here? > >>>> > > >>>> > > >>>> > > >>>> > > >>>> > > >>>> > > >>>> > > >>>> > > >>>> > > >>>> > > >>>> > > >>>> > Naveen > >>>> > Department of Physics & Astrophysics > >>>> > University of Delhi > >>>> > New Delhi-110007 > >>>> > > >>>> > On Mon, Sep 9, 2019, 00:50 Abbout Adel > wrote: > >>>> >> > >>>> >> Dear Naveen, > >>>> >> > >>>> >> If your concern is the program which is slow, that is not an issue > since it takes just few minutes. > >>>> >> Now, if you are talking about the result, I want to be sure that > you notice that your system is not infinite as you claim in your email. > >>>> >> You can check that by adding extra cells from the lead" > syst.attach_lead(lead, add_cells=10) > >>>> >> Actually, in your case, the presence of the leads is useless since > at the end, you are just diagonalizing the Hamiltonian of the central > system. > >&g
Re: [Kwant] Plotting energy as a function of magnetic field in 3D.
Dear sir, I have updated KWANT, but it shows the *AttributeError: module 'kwant.continuum' has no attribute 'discretize_landau'.* And in browser also, it is showing the same error. I have downloaded the landau_levels.py file and put it into the continuum folder. But it is not working. On Wed, Sep 11, 2019, 23:47 Naveen Yadav wrote: > Dear sir, > > That is exactly what I am looking for. > But in my case Hamiltonian is not polynomial in k. It contains Sine and > Cosine terms. It's a tight binding Hamiltonian having coupling terms like > sigma_x *Sin(kx)+ sigma_y *sin(ky) and mass term in the trignometric form. > So, can I proceed by writing the trignometric terms in some lower order > polynomial terms? Does that make sense? > Please make some comment regarding this. > Thank you very much. > > > > > > > > > > Naveen > Department of Physics & Astrophysics > University of Delhi > New Delhi-110007 > > On Wed, Sep 11, 2019, 22:18 Anton Akhmerov > wrote: > >> Dear Naveen, >> >> If you are dealing with a continuum Hamiltonian (so a polynomial in >> k-space), then there is a recent addition to Kwant, that allows to >> compute Landau levels. Please check out if this tutorial is what you >> are looking for: >> >> https://kwant-project.org/doc/dev/tutorial/magnetic_field#adding-magnetic-field >> (if you click the "activate thebelab" button, you can also play around >> with the code in your browser). >> >> If that suits your needs, you'd need to either install a development >> version of Kwant or just get this file: >> >> https://gitlab.kwant-project.org/kwant/kwant/blob/master/kwant/continuum/landau_levels.py >> >> Let me know if that answers your question, >> Anton >> >> On Wed, 11 Sep 2019 at 18:39, Naveen Yadav >> wrote: >> > >> > Dear sir, >> > >> > I understood that this code is off no use. The leads are useless here. >> > Actually, I want to plot the Landau fan. Can KWANT do the job here? >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > Naveen >> > Department of Physics & Astrophysics >> > University of Delhi >> > New Delhi-110007 >> > >> > On Mon, Sep 9, 2019, 00:50 Abbout Adel wrote: >> >> >> >> Dear Naveen, >> >> >> >> If your concern is the program which is slow, that is not an issue >> since it takes just few minutes. >> >> Now, if you are talking about the result, I want to be sure that you >> notice that your system is not infinite as you claim in your email. >> >> You can check that by adding extra cells from the lead" >> syst.attach_lead(lead, add_cells=10) >> >> Actually, in your case, the presence of the leads is useless since at >> the end, you are just diagonalizing the Hamiltonian of the central system. >> >> If you want to study an infinite system in x and y, you need to look >> at the module "wraparound" and the example of graphene that is in the >> archive of kwant. >> >> For the magnetic field, you can use the Pierls substitution. check for >> example this paper [1] >> >> >> >> You can also think about the use of continuous Hamiltonian in kwant. >> You may find it very useful [2] >> >> I hope this helps. >> >> >> >> Regards, >> >> Adel >> >> >> >> >> >> [1] https://arxiv.org/pdf/1601.06507.pdf >> >> [2] https://kwant-project.org/doc/1/tutorial/discretize >> >> >> >> On Sun, Sep 8, 2019 at 6:16 PM Naveen Yadav >> wrote: >> >>> >> >>> Dear Sir, >> >>> Thanks for the tips. As you told, I have tried in other way also but >> I am getting the same result which are very tedious. I don't know where is >> fault. >> >>> Now the code looks like >> >>> >> >>> import kwant >> >>> import scipy.sparse.linalg as sla >> >>> import matplotlib.pyplot as plt >> >>> import tinyarray >> >>> import numpy as np >> >>> from numpy import cos, sin, pi >> >>> import cmath >> >>> from cmath import exp >> >>> >> >>> sigma_0 = tinyarray.array([[1, 0], [0, 1]]) >> >>> sigma_x = tinyarray.array([[0, 1], [1, 0]]) >> >>> sigma_y = tinyarray.array([[0, -1j], [1j, 0]]) >> >>> s
Re: [Kwant] Plotting energy as a function of magnetic field in 3D.
Dear sir, That is exactly what I am looking for. But in my case Hamiltonian is not polynomial in k. It contains Sine and Cosine terms. It's a tight binding Hamiltonian having coupling terms like sigma_x *Sin(kx)+ sigma_y *sin(ky) and mass term in the trignometric form. So, can I proceed by writing the trignometric terms in some lower order polynomial terms? Does that make sense? Please make some comment regarding this. Thank you very much. Naveen Department of Physics & Astrophysics University of Delhi New Delhi-110007 On Wed, Sep 11, 2019, 22:18 Anton Akhmerov wrote: > Dear Naveen, > > If you are dealing with a continuum Hamiltonian (so a polynomial in > k-space), then there is a recent addition to Kwant, that allows to > compute Landau levels. Please check out if this tutorial is what you > are looking for: > > https://kwant-project.org/doc/dev/tutorial/magnetic_field#adding-magnetic-field > (if you click the "activate thebelab" button, you can also play around > with the code in your browser). > > If that suits your needs, you'd need to either install a development > version of Kwant or just get this file: > > https://gitlab.kwant-project.org/kwant/kwant/blob/master/kwant/continuum/landau_levels.py > > Let me know if that answers your question, > Anton > > On Wed, 11 Sep 2019 at 18:39, Naveen Yadav > wrote: > > > > Dear sir, > > > > I understood that this code is off no use. The leads are useless here. > > Actually, I want to plot the Landau fan. Can KWANT do the job here? > > > > > > > > > > > > > > > > > > > > > > > > Naveen > > Department of Physics & Astrophysics > > University of Delhi > > New Delhi-110007 > > > > On Mon, Sep 9, 2019, 00:50 Abbout Adel wrote: > >> > >> Dear Naveen, > >> > >> If your concern is the program which is slow, that is not an issue > since it takes just few minutes. > >> Now, if you are talking about the result, I want to be sure that you > notice that your system is not infinite as you claim in your email. > >> You can check that by adding extra cells from the lead" > syst.attach_lead(lead, add_cells=10) > >> Actually, in your case, the presence of the leads is useless since at > the end, you are just diagonalizing the Hamiltonian of the central system. > >> If you want to study an infinite system in x and y, you need to look at > the module "wraparound" and the example of graphene that is in the archive > of kwant. > >> For the magnetic field, you can use the Pierls substitution. check for > example this paper [1] > >> > >> You can also think about the use of continuous Hamiltonian in kwant. > You may find it very useful [2] > >> I hope this helps. > >> > >> Regards, > >> Adel > >> > >> > >> [1] https://arxiv.org/pdf/1601.06507.pdf > >> [2] https://kwant-project.org/doc/1/tutorial/discretize > >> > >> On Sun, Sep 8, 2019 at 6:16 PM Naveen Yadav > wrote: > >>> > >>> Dear Sir, > >>> Thanks for the tips. As you told, I have tried in other way also but I > am getting the same result which are very tedious. I don't know where is > fault. > >>> Now the code looks like > >>> > >>> import kwant > >>> import scipy.sparse.linalg as sla > >>> import matplotlib.pyplot as plt > >>> import tinyarray > >>> import numpy as np > >>> from numpy import cos, sin, pi > >>> import cmath > >>> from cmath import exp > >>> > >>> sigma_0 = tinyarray.array([[1, 0], [0, 1]]) > >>> sigma_x = tinyarray.array([[0, 1], [1, 0]]) > >>> sigma_y = tinyarray.array([[0, -1j], [1j, 0]]) > >>> sigma_z = tinyarray.array([[1, 0], [0, -1]]) > >>> > >>> > >>> def make_system(a=1, L=30, W=10, H=10, t=1.0, t_x=1.0, t_y=1.0, > t_z=1.0, lamda=0.1, beta=1.05): > >>> def onsite(site): > >>> return (t_z * cos(beta) + 2 * t) * sigma_z > >>> > >>> def hoppingx(site0, site1): > >>> return (-0.5 * t * sigma_z - 0.5 * 1j * t_x * sigma_x) > >>> > >>> def hoppingy(site0, site1): > >>> return -0.5 * t * sigma_z - 0.5 * 1j * t_y * sigma_y > >>> > >>> def hoppingz(site0, site1, B): > >>> y = site1.pos[1] > >>> return (-0.5 * t_z * sigma_z - 0.5 * 1j * lamda * sigma_0) * > exp(2 * pi * 1j * B * a * (y-40)) > >>&
Re: [Kwant] Plotting energy as a function of magnetic field in 3D.
Dear sir, I understood that this code is off no use. The leads are useless here. Actually, I want to plot the Landau fan. Can KWANT do the job here? Naveen Department of Physics & Astrophysics University of Delhi New Delhi-110007 On Mon, Sep 9, 2019, 00:50 Abbout Adel wrote: > Dear Naveen, > > If your concern is the program which is slow, that is not an issue since > it takes just few minutes. > Now, if you are talking about the result, I want to be sure that you > notice that your system is not infinite as you claim in your email. > You can check that by adding extra cells from the lead" syst.attach_lead( > lead, add_cells=10) > Actually, in your case, the presence of the leads is useless since at the > end, you are just diagonalizing the Hamiltonian of the central system. > If you want to study an infinite system in x and y, you need to look at > the module "wraparound" and the example of graphene that is in the archive > of kwant. > For the magnetic field, you can use the Pierls substitution. check for > example this paper [1] > > You can also think about the use of continuous Hamiltonian in kwant. You > may find it very useful [2] > I hope this helps. > > Regards, > Adel > > > [1] https://arxiv.org/pdf/1601.06507.pdf > [2] https://kwant-project.org/doc/1/tutorial/discretize > > On Sun, Sep 8, 2019 at 6:16 PM Naveen Yadav > wrote: > >> Dear Sir, >> Thanks for the tips. As you told, I have tried in other way also but I am >> getting the same result which are very tedious. I don't know where is fault. >> Now the code looks like >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> *import kwantimport scipy.sparse.linalg as slaimport matplotlib.pyplot as >> pltimport tinyarrayimport numpy as npfrom numpy import cos, sin, piimport >> cmathfrom cmath import expsigma_0 = tinyarray.array([[1, 0], [0, >> 1]])sigma_x = tinyarray.array([[0, 1], [1, 0]])sigma_y = >> tinyarray.array([[0, -1j], [1j, 0]])sigma_z = tinyarray.array([[1, 0], [0, >> -1]])def make_system(a=1, L=30, W=10, H=10, t=1.0, t_x=1.0, t_y=1.0, >> t_z=1.0, lamda=0.1, beta=1.05):def onsite(site):return (t_z * >> cos(beta) + 2 * t) * sigma_zdef hoppingx(site0, site1): >> return (-0.5 * t * sigma_z - 0.5 * 1j * t_x * sigma_x)def >> hoppingy(site0, site1):return -0.5 * t * sigma_z - 0.5 * 1j * t_y * >> sigma_ydef hoppingz(site0, site1, B):y = site1.pos[1] >> return (-0.5 * t_z * sigma_z - 0.5 * 1j * lamda * sigma_0) * exp(2 * pi * >> 1j * B * a * (y-40))syst = kwant.Builder()lat = >> kwant.lattice.cubic(a)syst[(lat(z, y, x) for z in range(H) for y in >> range(W) for x in range(L))] = onsitesyst[kwant.builder.HoppingKind((1, >> 0, 0), lat, lat)] = hoppingzsyst[kwant.builder.HoppingKind((0, 1, 0), >> lat, lat)] = hoppingysyst[kwant.builder.HoppingKind((0, 0, 1), lat, >> lat)] = hoppingx >> lead1=kwant.Builder(kwant.TranslationalSymmetry((0,-a,0))) >> lead1[(lat(z,y,x) for z in range(H)for y in range(W)for x in >> range(L))]=onsitelead1[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] >> = hoppingzlead1[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = >> hoppingylead1[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = >> hoppingxsyst.attach_lead(lead1)syst.attach_lead(lead1.reversed()) >> lead2=kwant.Builder(kwant.TranslationalSymmetry((-a,0,0))) >> lead2[(lat(z,y,x) for z in range(H)for y in range(W)for x in >> range(L))]=onsitelead2[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] >> = hoppingzlead2[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = >> hoppingylead2[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = >> hoppingxsyst.attach_lead(lead2)syst.attach_lead(lead2.reversed()) >> syst = syst.finalized()return systdef analyze_system(syst, Bfields): >> syst = make_system()kwant.plot(syst)energies = []for B in >> Bfields:#print(B)ham_mat = >> syst.hamiltonian_submatrix(params=dict(B=B), spars
Re: [Kwant] Plotting energy as a function of magnetic field in 3D.
Dear Sir, Thanks for the tips. As you told, I have tried in other way also but I am getting the same result which are very tedious. I don't know where is fault. Now the code looks like *import kwantimport scipy.sparse.linalg as slaimport matplotlib.pyplot as pltimport tinyarrayimport numpy as npfrom numpy import cos, sin, piimport cmathfrom cmath import expsigma_0 = tinyarray.array([[1, 0], [0, 1]])sigma_x = tinyarray.array([[0, 1], [1, 0]])sigma_y = tinyarray.array([[0, -1j], [1j, 0]])sigma_z = tinyarray.array([[1, 0], [0, -1]])def make_system(a=1, L=30, W=10, H=10, t=1.0, t_x=1.0, t_y=1.0, t_z=1.0, lamda=0.1, beta=1.05):def onsite(site):return (t_z * cos(beta) + 2 * t) * sigma_zdef hoppingx(site0, site1): return (-0.5 * t * sigma_z - 0.5 * 1j * t_x * sigma_x)def hoppingy(site0, site1):return -0.5 * t * sigma_z - 0.5 * 1j * t_y * sigma_ydef hoppingz(site0, site1, B):y = site1.pos[1] return (-0.5 * t_z * sigma_z - 0.5 * 1j * lamda * sigma_0) * exp(2 * pi * 1j * B * a * (y-40))syst = kwant.Builder()lat = kwant.lattice.cubic(a)syst[(lat(z, y, x) for z in range(H) for y in range(W) for x in range(L))] = onsitesyst[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = hoppingzsyst[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = hoppingysyst[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = hoppingx lead1=kwant.Builder(kwant.TranslationalSymmetry((0,-a,0))) lead1[(lat(z,y,x) for z in range(H)for y in range(W)for x in range(L))]=onsitelead1[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = hoppingzlead1[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = hoppingylead1[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = hoppingxsyst.attach_lead(lead1)syst.attach_lead(lead1.reversed()) lead2=kwant.Builder(kwant.TranslationalSymmetry((-a,0,0))) lead2[(lat(z,y,x) for z in range(H)for y in range(W)for x in range(L))]=onsitelead2[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = hoppingzlead2[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = hoppingylead2[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = hoppingxsyst.attach_lead(lead2)syst.attach_lead(lead2.reversed()) syst = syst.finalized()return systdef analyze_system(syst, Bfields): syst = make_system()kwant.plot(syst)energies = []for B in Bfields:#print(B)ham_mat = syst.hamiltonian_submatrix(params=dict(B=B), sparse=True)ev, evec = sla.eigsh(ham_mat.tocsc(), k=20, sigma=0)energies.append(ev) #print (energies)plt.figure()plt.plot(Bfields, energies) plt.xlabel("magnetic field [${10^-3 h/e}$]")plt.ylabel("energy [t]") plt.ylim(0, 0.11)plt.show()def main():syst = make_system() analyze_system(syst, [B * 0.2 for B in range(101)])main()* Naveen Department of Physics & Astrophysics University of Delhi New Delhi-110007 On Sun, Sep 8, 2019, 17:37 Abbout Adel wrote: > Dear Naveen, > > Your program works fine. You have just a small problem of plotting. You > can solve that by changing "plt.show" by "plt.show()". > > Think about putting print (B) inside the loop when you debug your > program. That will help you for example to see if the program is running > well, and you can detect what may be wrong. > Think also about returning Energies in your function. This way you can try > potting the result outside the function you called. Don't hesitate to put > some extra lines in your program to follow the progress when you think that > there is a problem. > > > I hope this helps. > Regards, > Adel > > On Thu, Sep 5, 2019 at 7:32 PM Naveen Yadav > wrote: > >> Dear Sir, >> >> I am trying to plot the energy as a function of magnetic field for a 3D >> case, but I am getting tedious results. The system is infinite in two >> directions and has some width in the third direction. Please have a look at >> the code attached below. I tried a lot but failed. Is the code correct or I >> am wrong somewhere. >> Thank you. >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> *import kwanti
[Kwant] Plotting energy as a function of magnetic field in 3D.
Dear Sir, I am trying to plot the energy as a function of magnetic field for a 3D case, but I am getting tedious results. The system is infinite in two directions and has some width in the third direction. Please have a look at the code attached below. I tried a lot but failed. Is the code correct or I am wrong somewhere. Thank you. *import kwantimport scipy.sparse.linalg as slaimport matplotlib.pyplot as pltimport tinyarrayimport numpy as npfrom numpy import cos, sin, piimport cmathfrom cmath import expsigma_0 = tinyarray.array([[1, 0], [0, 1]])sigma_x = tinyarray.array([[0, 1], [1, 0]])sigma_y = tinyarray.array([[0, -1j], [1j, 0]])sigma_z = tinyarray.array([[1, 0], [0, -1]])def make_system(a=1, L=30, W=10, H=10, t=1.0, t_x=1.0, t_y=1.0, t_z=1.0, lamda=0.1, beta=1.05):def onsite(site):return (t_z * cos(beta) + 2 * t) * sigma_zdef hoppingx(site0, site1): return (-0.5 * t * sigma_z - 0.5 * 1j * t_x * sigma_x)def hoppingy(site0, site1):return -0.5 * t * sigma_z - 0.5 * 1j * t_y * sigma_ydef hoppingz(site0, site1, B):y = site1.pos[1] return (-0.5 * t_z * sigma_z - 0.5 * 1j * lamda * sigma_0) * exp(2 * pi * 1j * B * a * (y-40))syst = kwant.Builder()lat = kwant.lattice.cubic(a)syst[(lat(z, y, x) for z in range(H) for y in range(W) for x in range(L))] = onsitesyst[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = hoppingzsyst[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = hoppingysyst[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = hoppingx lead1=kwant.Builder(kwant.TranslationalSymmetry((0,-a,0))) lead1[(lat(z,y,x) for z in range(H)for y in range(W)for x in range(L))]=onsitelead1[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = hoppingzlead1[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = hoppingylead1[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = hoppingxsyst.attach_lead(lead1)syst.attach_lead(lead1.reversed()) lead2=kwant.Builder(kwant.TranslationalSymmetry((-a,0,0))) lead2[(lat(z,y,x) for z in range(H)for y in range(W)for x in range(L))]=onsitelead2[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = hoppingzlead2[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = hoppingylead2[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = hoppingxsyst.attach_lead(lead2)syst.attach_lead(lead2.reversed()) syst = syst.finalized()return systdef analyze_system():syst = make_system()kwant.plot(syst)Bfields = np.linspace(0, 0.002, 100) energies = []for B in Bfields:ham_mat = syst.hamiltonian_submatrix(params=dict(B=B), sparse=True)ev, evec = sla.eigsh(ham_mat.tocsc(), k=20, sigma=0)energies.append(ev) #print(energies)plt.figure()plt.plot(Bfields, energies) plt.xlabel("magnetic field [${10^-3 h/e}$]")plt.ylabel("energy [t]") plt.ylim(0, 0.11)plt.showdef main():syst = make_system() analyze_system()main()* -- With Best Regards NAVEEN YADAV Ph.D Research Scholar Deptt. Of Physics & Astrophysics University Of Delhi.
Re: [Kwant] 3D annulus cylinder
Dear Sir, Thank you for the clarification. Naveen Department of Physics & Astrophysics University of Delhi New Delhi-110007 On Tue, Aug 13, 2019, 17:56 Anton Akhmerov wrote: > Dear Naveen, > > These inwards- and outwards- facing leads wouldn't have translation > invariance. This makes one unable to compute a mode decomposition in > such a geometry, and therefore computing the conductance becomes > extremely difficult. Right now Kwant only implements the algorithms > that assume translationally invariant leads. > > Best, > Anton > > On Tue, 13 Aug 2019 at 14:15, Naveen Yadav > wrote: > > > > Dear sir, > > > > syst.attach_lead(lead, origin=lat(0, 0, 0)) # lat(0, 0, 0) is in the > hole of the annulus > > This is okay. But I want to create leads in the radial direction, > suppose X is the width of cylinder, Y is circumference and Z is the > Difference in outer and inner radii. So, I want to create leads wrapped > around Y, for inner circumference lead should directed towards origin and > for outer circle directed away from the origin. Code for creating annulus > geometry is given below- > > > > import kwant > > import scipy.sparse.linalg as sla > > import matplotlib.pyplot as plt > > import tinyarray > > import numpy as np > > from numpy import cos, sin, pi > > import cmath > > from cmath import exp > > > > sigma_0 = tinyarray.array([[1, 0], [0, 1]]) > > sigma_x = tinyarray.array([[0, 1], [1, 0]]) > > sigma_y = tinyarray.array([[0, -1j], [1j, 0]]) > > sigma_z = tinyarray.array([[1, 0], [0, -1]]) > > > > > > def make_system(a=1, L=22, r_in=22, r_out=30, t=1.0, t_x=1.0, t_y=1.0, > t_z=1.0, lamda=0.2, beta=1.05, phi_uc = 0.0078): > > # ring shape > > def ring(pos): > > (z, y, x) = pos > > rsq = y ** 2 + z ** 2 > > return r_in ** 2 <= rsq <= r_out ** 2 and x in range (L) > > > > def onsite(site): > > return (t_z * cos(beta) + 2 * t) * sigma_z > > > > def hoppingx(site0, site1): > > return (-0.5 * t * sigma_z - 0.5 * 1j * t_x * sigma_x) > > > > def hoppingy(site0, site1): > > return -0.5 * t * sigma_z - 0.5 * 1j * t_y * sigma_y > > > > def hoppingz(site0, site1): > > y = site1.pos[1] > > return (-0.5 * t_z * sigma_z - 0.5 * 1j * lamda * sigma_0) * > exp(2 * pi * 1j * phi_uc * a * (y-40)) > > > > > > syst = kwant.Builder() > > lat = kwant.lattice.cubic(a, norbs=2) > > syst[lat.shape(ring, (0, r_in+1, 0))] = onsite > > syst[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = hoppingz > > syst[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = hoppingy > > syst[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = hoppingx > > > > lead = kwant.Builder(kwant.TranslationalSymmetry((-a, 0, 0))) > > > > lead[lat.shape(ring, (0, r_in+1, 0))] = onsite > > lead[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = hoppingz > > lead[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = hoppingy > > lead[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = hoppingx > > > > syst.attach_lead(lead) > > syst.attach_lead(lead, origin=lat(0,0,0)) > > return syst > > > > def analyze_system(): > > syst = make_system() > > fig = plt.figure() > > ax = kwant.plot(syst) > > ax.savefig('sys2.png',dpi=200) > > > > def main(): > > syst = make_system() > > analyze_system() > > main() > > > > On Tue, Aug 13, 2019 at 3:18 PM Joseph Weston > wrote: > >> > >> Hi, > >> > >> Dear sir, > >> > >> Could we attach circular leads to the inner and outer circle of annulus > geometry in 3D? Please suggest me if there is a way to do that. > >> > >> What do you mean by circular leads? Do you mean leads with a circle > cross-section (i.e. a semi-infinite cylinder lead)? If so then all you need > to do is create a lead with a circular cross-section uses 'lat.shape' in a > similar way to how you created the scattering region. You can attach leads > to the interior of the annulus by specifying the parameter 'origin' to be a > site in the interior of the annulus when calling 'attach_lead' (see the > documentation [1]). e.g.: > >> > >> syst.attach_lead(lead, origin=lat(0, 0)) # lat(0, 0) is in the > hole of the annulus > >> > >> > >> Happy Kwanting, > >> > >> > >> Joe > >> > >> > >> [1]: > https://kwant-project.org/doc/1/reference/generated/kwant.builder.Builder#kwant.builder.Builder.attach_lead > > > > > > > > -- > > > > > > With Best Regards > > NAVEEN YADAV > > Ph.D Research Scholar > > Deptt. Of Physics & Astrophysics > > University Of Delhi. >
Re: [Kwant] 3D annulus cylinder
Dear sir, syst.attach_lead(lead, origin=lat(0, 0, 0)) # lat(0, 0, 0) is in the hole of the annulus This is okay. But I want to create leads in the radial direction, suppose X is the width of cylinder, Y is circumference and Z is the Difference in outer and inner radii. So, I want to create leads wrapped around Y, for inner circumference lead should directed towards origin and for outer circle directed away from the origin. Code for creating annulus geometry is given below- import kwant import scipy.sparse.linalg as sla import matplotlib.pyplot as plt import tinyarray import numpy as np from numpy import cos, sin, pi import cmath from cmath import exp sigma_0 = tinyarray.array([[1, 0], [0, 1]]) sigma_x = tinyarray.array([[0, 1], [1, 0]]) sigma_y = tinyarray.array([[0, -1j], [1j, 0]]) sigma_z = tinyarray.array([[1, 0], [0, -1]]) def make_system(a=1, L=22, r_in=22, r_out=30, t=1.0, t_x=1.0, t_y=1.0, t_z=1.0, lamda=0.2, beta=1.05, phi_uc = 0.0078): # ring shape def ring(pos): (z, y, x) = pos rsq = y ** 2 + z ** 2 return r_in ** 2 <= rsq <= r_out ** 2 and x in range (L) def onsite(site): return (t_z * cos(beta) + 2 * t) * sigma_z def hoppingx(site0, site1): return (-0.5 * t * sigma_z - 0.5 * 1j * t_x * sigma_x) def hoppingy(site0, site1): return -0.5 * t * sigma_z - 0.5 * 1j * t_y * sigma_y def hoppingz(site0, site1): y = site1.pos[1] return (-0.5 * t_z * sigma_z - 0.5 * 1j * lamda * sigma_0) * exp(2 * pi * 1j * phi_uc * a * (y-40)) syst = kwant.Builder() lat = kwant.lattice.cubic(a, norbs=2) syst[lat.shape(ring, (0, r_in+1, 0))] = onsite syst[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = hoppingz syst[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = hoppingy syst[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = hoppingx lead = kwant.Builder(kwant.TranslationalSymmetry((-a, 0, 0))) lead[lat.shape(ring, (0, r_in+1, 0))] = onsite lead[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = hoppingz lead[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = hoppingy lead[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = hoppingx syst.attach_lead(lead) syst.attach_lead(lead, origin=lat(0,0,0)) return syst def analyze_system(): syst = make_system() fig = plt.figure() ax = kwant.plot(syst) ax.savefig('sys2.png',dpi=200) def main(): syst = make_system() analyze_system() main() On Tue, Aug 13, 2019 at 3:18 PM Joseph Weston wrote: > Hi, > > Dear sir, > > Could we attach *circular leads* to the inner and outer circle of annulus > geometry in 3D? Please suggest me if there is a way to do that. > > What do you mean by circular leads? Do you mean leads with a circle > cross-section (i.e. a semi-infinite cylinder lead)? If so then all you need > to do is create a lead with a circular cross-section uses 'lat.shape' in a > similar way to how you created the scattering region. You can attach leads > to the interior of the annulus by specifying the parameter 'origin' to be a > site in the interior of the annulus when calling 'attach_lead' (see the > documentation [1]). e.g.: > > syst.attach_lead(lead, origin=lat(0, 0)) # lat(0, 0) is in the hole > of the annulus > > > Happy Kwanting, > > > Joe > > > [1]: > https://kwant-project.org/doc/1/reference/generated/kwant.builder.Builder#kwant.builder.Builder.attach_lead > -- With Best Regards NAVEEN YADAV Ph.D Research Scholar Deptt. Of Physics & Astrophysics University Of Delhi.
Re: [Kwant] 3D annulus cylinder
Dear sir, Could we attach *circular leads* to the inner and outer circle of annulus geometry in 3D? Please suggest me if there is a way to do that. Thank you. Naveen On Fri, Aug 9, 2019 at 3:26 PM Naveen Yadav wrote: > Problem solved. Thanks a lot sir. > > On Fri, Aug 9, 2019 at 2:45 PM Joseph Weston > wrote: > >> Hi, >> >> Dear KWANT developers, >> >> I want to generate a 3D annulus cylinder with hopping in all the three >> directions(periodic in x-direction) like the following figure. Please >> suggest me the way to generate such type of geometry. If possible then >> provide an example code for that for better understanding. >> >> [image: image.png] >> >> >> You can use a 'shape' function as shown in Kwant tutorial 2.3: >> https://kwant-project.org/doc/1/tutorial/spin_potential_shape#nontrivial-shapes. >> The code will be almost exactly the same as the ring example in the >> tutorial, except that you will have 3 coordinates instead of 2. >> >> >> Happy Kwanting, >> >> >> Joe >> > > > -- > > > With Best Regards > NAVEEN YADAV > Ph.D Research Scholar > Deptt. Of Physics & Astrophysics > University Of Delhi. > -- With Best Regards NAVEEN YADAV Ph.D Research Scholar Deptt. Of Physics & Astrophysics University Of Delhi.
Re: [Kwant] 3D annulus cylinder
Problem solved. Thanks a lot sir. On Fri, Aug 9, 2019 at 2:45 PM Joseph Weston wrote: > Hi, > > Dear KWANT developers, > > I want to generate a 3D annulus cylinder with hopping in all the three > directions(periodic in x-direction) like the following figure. Please > suggest me the way to generate such type of geometry. If possible then > provide an example code for that for better understanding. > > [image: image.png] > > > You can use a 'shape' function as shown in Kwant tutorial 2.3: > https://kwant-project.org/doc/1/tutorial/spin_potential_shape#nontrivial-shapes. > The code will be almost exactly the same as the ring example in the > tutorial, except that you will have 3 coordinates instead of 2. > > > Happy Kwanting, > > > Joe > -- With Best Regards NAVEEN YADAV Ph.D Research Scholar Deptt. Of Physics & Astrophysics University Of Delhi.
Re: [Kwant] Phlead.py
Problem solved. Naveen Department of Physics & Astrophysics University of Delhi New Delhi-110007 On Tue, Jul 16, 2019, 15:40 Naveen Yadav wrote: > Dear Sir, > > Actually, I wanted to plot the zero bias conductane peak for > majorana(topological) quantized at 2e^2/h. There is one tutorial using the > phlead.py but it is not working properly for newer version of kwant. > Please suggest me the way to get the desied result. > > Thank you > Best regards > Naveen > > > > > > > > > > > > > > > Naveen > Department of Physics & Astrophysics > University of Delhi > New Delhi-110007 > > On Mon, Jul 15, 2019, 17:03 Naveen Yadav wrote: > >> Thank you very much Sir. >> >> >> >> >> >> >> >> >> >> >> >> >> >> Naveen >> Department of Physics & Astrophysics >> University of Delhi >> New Delhi-110007 >> >> On Mon, Jul 15, 2019, 16:48 Anton Akhmerov >> wrote: >> >>> Hi Naveen, >>> >>> Please take a look at the new superconductivity tutorial: >>> https://kwant-project.org/doc/1/tutorial/superconductors >>> >>> That's the most up to date and systematic way. >>> >>> Best, >>> Anton >>> >>> On Mon, 15 Jul 2019 at 13:14, Naveen Yadav >>> wrote: >>> > >>> > Dear all, >>> > >>> > Could anyone provide me the newer version of code phlead.py to >>> calculate the conductance through majorana. The older vesion of code is not >>> working well with latest version of kwant and it shows a lot of errors. >>> Please help me in this regard. >>> > >>> > Thank you. >>> > Best regards >>> > Naveen >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > Naveen >>> > Department of Physics & Astrophysics >>> > University of Delhi >>> > New Delhi-110007 >>> >>
Re: [Kwant] Phlead.py
Dear Sir, Actually, I wanted to plot the zero bias conductane peak for majorana(topological) quantized at 2e^2/h. There is one tutorial using the phlead.py but it is not working properly for newer version of kwant. Please suggest me the way to get the desied result. Thank you Best regards Naveen Naveen Department of Physics & Astrophysics University of Delhi New Delhi-110007 On Mon, Jul 15, 2019, 17:03 Naveen Yadav wrote: > Thank you very much Sir. > > > > > > > > > > > > > > Naveen > Department of Physics & Astrophysics > University of Delhi > New Delhi-110007 > > On Mon, Jul 15, 2019, 16:48 Anton Akhmerov > wrote: > >> Hi Naveen, >> >> Please take a look at the new superconductivity tutorial: >> https://kwant-project.org/doc/1/tutorial/superconductors >> >> That's the most up to date and systematic way. >> >> Best, >> Anton >> >> On Mon, 15 Jul 2019 at 13:14, Naveen Yadav >> wrote: >> > >> > Dear all, >> > >> > Could anyone provide me the newer version of code phlead.py to >> calculate the conductance through majorana. The older vesion of code is not >> working well with latest version of kwant and it shows a lot of errors. >> Please help me in this regard. >> > >> > Thank you. >> > Best regards >> > Naveen >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > Naveen >> > Department of Physics & Astrophysics >> > University of Delhi >> > New Delhi-110007 >> >
Re: [Kwant] Phlead.py
Thank you very much Sir. Naveen Department of Physics & Astrophysics University of Delhi New Delhi-110007 On Mon, Jul 15, 2019, 16:48 Anton Akhmerov wrote: > Hi Naveen, > > Please take a look at the new superconductivity tutorial: > https://kwant-project.org/doc/1/tutorial/superconductors > > That's the most up to date and systematic way. > > Best, > Anton > > On Mon, 15 Jul 2019 at 13:14, Naveen Yadav > wrote: > > > > Dear all, > > > > Could anyone provide me the newer version of code phlead.py to calculate > the conductance through majorana. The older vesion of code is not working > well with latest version of kwant and it shows a lot of errors. Please help > me in this regard. > > > > Thank you. > > Best regards > > Naveen > > > > > > > > > > > > > > > > > > > > > > > > > > > > Naveen > > Department of Physics & Astrophysics > > University of Delhi > > New Delhi-110007 >
[Kwant] Phlead.py
Dear all, Could anyone provide me the newer version of code *phlead.py* to calculate the conductance through majorana. The older vesion of code is not working well with latest version of kwant and it shows a lot of errors. Please help me in this regard. Thank you. Best regards Naveen Naveen Department of Physics & Astrophysics University of Delhi New Delhi-110007
Re: [Kwant] Density Operator & Current Operator for 3D systems
Thank you Adel for your reply. I will try it and let you know when it works fine for me. Naveen Department of Physics & Astrophysics University of Delhi New Delhi-110007 On Mon, Jun 10, 2019, 18:38 Abbout Adel wrote: > Dear Naveen, > > One way to do that is to create another system which represents the slice > you want to visualize. > So you do the calculations in your 3D system and plot the result in the 2D > slice. > > You need just to be sure that the order of the hoppings or the sites in > both of them are the same. > > Please find below an example for the plot of the current at different > values of z. > > > I hope this helps > Adel > > ## > > > > import kwant > from numpy import exp,sin,linspace,sqrt > > > lat=kwant.lattice.cubic(norbs=1) > > l=3 > L=W=20 > def pot(site): > x,y,z=site.pos > r=sqrt(x**2+y**2+z**2) > if r<15: return -1/(1+(r/l)**2)#-exp(-(r/l)**2) > else: return 0 > sys=kwant.Builder() > sys[(lat(x,y,z) for x in range(-L,L) for y in range(-W,W)for z in > range(-W,W))]=pot > sys[lat.neighbors()]=-1 > lead=kwant.Builder(kwant.TranslationalSymmetry((-1,0,0))) > lead[(lat(0,y,z) for y in range(-W,W)for z in range(-W,W))]=0 > lead[lat.neighbors()]=-1 > sys.attach_lead(lead) > sys.attach_lead(lead.reversed()) > > kwant.plot(sys) > def f(site): > x,y,_=site.pos > return pot(lat(x,y,0)) > def size(site): > x,y,_=site.pos > return pot(lat(x,y,0)) > kwant.plot(sys,hop_lw=0.001, pos_transform=lambda p: (p[0] , p[1] > ),site_color=f ,cmap='plasma',site_size=size ) > > > > sysf=sys.finalized() > wave=kwant.wave_function(sysf, energy=-5.5) > Sites=list(sysf.sites) > psi=wave(0)[0] > > > > > > def Plot(z,psi): > > def cut(site1,site2): > return site1.pos[2]==z and site2.pos[2]==z > > > J_0 = kwant.operator.Current(sysf,where=cut) > current = J_0(psi) > lat2=kwant.lattice.square(norbs=1) > sys2=kwant.Builder() > sys2[(lat2(site.pos[0],site.pos[1]) for site in Sites if > site.pos[2]==z)]=0 > sys2[lat2.neighbors()]=-1 > sys2f=sys2.finalized() > kwant.plotter.current(sys2f, current, relwidth=0.07, vmax=0.01) > > > for i in range(0,10,2): > Plot(i,psi) > > On Sun, Jun 9, 2019 at 6:47 PM Naveen Yadav > wrote: > >> Dear KWANT Depelopers, >> >> Following the Kwant documentation, it is easy to plot probability density >> for 2D systems. But on following the same procedure for the 3D systems it >> shows an *ValueError: Only 2D systems can be plotted this way.* Please >> suggest me if there is a way to plot probability density for 3D system >> having only an orbital degree of freedom per site. >> >> Thanks in advance. >> Naveen >> >> >> >> >> >> >> >> >> >> >> >> >> >> Naveen >> Department of Physics & Astrophysics >> University of Delhi >> New Delhi-110007 >> > > > -- > Abbout Adel >
[Kwant] Density Operator & Current Operator for 3D systems
Dear KWANT Depelopers, Following the Kwant documentation, it is easy to plot probability density for 2D systems. But on following the same procedure for the 3D systems it shows an *ValueError: Only 2D systems can be plotted this way.* Please suggest me if there is a way to plot probability density for 3D system having only an orbital degree of freedom per site. Thanks in advance. Naveen Naveen Department of Physics & Astrophysics University of Delhi New Delhi-110007
Re: [Kwant] Peierls phase substitution on Tight-Binding Hamiltonian
Thank you for the clarification. Naveen Department of Physics & Astrophysics University of Delhi New Delhi-110007 On Tue, May 7, 2019, 15:04 Joseph Weston wrote: > > And also, when I am plotting the spectrum in varing magnetic field with > the hamiltonian as a sparse matrix. I am getting an value error. > > *ValueError: x and y must have same first dimension, but have shapes (100,) > and (1, 15) > * > > I don't know what does it mean? > > > > > > > > > > > > > > > *def plot_spectrum(syst, Bfields): energies = [] for B in Bfields: > ham_mat = syst.hamiltonian_submatrix(params=dict(B=B), > sparse=True) ev = sla.eigsh(ham_mat.tocsc(), k=15, sigma=0, > return_eigenvectors=False) energies.append(ev) > pyplot.figure() pyplot.plot(Bfields, energies) > pyplot.xlabel("magnetic field [arbitrary units]") pyplot.ylabel("energy > [t]") pyplot.show()* > *plot_spectrum(syst, [iB * 0.002 for iB in range(100)])* > > > The error message seems pretty clear to me; I am not sure where the > confusion is, especially as the traceback will point to the exact line in > the code where the error occurs. If I were you I would first take the time > to really look at the code that you are writing and understanding what it > is doing. Remember that this is not a general mailing list for coding help: > it is specifically for asking questions about Kwant. > > > Happy Kwanting, > > Joe >
Re: [Kwant] Peierls phase substitution on Tight-Binding Hamiltonian
And also, when I am plotting the spectrum in varing magnetic field with the hamiltonian as a sparse matrix. I am getting an value error. *ValueError: x and y must have same first dimension, but have shapes (100,) and (1, 15)* I don't know what does it mean? *def plot_spectrum(syst, Bfields):energies = []for B in Bfields:ham_mat = syst.hamiltonian_submatrix(params=dict(B=B), sparse=True)ev = sla.eigsh(ham_mat.tocsc(), k=15, sigma=0, return_eigenvectors=False)energies.append(ev)pyplot.figure() pyplot.plot(Bfields, energies)pyplot.xlabel("magnetic field [arbitrary units]")pyplot.ylabel("energy [t]")pyplot.show()* *plot_spectrum(syst, [iB * 0.002 for iB in range(100)])* Best regards, Naveen On Tue, May 7, 2019 at 1:35 PM Naveen Yadav wrote: > That is okay, but still something wrong. > > > > > > > > > > > > > > Naveen > Department of Physics & Astrophysics > University of Delhi > New Delhi-110007 > > On Tue, May 7, 2019, 13:29 Joseph Weston > wrote: > >> >> > Dear Joseph, >> > >> > As per your instructions I have build the system, but the code is not >> > giving the desired result. >> > Here is the code please have a look on it. >> >> >> 'y' should be the y position of the sites of the hopping, not an input >> parameter to the system construction: >> >> def hoppingz(site0, site1): >> >> y = site0.pos[1] >> >> ... >> >> >> Happy Kwanting, >> >> Joe >> >> >> >> -- With Best Regards NAVEEN YADAV Ph.D Research Scholar Deptt. Of Physics & Astrophysics University Of Delhi.
Re: [Kwant] Peierls phase substitution on Tight-Binding Hamiltonian
That is okay, but still something wrong. Naveen Department of Physics & Astrophysics University of Delhi New Delhi-110007 On Tue, May 7, 2019, 13:29 Joseph Weston wrote: > > > Dear Joseph, > > > > As per your instructions I have build the system, but the code is not > > giving the desired result. > > Here is the code please have a look on it. > > > 'y' should be the y position of the sites of the hopping, not an input > parameter to the system construction: > > def hoppingz(site0, site1): > > y = site0.pos[1] > > ... > > > Happy Kwanting, > > Joe > > > >
Re: [Kwant] Peierls phase substitution on Tight-Binding Hamiltonian
Dear Joseph, As per your instructions I have build the system, but the code is not giving the desired result. Here is the code please have a look on it. import kwant import matplotlib.pyplot as plt import tinyarray import numpy as np from numpy import cos, sin, pi import cmath from cmath import exp sigma_0 = tinyarray.array([[1, 0], [0, 1]]) sigma_x = tinyarray.array([[0, 1], [1, 0]]) sigma_y = tinyarray.array([[0, -1j], [1j, 0]]) sigma_z = tinyarray.array([[1, 0], [0, -1]]) def make_system(a=1, L=10, W=50, H=5, t=1.0, t_x=1.0, t_y=1.0, t_z=1.0, lamda=0.2, beta=1.05, B=0, y=1): def onsite(site): return (1.0 * cos(beta) + 2 * 1.0) * sigma_z def hoppingx(site0, site1): return -0.5 * t * sigma_z - 0.5 * 1j * t_x * sigma_x def hoppingy(site0, site1): return -0.5 * t_z * sigma_z - 0.5 * 1j * t_y * sigma_y def hoppingz(site0, site1): return (-0.5 * t_z * sigma_z - 0.5 * 1j * lamda * sigma_0) * exp(2 * pi * 1j * B * a * y) syst = kwant.Builder() lat = kwant.lattice.cubic(a) syst[(lat(z, y, x) for z in range(H) for y in range(W) for x in range(L))] = onsite syst[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = hoppingx syst[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = hoppingy syst[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = hoppingz lead = kwant.Builder(kwant.TranslationalSymmetry((-a, 0, 0))) lead[(lat(z, y, x) for z in range(H) for y in range(W) for x in range(L))] = onsite lead[kwant.builder.HoppingKind((1, 0, 0), lat, lat)] = hoppingx lead[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] = hoppingy lead[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] = hoppingz syst.attach_lead(lead) syst.attach_lead(lead.reversed()) syst = syst.finalized() return syst def analyze_system(): syst = make_system() kwant.plot(syst) kwant.plotter.bands(syst.leads[0], momenta=np.linspace(-3, 3, 201), show=False) plt.grid() plt.xlim(-3, 3) plt.ylim(-0.2, 0.2) plt.xlabel('momentum [1/A]') plt.ylabel('energy [E]') plt.show() analyze_system() best regards, Naveen On Mon, May 6, 2019 at 3:12 PM Naveen Yadav wrote: > Thanks, I'll check it out. > > > > > > > > > > > > > > Naveen > Department of Physics & Astrophysics > University of Delhi > New Delhi-110007 > > On Mon, May 6, 2019, 15:10 Joseph Weston > wrote: > >> >> >> >> Then as you said I have to multiply the hopping in z direction by exp(2 * >> pi * 1j * B * a* y). But how can I build a 3D system from here. I know >> that 2D systems can be written as *lat = kwant.lattice.square(a), *but I >> don't know how should I proceed to bulid a lattice in 3D using the above >> onsite and hoppings? Please help me regarding this. >> >> >> The tutorials explain how to make lattices in arbitrary numbers of >> dimensions. How about making a cubic lattice in 3D? >> >> >> Happy Kwanting, >> >> >> Joe >> > -- With Best Regards NAVEEN YADAV Ph.D Research Scholar Deptt. Of Physics & Astrophysics University Of Delhi.
Re: [Kwant] Peierls phase substitution on Tight-Binding Hamiltonian
Thanks, I'll check it out. Naveen Department of Physics & Astrophysics University of Delhi New Delhi-110007 On Mon, May 6, 2019, 15:10 Joseph Weston wrote: > > > > Then as you said I have to multiply the hopping in z direction by exp(2 * > pi * 1j * B * a* y). But how can I build a 3D system from here. I know > that 2D systems can be written as *lat = kwant.lattice.square(a), *but I > don't know how should I proceed to bulid a lattice in 3D using the above > onsite and hoppings? Please help me regarding this. > > > The tutorials explain how to make lattices in arbitrary numbers of > dimensions. How about making a cubic lattice in 3D? > > > Happy Kwanting, > > > Joe >
Re: [Kwant] Peierls phase substitution on Tight-Binding Hamiltonian
Dear Joseph, The resulting onsite and hopping terms as I found are: Onsite: (tz *cos(/beta) +2t')*sigma_z Hopping in x direction: -t'/2 *sigma_z - i tx/2 *sigma_x Hopping in y direction: -t'/2 *sigma_z - i tx/2 *sigma_y Hopping in z direction: -tz/2 *sigma_z - i lamda/2 *sigma_0 Then as you said I have to multiply the hopping in z direction by exp(2 * pi * 1j * B * a* y). But how can I build a 3D system from here. I know that 2D systems can be written as *lat = kwant.lattice.square(a), *but I don't know how should I proceed to bulid a lattice in 3D using the above onsite and hoppings? Please help me regarding this. Thanks for your help. Naveen Department of Physics & Astrophysics University of Delhi New Delhi-110007 On Mon, May 6, 2019, 13:18 Joseph Weston wrote: > Hi, > On 5/5/19 1:08 PM, Naveen Yadav wrote: > > Dear KWANT developers, > > I have an Hamiltonian > *H(k) = tx*σx* sin kx + ty*σy*sin ky + mk*σz + λ*σ0 *sin kz,* > > *mk = tz(cos β − cos kz) + t'(2 − cos kx − cos ky)* > > I am trying to introduce magnetic field in *x-direction* for a gauge *A = > (0, 0, By),* > Can I make a *template* for this hamiltonian using KWANT discretizer or I > have to discretize it by hand to get the onsite and hopping matrix? > > > I already answered this question in the previous thread. The Hamiltonian > is essentially already discretized; you just have to identify which terms > are onsites and which are hoppings. See the previous thread. > > > And then how to add the peierls phase to the hopping matrix? > > For the gauge you have chosen the peierls phase will be non-zero only on > hoppings in the z direction. You can specify these hoppings as a function > and multiply the hopping by exp(2 * pi * 1j * B * a * y) where "a" is the > lattice discretization length and "y" is the y position of the sites at > either end of the hopping (will be the same for both sites, as we only > apply this phase to hoppings in the z-direction). > > > Then I want to plot the spectrum as a function of k_z, with Wx =10 and > Wy=50 > > The resulting Hamiltonian will be a function of k_z. You can use > kwant.plotter.spectrum to plot the spectrum as a function of k_z. > > > Happy Kwanting, > > Joe > >
[Kwant] Peierls phase substitution on Tight-Binding Hamiltonian
Dear KWANT developers, I have an Hamiltonian *H(k) = tx*σx* sin kx + ty*σy*sin ky + mk*σz + λ*σ0 *sin kz,* *mk = tz(cos β − cos kz) + t'(2 − cos kx − cos ky)* I am trying to introduce magnetic field in *x-direction* for a gauge *A = (0, 0, By),* Can I make a *template* for this hamiltonian using KWANT discretizer or I have to discretize it by hand to get the onsite and hopping matrix? If I have to discretize it by hand then how should I proceed for that. And then how to add the peierls phase to the hopping matrix? Then I want to plot the spectrum as a function of k_z, with Wx =10 and Wy=50 Could you please help me, I tried a lot but failed. Thanks in advance. Naveen
Re: [Kwant] [KWANT] Diagonalization of hamiltonian
Thank you so much for your time. I will try it. Naveen Department of Physics & Astrophysics University of Delhi New Delhi-110007 On Mon, Apr 29, 2019, 16:32 Joseph Weston wrote: > > > > > I have build the system(discretized in x and y direction). The actual > > problem is that, " How to add magnetic field term(as given by the > > auther l_m = 4.5) to this system?" These bands are in presence of > > magnetic field. > > > Well you'll have to look in the paper to answer that question; you're in > a better position to answer that than me. Maybe a Peierls phase? > > >
Re: [Kwant] Help
Ok, thanks for the clarification. Naveen Department of Physics & Astrophysics University of Delhi 110007 On Mon, Apr 1, 2019, 15:14 Bas Nijholt wrote: > Hi Naveen, > > kwant.continuum.discretize can only deal with k_{xyz} as polynomials. > > Best, Bas > > > > On Mon, Apr 1, 2019 at 8:00 AM Naveen Yadav naveengunwa...@gmail.com > <http://mailto:naveengunwa...@gmail.com> wrote: > > Dear all, >> >> I am tring to discretize the Hamiltonian containing the functional terms >> (like sin(k_x) ), but I am getting an TypeError : 'Symbol' object is not >> callable. >> The code is >> from __future__ import division >> import kwant >> import kwant.continuum >> import scipy.sparse.linalg >> import scipy.linalg >> import numpy as np >> import sympy >> from math import sin, cos, sqrt, pi >> import matplotlib.pyplot as plt >> hamiltonian = ("""sigma_x * sin(k_x) + sigma_y * sin(k_y) + >> sigma_0*(k_z)""") >> hamiltonian = kwant.continuum.sympify(hamiltonian) >> template, coords = kwant.continuum.discretize_symbolic(hamiltonian) >> t = kwant.continuum.build_discretized(template, coords) >> print(t) >> >> TypeError Traceback (most recent call >> last) in 9 import >> matplotlib.pyplot as plt 10 hamiltonian = ("""sigma_x * sin(k_x) + >> sigma_y * sin(k_y) + sigma_0*(k_z)""")---> 11 hamiltonian = >> kwant.continuum.sympify(hamiltonian) 12 template, coords = >> kwant.continuum.discretize_symbolic(hamiltonian) 13 t = >> kwant.continuum.build_discretized(template, coords) >> /usr/local/lib/python3.6/dist-packages/kwant/continuum/_common.py in >> sympify(expr, locals)197 # sympy types.198 subs = {r: >> sympy.Symbol(str(r.func))(*r.args)--> 199 for r in >> hamiltonian.atoms(sympy.Function)}200 201 hamiltonian = >> hamiltonian.subs(subs) >> /usr/local/lib/python3.6/dist-packages/kwant/continuum/_common.py in >> (.0)197 # sympy types.198 subs = {r: >> sympy.Symbol(str(r.func))(*r.args)--> 199 for r in >> hamiltonian.atoms(sympy.Function)}200 201 hamiltonian = >> hamiltonian.subs(subs) >> TypeError: 'Symbol' object is not callable >> >> Could you please help me in the above context. >> >> Thanks in Advance. >> >> Naveen >> >> >> -- >> >> >> With Best Regards >> NAVEEN YADAV >> Ph.D Research Scholar >> Deptt. Of Physics & Astrophysics >> University Of Delhi. >> >
[Kwant] Help
Dear all, I am tring to discretize the Hamiltonian containing the functional terms (like sin(k_x) ), but I am getting an TypeError : 'Symbol' object is not callable. The code is from __future__ import division import kwant import kwant.continuum import scipy.sparse.linalg import scipy.linalg import numpy as np import sympy from math import sin, cos, sqrt, pi import matplotlib.pyplot as plt hamiltonian = ("""sigma_x * sin(k_x) + sigma_y * sin(k_y) + sigma_0*(k_z)""") hamiltonian = kwant.continuum.sympify(hamiltonian) template, coords = kwant.continuum.discretize_symbolic(hamiltonian) t = kwant.continuum.build_discretized(template, coords) print(t) TypeError Traceback (most recent call last) in 9 import matplotlib.pyplot as plt 10 hamiltonian = ("""sigma_x * sin(k_x) + sigma_y * sin(k_y) + sigma_0*(k_z)""")---> 11 hamiltonian = kwant.continuum.sympify(hamiltonian) 12 template, coords = kwant.continuum.discretize_symbolic(hamiltonian) 13 t = kwant.continuum.build_discretized(template, coords) /usr/local/lib/python3.6/dist-packages/kwant/continuum/_common.py in sympify(expr, locals)197 # sympy types.198 subs = {r: sympy.Symbol(str(r.func))(*r.args)--> 199 for r in hamiltonian.atoms(sympy.Function)}200 201 hamiltonian = hamiltonian.subs(subs) /usr/local/lib/python3.6/dist-packages/kwant/continuum/_common.py in (.0)197 # sympy types.198 subs = {r: sympy.Symbol(str(r.func))(*r.args)--> 199 for r in hamiltonian.atoms(sympy.Function)}200 201 hamiltonian = hamiltonian.subs(subs) TypeError: 'Symbol' object is not callable Could you please help me in the above context. Thanks in Advance. Naveen -- With Best Regards NAVEEN YADAV Ph.D Research Scholar Deptt. Of Physics & Astrophysics University Of Delhi.
[Kwant] Want to know more about bulid_discretized
I want to know more about the builid_discretized(tb_hamiltonian, coords). I did not undersand what should be the syntax to write the coords.Could you please help me by sending an example code for writing coords? Thanks in Advance. Naveen Department of Physics & Astrophysics University of Delhi 110007