import pybinding as pb
import numpy as np
import matplotlib.pyplot as plt
from math import sqrt, pi
def monolayer_graphene():
t = 1 # [eV] nearest neighbour hopping
lat = pb.Lattice(a1=[2*sqrt(3), 0],
a2=[sqrt(3)/2, -1.5])
lat.add_sublattices(('A', [0, 0]),
('B', [sqrt(3)/2, -0.5]),
('C', [sqrt(3), 0]),
('D', [sqrt(3)*3/2, -0.5]))
lat.add_hoppings(
# inside the main cell
([0, 0], 'A', 'B', t),
([0, 0], 'B', 'C', t),
([0, 0], 'C', 'D', t),
# between neighboring cells
([0, -1], 'A', 'B', t),
([0, -1], 'C', 'D', -t),
([-1, 0], 'A', 'D', t),
)
return lat
pb.pltutils.use_style()
plt.figure(figsize=(8, 3))
lattice = monolayer_graphene()
shape = pb.rectangle(x=20, y=8)
model = pb.Model(lattice.with_min_neighbors(2), shape)
model.plot(site={'radius': 0.12, 'cmap': ['blue', 'red', 'blue', 'red']}, hopping={'width': 2, 'cmap': ['gray', 'cyan']
})
plt.xticks([])
plt.yticks([])
plt.axis('off')
plt.show()
设置site和hopping的颜色。