# Untitled

a guest
Dec 19th, 2016
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. import kwant
2.
3. import matplotlib.pyplot as plt
4.
5. sys = kwant.Builder()
6.
7. a = 1
8. lat = kwant.lattice.square(a)
9.
10. t = 1.0
11. W = 60
12. L = 30
13.
14. # Define the scattering region
15.
16. for i in range(L):
17.     for j in range(W):
18.         # On-site Hamiltonian
19.         sys[lat(i, j)] = 4 * t
20.
21.
22.         if i > 10 and i < 20:
23.             sys[lat(i, j)] += 6
24.
25.         # Hopping in y-direction
26.         if j > 0:
27.             sys[lat(i, j), lat(i, j - 1)] = -t
28.
29.         # Hopping in x-direction
30.         if i > 0:
31.             sys[lat(i, j), lat(i - 1, j)] = -t
32.
35.
36. for j in range(W):
37.     left_lead[lat(0, j)] = 4 * t
38.     if j > 0:
39.         left_lead[lat(0, j), lat(0, j - 1)] = -t
40.     left_lead[lat(1, j), lat(0, j)] = -t
41.
43.
46.
47. for j in range(W):
48.     right_lead[lat(0, j)] = 4 * t
49.     if j > 0:
50.         right_lead[lat(0, j), lat(0, j - 1)] = -t
51.     right_lead[lat(1, j), lat(0, j)] = -t
52.
54.
55. sys = sys.finalized()
56.
57. energies = []
58. data = []
59. num_prop = []
60. for ie in range(100):
61.     energy = ie * 0.1
62.
63.     # compute the scattering matrix at a given energy
64.     smatrix = kwant.smatrix(sys, energy)
65.
66.     # compute the transmission probability from lead 0 to
68.     energies.append(energy)
69.     data.append(smatrix.transmission(1, 0))
70.     num_prop.append(smatrix.num_propagating(1))
71.
72. plt.figure()
73. plt.plot(energies, data, '.')
74. plt.xlabel("energy [t]")
75. plt.ylabel("conductance [e^2/h]")
76. plt.show()
77.
78. plt.figure()
79. plt.plot(energies, num_prop, '.')
80. plt.xlabel("energy [t]")
81. plt.ylabel("num_prop")
82. plt.show()