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 <abbout.a...@gmail.com> 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 <naveengunwa...@gmail.com>
> 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_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))            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)] = hoppingz    syst[kwant.builder.HoppingKind((0, 1, 0),
>> lat, lat)] = hoppingy    syst[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))]=onsite    lead1[kwant.builder.HoppingKind((1, 0, 0), lat, lat)]
>> = hoppingz    lead1[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] =
>> hoppingy    lead1[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] =
>> hoppingx    syst.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))]=onsite    lead2[kwant.builder.HoppingKind((1, 0, 0), lat, lat)]
>> = hoppingz    lead2[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] =
>> hoppingy    lead2[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] =
>> hoppingx    syst.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.00002 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 <abbout.a...@gmail.com> 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 <naveengunwa...@gmail.com>
>>> 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 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_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))            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)] = hoppingz    syst[kwant.builder.HoppingKind((0, 1, 0),
>>>> lat, lat)] = hoppingy    syst[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))]=onsite    lead1[kwant.builder.HoppingKind((1, 0, 0), lat, lat)]
>>>> = hoppingz    lead1[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] =
>>>> hoppingy    lead1[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] =
>>>> hoppingx    syst.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))]=onsite    lead2[kwant.builder.HoppingKind((1, 0, 0), lat, lat)]
>>>> = hoppingz    lead2[kwant.builder.HoppingKind((0, 1, 0), lat, lat)] =
>>>> hoppingy    lead2[kwant.builder.HoppingKind((0, 0, 1), lat, lat)] =
>>>> hoppingx    syst.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.
>>>>
>>>
>>>
>>> --
>>> Abbout Adel
>>>
>>
>
> --
> Abbout Adel
>

Reply via email to