Dear 张金龙,

Note the axis of the plot reads 1e-9+1, so the plot limits go from 1 -
0.2e-9 to 1 + 1e-9. This how matplotlib treats plots that are
approximately constant.

Hope this helps,
Anton


On Sat, 15 May 2021 at 13:24, 张金龙 <[email protected]> wrote:
>
>
> Hello
>
> I felt confusing, when I use pyplot.plt.  The data in figure is different 
> from the printed.
>
> There are the codes:
>
> # ================================================================
>
> # Physics background
>
> # ------------------
>
> # Kwant features highlighted
>
> # --------------------------
>
> #  - Numpy matrices as values in Builder
>
>
> import kwant
>
> import numpy as np
>
>
> # For plotting
>
> import matplotlib.pyplot as plt
>
>
> # For matrix support
>
> import tinyarray
>
>
> import kwant.qsymm
>
>
> # define Pauli-matrices for convenience
>
> s_0 = tinyarray.array([[1, 0], [0, 1]])
>
> s_x = tinyarray.array([[0, 1], [1, 0]])
>
> s_y = tinyarray.array([[0, -1j], [1j, 0]])
>
> s_z = tinyarray.array([[1, 0], [0, -1]])
>
>
> mz=0    # AFM
>
> mu=0.0    # stargged chemical potential
>
> n_theta=12
>
>
> def make_system(constant=1, W=30, L=30, mz=0, m_in=0, mu=0):
>
>     lat = kwant.lattice.honeycomb(a=constant,norbs=2, name=['a', 'b'])
>
>     # a, b = lat.sublattices
>
>     sym = kwant.TranslationalSymmetry(lat.vec((1, 0)))
>
>     syst = kwant.Builder()
>
>
>     def onsite_a(site,theta):
>
>         return mz*s_z+m_in*(np.cos(theta)*s_x+np.sin(theta)*s_y)+mu*s_0
>
>
>
>     def onsite_b(site,theta):
>
>         return  -mz*s_z+m_in*(np.cos(theta)*s_x+np.sin(theta)*s_y)-mu*s_0
>
>
>     syst[(lat.a(x, y) for x in range(L) for y in range(W))] = onsite_a
>
>     syst[(lat.b(x, y) for x in range(L) for y in range(W))] = onsite_b
>
>     syst[lat.neighbors()] = s_0
>
>
>     # define lead
>
>     left_sym=kwant.TranslationalSymmetry(lat.vec((1, 0)))
>
>     left_lead=kwant.Builder(left_sym)
>
>     left_lead[(lat.a(0, y) for y in range(W))] = onsite_a
>
>     left_lead[(lat.b(0, y) for y in range(W))] = onsite_b
>
>     left_lead[lat.neighbors()] = s_0
>
>     syst.attach_lead(left_lead)
>
>     syst.attach_lead(left_lead.reversed())
>
>     return syst
>
>
>
>
> def plot_conductance(syst, energy, theta_list):
>
>     # Compute conductance
>
>     data = np.zeros(n_theta)
>
>     num_i=-1
>
>     for theta_i in theta_list:
>
>         num_i=num_i+1
>
>         smatrix = kwant.smatrix(syst, energy, params=dict(theta=theta_i))
>
>         data[num_i]=smatrix.transmission(1, 0)
>
>
>
>     plt.figure()
>
>     # x=np.linspace(-1,1,n_theta)
>
>     # data_i=np.linspace(0,0,n_theta)
>
>     # print(x,data_i)
>
>     # plt.plot(x,data_i,'ow')
>
>     print(data)
>
>     plt.plot(theta_list, data)
>
>     plt.xlabel(r'$\theta/\pi$')
>
>     plt.ylabel("conductance [e^2/h]")
>
>     plt.savefig('tran_PHE.jpg')
>
>     #plt.show()
>
>
>
> def main():
>
>     syst = make_system(m_in=0.0001)
>
>     # Check that the system looks as intended.
>
>     kwant.plot(syst,file='transport_lattice.pdf')
>
>
>     syst = syst.finalized()
>
>     theta_num=np.linspace(-np.pi,np.pi,num=n_theta)
>
>
>     plot_conductance(syst, energy=0.0001,
>
>                      theta_list=theta_num)
>
>
> if __name__ == '__main__':
>
>     main()
>
>
>
>
> The result would be printed in terminal: [1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 
> 1.].
>
> However, the figure plotted is wrong.
>
>
>
>
>
>
> --
>
> Best Wishes
> Jinlong Zhang
> [email protected]
>
>
>

Reply via email to