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
>