-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbanda_grafeno.py
62 lines (48 loc) · 2.16 KB
/
banda_grafeno.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# %run matplotlib_setup.ipy
from types import SimpleNamespace
from ipywidgets import interact
import matplotlib
from matplotlib import pyplot
from mpl_toolkits import mplot3d
import numpy as np
import kwant
from kwant import wraparound
def momentum_to_lattice(k):
"""Transform momentum to the basis of reciprocal lattice vectors.
See https://en.wikipedia.org/wiki/Reciprocal_lattice#Generalization_of_a_dual_lattice
"""
B = np.array(graphene.prim_vecs).T
A = B.dot(np.linalg.inv(B.T.dot(B)))
return np.linalg.solve(A, k)
def dispersion_2D(syst, args=None, lim=1.5*np.pi, num_points=200):
"""A simple plot of 2D band structure."""
if args is None:
args = []
momenta = np.linspace(-lim, lim, num_points)
energies = []
for kx in momenta:
for ky in momenta:
lattice_k = momentum_to_lattice([kx, ky])
h = syst.hamiltonian_submatrix(args=(list(args) + list(lattice_k)))
energies.append(np.linalg.eigvalsh(h))
energies = np.array(energies).reshape(num_points, num_points, -1)
emin, emax = np.min(energies), np.max(energies)
kx, ky = np.meshgrid(momenta, momenta)
fig = pyplot.figure()
axes = fig.add_subplot(1, 1, 1, projection='3d')
for band in range(energies.shape[-1]):
axes.plot_surface(kx, ky, energies[:, :, band], cstride=2, rstride=2,
cmap=matplotlib.cm.RdBu_r, vmin=emin, vmax=emax,
linewidth=0.1)
graphene = kwant.lattice.general([[1, 0], [1/2, np.sqrt(3)/2]], # lattice vectors
[[0, 0], [0, 1/np.sqrt(3)]]) # Coordinates of the sites
a, b = graphene.sublattices
bulk_graphene = kwant.Builder(kwant.TranslationalSymmetry(*graphene.prim_vecs))
bulk_graphene[graphene.shape((lambda pos: True), (0, 0))] = 0
bulk_graphene[graphene.neighbors(1)] = 1
dispersion_2D(wraparound.wraparound(bulk_graphene).finalized())
zigzag_ribbon = kwant.Builder(kwant.TranslationalSymmetry([1, 0]))
zigzag_ribbon[graphene.shape((lambda pos: abs(pos[1]) < 9), (0, 0))] = 0
zigzag_ribbon[graphene.neighbors(1)] = 1
kwant.plot(bulk_graphene)
# kwant.plotter.bands(zigzag_ribbon.finalized());