Dear sir, I have tried the following code for a 3D system to calculate the peierls phase but it shows the error *- TypeError: only size-1 arrays can be converted to Python scalars. * For 2D systems it is working fine*. *What should I do ?
import kwant import numpy as np from numpy import sin, cos, sqrt, pi import scipy.sparse.linalg as sla import matplotlib.pyplot as plt import tinyarray as ta import cmath from cmath import exp from matplotlib import pyplot as plt sigma_z=ta.array([[1,0],[0,-1]]) sigma_x=ta.array([[0,1],[1,0]]) sigma_y=ta.array([[0,1j],[-1j,0]]) sigma_0=ta.array([[1,0],[0,1]]) def onsite(site): return 2 * sigma_z def hoppingx(site0, site1): return - 0.5 * 1j * sigma_x def hoppingy(site0, site1): return - 0.5 * 1j * 1 * sigma_y def hoppingz(site0, site1, peierls): return (-0.5 * sigma_z) * peierls(site0, site1) def make_system(a=1, L=10, W=20, H=10): syst = kwant.Builder() lat = kwant.lattice.cubic(norbs=2) syst[(lat(x, y, z) for x in range(L) for y in range(W) for z in range(H))] = 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 return syst def make_lead(a=1, L=10, W=20): lat = kwant.lattice.cubic(norbs=2) lead = kwant.Builder(kwant.TranslationalSymmetry((0, 0, -a))) lead[(lat(x, y, 0) for x in range(L) for y in range(W))] = 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 return lead syst = make_system() lead = make_lead().substituted(peierls='peierls_lead') syst.attach_lead(lead) #syst.attach_lead(lead.reversed()) syst = syst.finalized() gauge = kwant.physics.magnetic_gauge(syst) def B_syst(pos): return np.exp(-np.sum(pos * pos)) peierls_syst, peierls_lead, peierls_lead = gauge(B_syst, B_syst) params = dict(t=1, peierls=peierls_syst, peierls_lead=peierls_lead) kwant.plotter.bands(syst.leads[0], momenta=np.linspace(-np.pi, np.pi, 200), show=False, params=params) plt.xlim(-np.pi, np.pi) plt.ylim(-0.23, 0.23) plt.xlabel('momentum [k_z]') plt.ylabel('energy [E]') plt.show() On Fri, Jul 3, 2020 at 10:02 AM Naveen Yadav <naveengunwa...@gmail.com> wrote: > Dear sir, > Thank you for the information. My 3d system have both first and second > nearest neighbour hopping z-direction if I have a perpendicular magnetic > field in x-direction. By choosing landau gauge (0,0,By). It is easy to add > peierls phase to first nearest neighbour hopping in z-direction. Now my > question is how should I add the peierls phase for the second neighbour > hopping in z-direction? > > Best Regards > Naveen Yadav > Research Scholar > Department of Physics & Astrophysics > University of Delhi > New Delhi-110007 > > On Tue, Jun 30, 2020, 20:44 Naveen Yadav <naveengunwa...@gmail.com> wrote: > >> Dear sir, >> Thank you for the information. My 3d system have both first and second >> nearest neighbour hopping z-direction if I have a perpendicular magnetic >> field in x-direction. By choosing landau gauge (0,0,By). It is easy to add >> peierls phase to first nearest neighbour hopping in z-direction. Now my >> question is how should I add the peierls phase for the second neighbour >> hopping in z-direction? >> >> Best Regards >> Naveen Yadav >> Research Scholar >> Department of Physics & Astrophysics >> University of Delhi >> New Delhi-110007 >> >> On Tue, Jun 30, 2020, 19:49 Anton Akhmerov <anton.akhmerov...@gmail.com> >> wrote: >> >>> Hi Naveen, >>> >>> That's mostly a convenience function. The same functionality, although >>> at a bit of a lower level is available in Kwant 1.4, see here: >>> >>> https://kwant-project.org/doc/1/pre/whatsnew/1.4#automatic-peierls-phase-calculation >>> >>> Best, >>> Anton >>> >>> On Sat, 27 Jun 2020 at 07:04, Naveen Yadav <naveengunwa...@gmail.com> >>> wrote: >>> > >>> > Dear sir, >>> > In the Kwant 1.5 documentation you have introduced >>> kwant.bulider.add_peierls_phase(syst). Is this functionality ready to use >>> by downloading the source code buider.py from gitlab? >>> > >>> > Best Regards >>> > Naveen Yadav >>> > Research Scholar >>> > Department of Physics & Astrophysics >>> > University of Delhi >>> > New Delhi-110007 >>> > >>> > On Fri, Jun 12, 2020, 15:42 Naveen Yadav <naveengunwa...@gmail.com> >>> wrote: >>> >> >>> >> Ok sir, thank you. >>> >> >>> >> Best Regards >>> >> Naveen Yadav >>> >> Research Scholar >>> >> Department of Physics & Astrophysics >>> >> University of Delhi >>> >> New Delhi-110007 >>> >> >>> >> On Fri, Jun 12, 2020, 14:25 Anton Akhmerov < >>> anton.akhmerov...@gmail.com> wrote: >>> >>> >>> >>> Dear Naveen, >>> >>> >>> >>> I fear you'll have to wait—it's not yet released. >>> >>> >>> >>> Best, >>> >>> Anton >>> >>> >>> >>> On Fri, 12 Jun 2020 at 10:51, Naveen Yadav <naveengunwa...@gmail.com> >>> wrote: >>> >>> > >>> >>> > Dear KWANT developers, >>> >>> > I am not able to update KWANT 1.5 >>> >>> > How can I update it? Please advise. >>> >>> > >>> >>> > >>> >>> > Best Regards >>> >>> > Naveen Yadav >>> >>> > Research Scholar >>> >>> > Department of Physics & Astrophysics >>> >>> > University of Delhi >>> >>> > New Delhi-110007 >>> >> -- Best Regards, Naveen Yadav Research Scholar Department of Physics & Astrophysics University Of Delhi New Delhi-110007