Skip to content

Commit dc91d85

Browse files
committed
Add plot to Kane-Mele example, fix coordinates
1 parent 4a867ad commit dc91d85

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
plot.pdf

examples/hm/kane_mele_model/run.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ def get_kane_mele_hamiltonian(t, lambda_v, lambda_R, lambda_SO):
2020
def inner(k):
2121
k = np.array(k) * 2 * np.pi
2222
kx, ky, kz = k
23-
x = kx / 2
24-
y = sqrt(3) * ky / 2
23+
# change to reduced coordinates
24+
x = (kx - ky) / 2
25+
y = (kx + ky) / 2
2526
return (
2627
t * (1 + 2 * cos(x) * cos(y)) * kron(pauli_x, identity) +
2728
lambda_v * kron(pauli_z, identity) +
@@ -34,10 +35,19 @@ def inner(k):
3435
)
3536
return inner
3637

37-
def get_z2(hamiltonian):
38-
system = z2pack.hm.System(hamiltonian, bands=2)
39-
res = z2pack.surface.run(system=system, surface=lambda s, t: [s / 2, t, 0])
40-
return z2pack.invariant.z2(res)
41-
4238
if __name__ == '__main__':
43-
print('Z2 invariant: {}'.format(get_z2(get_kane_mele_hamiltonian(t=1, lambda_v=0.1, lambda_R=0.05, lambda_SO=0.06))))
39+
system = z2pack.hm.System(
40+
get_kane_mele_hamiltonian(
41+
t=1, lambda_v=0.1, lambda_R=0.05, lambda_SO=0.06
42+
)
43+
)
44+
res = z2pack.surface.run(system=system, surface=lambda s, t: [s / 2, t, 0])
45+
print('Z2 invariant: {}'.format(z2pack.invariant.z2(res)))
46+
fig, ax = plt.subplots(figsize=[5, 3])
47+
z2pack.plot.wcc(res, axis=ax)
48+
ax.set_xticks([0, 1])
49+
ax.set_xticklabels(['0', '0.5'])
50+
ax.set_xlabel(r'$k_y$')
51+
ax.set_yticks([0, 1])
52+
ax.set_ylabel(r'$\bar{y}$', rotation='horizontal')
53+
plt.savefig('plot.pdf', bbox_inches='tight')

0 commit comments

Comments
 (0)