def test_complex_multiorbital_hamiltonian(): def checkerboard_lattice(delta, t): lat = pb.Lattice(a1=[1, 0], a2=[0, 1]) lat.add_sublattices(('A', [0, 0], -delta), ('B', [1 / 2, 1 / 2], delta)) lat.add_hoppings( ([0, 0], 'A', 'B', t), ([0, -1], 'A', 'B', t), ([-1, 0], 'A', 'B', t), ([-1, -1], 'A', 'B', t), ) return lat hopp_t = np.array([[2 + 2j, 3 + 3j], [4 + 4j, 5 + 5j]]) # multi-orbital hopping onsite_en = np.array([[1, 1j], [-1j, 1]]) # onsite energy model = pb.Model(checkerboard_lattice(onsite_en, hopp_t), pb.translational_symmetry(True, True)) h = model.hamiltonian.toarray() assert model.system.num_sites == 2 assert h.shape[0] == 4 assert pytest.fuzzy_equal(h, h.T.conjugate()) # check if Hermitian assert pytest.fuzzy_equal( h[:2, :2], -h[-2:, -2:]) # onsite energy on A and B is opposite assert pytest.fuzzy_equal(h[:2, 2:4], 4 * hopp_t) # hopping A <-> B is 4 * hopp_t
def plot(self, vector_position='center', **kwargs): """Illustrate the lattice by plotting the primitive cell and its nearest neighbors Parameters ---------- vector_position : array_like or 'center' Cartesian position to be used as the origin for the lattice vectors. By default the origin is placed in the center of the primitive cell. **kwargs Forwarded to `System.plot()`. """ import pybinding as pb # reuse model plotting code (kind of meta) model = pb.Model(self, pb.translational_symmetry()) model.system.plot(**with_defaults(kwargs, hopping_props=dict(colors='#777777'))) # by default, plot the lattice vectors from the center of the unit cell sub_center = sum(s.offset for s in self.sublattices) / len(self.sublattices) if vector_position is not None: self.plot_vectors(sub_center if vector_position == 'center' else vector_position) # annotate sublattice names sub_names = {sub_id: name for name, sub_id in self.sub_name_map.items()} for sub in self.sublattices: pltutils.annotate_box(sub_names[sub.alias], xy=sub.offset[:2], bbox=dict(lw=0)) # annotate neighboring cell indices offsets = [(0, 0, 0)] for sub in self.sublattices: for hop in sub.hoppings: if tuple(hop.relative_index[:2]) == (0, 0): continue # skip the original cell # offset of the neighboring cell from the original offset = sum(r * v for r, v in zip(hop.relative_index, self.vectors)) offsets.append(offset) text = "[" + ", ".join(map(str, hop.relative_index[:self.ndim])) + "]" # align the text so that it goes away from the original cell ha, va = pltutils.align(*(-offset[:2])) pltutils.annotate_box(text, xy=(sub_center[:2] + offset[:2]) * 1.05, ha=ha, va=va, clip_on=True, bbox=dict(lw=0)) # ensure there is some padding around the lattice points = [n * v + o for n in (-0.5, 0.5) for v in self.vectors for o in offsets] x, y, _ = zip(*points) pltutils.set_min_axis_length(abs(max(x) - min(x)), 'x') pltutils.set_min_axis_length(abs(max(y) - min(y)), 'y')
def test_lapack(baseline, plot_if_fails): model = pb.Model(graphene.monolayer(), pb.translational_symmetry()) solver = pb.solver.lapack(model) assert pytest.fuzzy_equal(solver.eigenvalues, [-3*abs(graphene.t), 3*abs(graphene.t)]) from math import pi, sqrt g = [0, 0] k1 = [-4*pi / (3*sqrt(3) * graphene.a_cc), 0] m = [0, 2*pi / (3 * graphene.a_cc)] k2 = [2*pi / (3*sqrt(3) * graphene.a_cc), 2*pi / (3 * graphene.a_cc)] bands = solver.calc_bands(k1, g, m, k2, step=3) expected = baseline(bands) plot_if_fails(bands, expected, 'plot') assert pytest.fuzzy_equal(bands, expected, 2.e-2, 1.e-6)
def model_ssh(t1=1, t2=1, m=0, n=26, m1=0): """returns SSH model Args: t1 (int, optional): incell interaction t2 (int, optional): inter cell interaction m (int, optional): mass gap n (int, optional): number of cells m1 (int, optional): alternate mass gap difference Returns: TYPE: Description """ def mass_term(delta): """Break sublattice symmetry with opposite A and B onsite energy""" @pb.onsite_energy_modifier def potential(energy, x, y, z, sub_id): pot = [] for i in range(len(x)): if x[i] < 0: if sub_id in ['A']: pot.append(-delta) if sub_id in ['B']: pot.append(delta) else: #if ang<=0 and ang>-180: if sub_id in ['A']: pot.append(delta) if sub_id in ['B']: pot.append(-delta) return np.array(pot) return potential d = 1 t1 = t1 t2 = t2 m = m m1 = m1 lattice = pb.Lattice(a1=[d]) lattice.add_sublattices(('A', [0], 0), ('B', [.5], 0)) lattice.add_hoppings(([0, 0], 'A', 'B', t1), ([1, 0], 'B', 'A', t2)) model = pb.Model(lattice, pb.rectangle(n), mass_term(m), pb.translational_symmetry(a1=False)) return model
pb.pltutils.use_style() def ring(inner_radius, outer_radius): """A simple ring shape""" def contains(x, y, z): r = np.sqrt(x**2 + y**2) return np.logical_and(inner_radius < r, r < outer_radius) return pb.FreeformShape(contains, width=[2 * outer_radius, 2 * outer_radius]) model = pb.Model( graphene.monolayer_4atom(), ring(inner_radius=1.4, outer_radius=2), # length in nanometers pb.translational_symmetry(a1=3.8, a2=False) # period in nanometers ) plt.figure(figsize=pb.pltutils.cm2inch(20, 7)) model.plot() plt.show() # only solve for the 10 lowest energy eigenvalues solver = pb.solver.arpack(model, k=10) a = 3.8 # [nm] unit cell length bands = solver.calc_bands(-pi/a, pi/a) bands.plot(point_labels=[r'$-\pi / a$', r'$\pi / a$']) plt.show()
def plot(self, vector_position='center', **kwargs): """Illustrate the lattice by plotting the primitive cell and its nearest neighbors Parameters ---------- vector_position : array_like or 'center' Cartesian position to be used as the origin for the lattice vectors. By default the origin is placed in the center of the primitive cell. **kwargs Forwarded to `System.plot()`. """ import pybinding as pb # reuse model plotting code (kind of meta) model = pb.Model(self, pb.translational_symmetry()) model.system.plot( **with_defaults(kwargs, hopping=dict(color='#777777', width=1))) # by default, plot the lattice vectors from the center of the unit cell sub_center = sum(s.position for s in self.sublattices.values()) / self.nsub if vector_position is not None: self.plot_vectors(sub_center if vector_position == 'center' else vector_position) # annotate sublattice names for name, sub in self.sublattices.items(): pltutils.annotate_box(name, xy=sub.position[:2], bbox=dict(boxstyle="circle,pad=0.3", alpha=0.2, lw=0)) # collect relative indices where annotations should be drawn relative_indices = [] for hopping_family in self.hoppings.values(): for term in hopping_family.terms: if tuple(term.relative_index[:2]) == (0, 0): continue # skip the original cell relative_indices.append(term.relative_index) relative_indices.append(-term.relative_index) # 3D distance (in length units) of the neighboring cell from the original offsets = [ sum(r * v for r, v in zip(ri, self.vectors)) for ri in relative_indices ] # annotate neighboring cell indices for relative_index, offset in zip(relative_indices, offsets): text = "[" + ", ".join(map(str, relative_index[:self.ndim])) + "]" # align the text so that it goes away from the original cell ha, va = pltutils.align(*(-offset[:2])) pltutils.annotate_box(text, xy=(sub_center[:2] + offset[:2]) * 1.05, ha=ha, va=va, clip_on=True, bbox=dict(lw=0)) # ensure there is some padding around the lattice offsets += [(0, 0, 0)] points = [ n * v + o for n in (-0.5, 0.5) for v in self.vectors for o in offsets ] x, y, _ = zip(*points) pltutils.set_min_axis_length(abs(max(x) - min(x)), 'x') pltutils.set_min_axis_length(abs(max(y) - min(y)), 'y')
The `y0` argument is the position of the junction, while `v1` and `v2` are the values of the potential (in eV) before and after the junction. """ @pb.onsite_energy_modifier def potential(energy, y): energy[y < y0] += v1 energy[y >= y0] += v2 return energy return potential model = pb.Model( graphene.monolayer(), pb.rectangle(1.2), # width in nanometers pb.translational_symmetry(a1=True, a2=False), mass_term(delta=2.5), # eV pn_juction(y0=0, v1=-2.5, v2=2.5) # y0 in [nm] and v1, v2 in [eV] ) model.system.plot() plt.show() # plot the potential: note that pn_junction cancels out delta on some sites model.onsite_map.plot_structure(cmap="coolwarm", site_radius=0.04) pb.pltutils.colorbar(label="U (eV)") plt.show() # compute the bands solver = pb.solver.lapack(model) a = graphene.a_cc * sqrt(3) # nanoribbon unit cell length
([1, -1], 'A', 'B', t), ([0, -1], 'A', 'B', t) ) return lat lattice = monolayer_graphene() lattice.plot() plt.show() lattice.plot_brillouin_zone() plt.show() model = pb.Model(monolayer_graphene(), pb.translational_symmetry()) solver = pb.solver.lapack(model) a_cc = 0.142 Gamma = [0, 0] K1 = [-4*pi / (3*sqrt(3)*a_cc), 0] M = [0, 2*pi / (3*a_cc)] K2 = [2*pi / (3*sqrt(3)*a_cc), 2*pi / (3*a_cc)] bands = solver.calc_bands(K1, Gamma, M, K2) bands.plot(point_labels=['K', r'$\Gamma$', 'M', 'K']) plt.show() model.lattice.plot_brillouin_zone(decorate=False) bands.plot_kpath(point_labels=['K', r'$\Gamma$', 'M', 'K'])
"""One dimensional lattice with complex hoppings""" import pybinding as pb import matplotlib.pyplot as plt pb.pltutils.use_style() def trestle(d=0.2, t1=0.8 + 0.6j, t2=2): lat = pb.Lattice(a1=1.3 * d) lat.add_sublattices(('A', [0, 0], 0), ('B', [d / 2, d], 0)) lat.add_hoppings((0, 'A', 'B', t1), (1, 'A', 'B', t1), (1, 'A', 'A', t2), (1, 'B', 'B', t2)) return lat lattice = trestle() lattice.plot() plt.show() lattice.plot_brillouin_zone() plt.show() model = pb.Model(trestle(), pb.translational_symmetry()) solver = pb.solver.lapack(model) reciprocal_length = lattice.brillouin_zone()[0] bands = solver.calc_bands(0, reciprocal_length) bands.plot() plt.show()
# - scaling, if None it's automatic, if present select spectrum_bound=[e_min, e_max] configuration = kite.Configuration(divisions=[nx, ny], length=[l1, l2], boundaries=[True, True], is_complex=False, precision=1, spectrum_range=[-10, 10]) # require the calculation of DOS num_moments = 1000 calculation = kite.Calculation(configuration) calculation.dos(num_moments=num_moments, num_random=1, num_disorder=1, num_points=1000) # make modification object which caries info about # for a quick check, let's make a Pybinding model and check the DOS model = pb.Model(lattice, pb.rectangle(100, 100), pb.translational_symmetry(a1=50, a2=50)) # if you would like to specify Disorder, use other function that takes of converting KITE to Pybinding disorder objects # model = kite.make_pybinding_model(lattice) # dos = pb.kpm(model).calc_dos(np.linspace(-4, 4, 2000), broadening=1e-2, num_random=1) # dos.plot() # plt.show() # configure the *.h5 file kite.config_system(lattice, configuration, calculation, filename='tblg_{:.3f}.h5'.format(angle))
([-1, 0], 'C', 'D', 't5'), ([0, 1], 'C', 'D', 't5'), ([0, -1], 'C', 'D', 't5'), ) return lat plt.figure(figsize=(6, 6)) lattice = phosphorene_4band() lattice.plot() plt.show() lattice.plot_brillouin_zone() plt.show() model = pb.Model(phosphorene_4band(), pb.translational_symmetry()) solver = pb.solver.lapack(model) ax = 0.438 ay = 0.332 kx = pi / ax ky = pi / ay bands = solver.calc_bands([kx, ky], [kx, 0], [0, 0], [0, ky], [kx, ky]) bands.plot(point_labels=['S', 'Y', '$\Gamma$', 'X', 'S']) plt.show() model.lattice.plot_brillouin_zone(decorate=False) bands.plot_kpath(point_labels=['S', 'Y', '$\Gamma$', 'X', 'S']) plt.show()
pb.pltutils.use_style() def ring(inner_radius, outer_radius): """A simple ring shape""" def contains(x, y, z): r = np.sqrt(x**2 + y**2) return np.logical_and(inner_radius < r, r < outer_radius) return pb.FreeformShape(contains, width=[2 * outer_radius, 2 * outer_radius]) model = pb.Model( graphene.monolayer_4atom(), ring(inner_radius=1.4, outer_radius=2), # length in nanometers pb.translational_symmetry(a1=3.8, a2=False) # period in nanometers ) plt.figure(figsize=pb.pltutils.cm2inch(20, 7)) model.system.plot() plt.show() # only solve for the 10 lowest energy eigenvalues solver = pb.solver.arpack(model, k=10) a = 3.8 # [nm] unit cell length bands = solver.calc_bands(-pi/a, pi/a) bands.plot(point_labels=['$-\pi / a$', '$\pi / a$']) plt.show()
"""Calculate and plot the band structure of monolayer graphene""" import pybinding as pb import matplotlib.pyplot as plt from math import sqrt, pi from pybinding.repository import graphene pb.pltutils.use_style() model = pb.Model( graphene.monolayer(), # predefined lattice from the material repository pb.translational_symmetry() # creates an infinite sheet of graphene ) solver = pb.solver.lapack(model) # eigensolver from the LAPACK library # significant points in graphene's Brillouin zone a_cc = graphene.a_cc # carbon-carbon distance Gamma = [0, 0] K1 = [-4 * pi / (3 * sqrt(3) * a_cc), 0] M = [0, 2 * pi / (3 * a_cc)] K2 = [2 * pi / (3 * sqrt(3) * a_cc), 2 * pi / (3 * a_cc)] # plot the bands through the desired points bands = solver.calc_bands(K1, Gamma, M, K2) bands.plot(point_labels=['K', r'$\Gamma$', 'M', 'K']) plt.show()
import pytest import pybinding as pb from pybinding.repository import graphene models = { 'graphene-monolayer': [graphene.monolayer(), graphene.hexagon_ac(1)], 'graphene-monolayer-alt': [graphene.monolayer_alt(), pb.rectangle(1.6, 1.4)], 'graphene-monolayer-4atom': [graphene.monolayer_4atom()], 'graphene-monolayer-nn': [graphene.monolayer(2), pb.regular_polygon(6, 0.9)], 'graphene-monolayer-periodic-1d': [graphene.monolayer(), pb.primitive(5, 5), pb.translational_symmetry(a1=True, a2=False)], 'graphene-monolayer-periodic-1d-alt': [graphene.monolayer_4atom(), pb.rectangle(1), pb.translational_symmetry(a1=False, a2=0.6)], 'graphene-monolayer-periodic-2d': [graphene.monolayer(), pb.primitive(a1=5, a2=5), pb.translational_symmetry(a1=1, a2=1)], 'graphene-monolayer-4atom-periodic-2d': [graphene.monolayer_4atom(), pb.rectangle(1), pb.translational_symmetry(a1=0.6, a2=0.6)], 'graphene-bilayer': [graphene.bilayer(), graphene.hexagon_ac(0.6)], } @pytest.fixture(scope='module', ids=list(models.keys()), params=models.values()) def model(request): return pb.Model(*request.param) def test_api(): model = pb.Model(graphene.monolayer(), pb.primitive(2, 2)) system = model.system
# next-nearest ([1, 0], 'A', 'A', t_nn), ([1, 0], 'B', 'B', t_nn), ([0, 1], 'A', 'A', t_nn), ([0, 1], 'B', 'B', t_nn), ([1, -1], 'A', 'A', t_nn), ([1, -1], 'B', 'B', t_nn)) return lat lattice = monolayer_graphene_nn() lattice.plot() plt.show() lattice.plot_brillouin_zone() plt.show() model = pb.Model(monolayer_graphene_nn(), pb.translational_symmetry()) solver = pb.solver.lapack(model) a_cc = 0.142 Gamma = [0, 0] K1 = [-4 * pi / (3 * sqrt(3) * a_cc), 0] M = [0, 2 * pi / (3 * a_cc)] K2 = [2 * pi / (3 * sqrt(3) * a_cc), 2 * pi / (3 * a_cc)] # Note the elector-hole asymmetry in the band structure (due to t_nn). bands = solver.calc_bands(K1, Gamma, M, K2) bands.plot(point_labels=['K', r'$\Gamma$', 'M', 'K']) plt.show()
import pytest import numpy as np import pybinding as pb from pybinding.repository import graphene, group6_tmd models = { 'graphene-monolayer': [graphene.monolayer(), graphene.hexagon_ac(1)], 'graphene-monolayer-alt': [graphene.monolayer_alt(), pb.rectangle(1.6, 1.4)], 'graphene-monolayer-4atom': [graphene.monolayer_4atom()], 'graphene-monolayer-nn': [graphene.monolayer(2), pb.regular_polygon(6, 0.9)], 'graphene-monolayer-periodic-1d': [graphene.monolayer(), pb.primitive(5, 5), pb.translational_symmetry(a1=True, a2=False)], 'graphene-monolayer-periodic-1d-alt': [graphene.monolayer_4atom(), pb.rectangle(1), pb.translational_symmetry(a1=False, a2=0.6)], 'graphene-monolayer-periodic-2d': [graphene.monolayer(), pb.primitive(a1=5, a2=5), pb.translational_symmetry(a1=1, a2=1)], 'graphene-monolayer-4atom-periodic-2d': [graphene.monolayer_4atom(), pb.rectangle(1), pb.translational_symmetry(a1=0.6, a2=0.6)], 'graphene-bilayer': [graphene.bilayer(), graphene.hexagon_ac(0.6)], } @pytest.fixture(scope='module', ids=list(models.keys()), params=models.values()) def model(request): return pb.Model(*request.param) def test_pickle_round_trip(model): import pickle unpickled = pickle.loads(pickle.dumps(model.system))
"""Two dimensional checkerboard lattice with real hoppings""" import pybinding as pb import matplotlib.pyplot as plt from math import pi pb.pltutils.use_style() def checkerboard(d=0.2, delta=1.1, t=0.6): lat = pb.Lattice(a1=[d, 0], a2=[0, d]) lat.add_sublattices(('A', [0, 0], -delta), ('B', [d / 2, d / 2], delta)) lat.add_hoppings(([0, 0], 'A', 'B', t), ([0, -1], 'A', 'B', t), ([-1, 0], 'A', 'B', t), ([-1, -1], 'A', 'B', t)) return lat lattice = checkerboard() lattice.plot() plt.show() lattice.plot_brillouin_zone() plt.show() model = pb.Model(checkerboard(), pb.translational_symmetry()) solver = pb.solver.lapack(model) bands = solver.calc_bands([0, 0], [0, 5 * pi], [5 * pi, 5 * pi], [0, 0]) bands.plot() plt.show()
def plot(self, vector_position='center', **kwargs): """Illustrate the lattice by plotting the primitive cell and its nearest neighbors Parameters ---------- vector_position : array_like or 'center' Cartesian position to be used as the origin for the lattice vectors. By default the origin is placed in the center of the primitive cell. **kwargs Forwarded to `System.plot()`. """ import pybinding as pb # reuse model plotting code (kind of meta) model = pb.Model(self, pb.translational_symmetry()) model.system.plot( **with_defaults(kwargs, hopping_props=dict(colors='#777777'))) # by default, plot the lattice vectors from the center of the unit cell sub_center = sum(s.offset for s in self.sublattices) / len(self.sublattices) if vector_position is not None: self.plot_vectors(sub_center if vector_position == 'center' else vector_position) # annotate sublattice names sub_names = { sub_id: name for name, sub_id in self.sub_name_map.items() } for sub in self.sublattices: pltutils.annotate_box(sub_names[sub.alias], xy=sub.offset[:2], bbox=dict(lw=0)) # annotate neighboring cell indices offsets = [(0, 0, 0)] for sub in self.sublattices: for hop in sub.hoppings: if tuple(hop.relative_index[:2]) == (0, 0): continue # skip the original cell # offset of the neighboring cell from the original offset = sum(r * v for r, v in zip(hop.relative_index, self.vectors)) offsets.append(offset) text = "[" + ", ".join(map( str, hop.relative_index[:self.ndim])) + "]" # align the text so that it goes away from the original cell ha, va = pltutils.align(*(-offset[:2])) pltutils.annotate_box(text, xy=(sub_center[:2] + offset[:2]) * 1.05, ha=ha, va=va, clip_on=True, bbox=dict(lw=0)) # ensure there is some padding around the lattice points = [ n * v + o for n in (-0.5, 0.5) for v in self.vectors for o in offsets ] x, y, _ = zip(*points) pltutils.set_min_axis_length(abs(max(x) - min(x)), 'x') pltutils.set_min_axis_length(abs(max(y) - min(y)), 'y')
l1 = np.array(l1[0:2]) / 10. l2 = np.array(l2[0:2]) / 10. positions = np.column_stack((x_coord, y_coord, z_coord)) positions_to = copy.deepcopy(positions) # load a PB lattice complete_lattice = pb.load('lattice_' + name[:-4]) num_x = 1 num_y = 1 print('Done loading ', flush=True) print('Making the model', flush=True) # check for the bonds model = pb.Model( complete_lattice, pb.force_double_precision(), pb.translational_symmetry(a1=num_x * np.linalg.norm(l1), a2=num_y * np.linalg.norm(l2))) model.eval() print(model.report(), flush=True) kpm = pb.kpm(model, kernel=pb.jackson_kernel(), matrix_format="CSR", optimal_size=False, interleaved=False) print(kpm.scaling_factors) nx = 5 ny = 4 e_min = -11.7 e_max = +9.3 num_a1 = 640
('B2', [0, 3*graphene.a_cc/2, -c0])) lat.register_hopping_energies({'t': graphene.t, 't_layer': -0.4}) lat.add_hoppings( # layer 1 ([ 0, 0], 'A1', 'B1', 't'), ([ 1, -1], 'A1', 'B1', 't'), ([ 0, -1], 'A1', 'B1', 't'), # layer 2 ([ 0, 0], 'A2', 'B2', 't'), ([ 1, -1], 'A2', 'B2', 't'), ([ 0, -1], 'A2', 'B2', 't'), # interlayer ([ 0, 0], 'B1', 'A2', 't_layer') ) lat.min_neighbors = 2 return lat model = pb.Model( bilayer_graphene(), pb.rectangle(1.3), # nm pb.translational_symmetry(a1=True, a2=False) ) model.plot() model.lattice.plot_vectors(position=[-0.6, 0.3]) # nm plt.show() solver = pb.solver.lapack(model) bands = solver.calc_bands(-pi/graphene.a, pi/graphene.a) bands.plot(point_labels=['$-\pi / a$', '$\pi / a$']) plt.show()
def trestle(d=0.2, t1=0.8 + 0.6j, t2=2): lat = pb.Lattice(a1=1.3*d) lat.add_sublattices( ('A', [0, 0], 0), ('B', [d/2, d], 0) ) lat.add_hoppings( (0, 'A', 'B', t1), (1, 'A', 'B', t1), (1, 'A', 'A', t2), (1, 'B', 'B', t2) ) return lat lattice = trestle() lattice.plot() plt.show() lattice.plot_brillouin_zone() plt.show() model = pb.Model(trestle(), pb.translational_symmetry()) solver = pb.solver.lapack(model) reciprocal_length = lattice.brillouin_zone()[0] bands = solver.calc_bands(0, reciprocal_length) bands.plot() plt.show()
"""Calculate and plot the band structure of monolayer graphene""" import pybinding as pb import matplotlib.pyplot as plt from math import sqrt, pi from pybinding.repository import graphene pb.pltutils.use_style() model = pb.Model( graphene.monolayer(), # predefined lattice from the material repository pb.translational_symmetry() # creates an infinite sheet of graphene ) solver = pb.solver.lapack(model) # eigensolver from the LAPACK library # significant points in graphene's Brillouin zone a_cc = graphene.a_cc # carbon-carbon distance Gamma = [0, 0] K1 = [-4*pi / (3*sqrt(3)*a_cc), 0] M = [0, 2*pi / (3*a_cc)] K2 = [2*pi / (3*sqrt(3)*a_cc), 2*pi / (3*a_cc)] # plot the bands through the desired points bands = solver.calc_bands(K1, Gamma, M, K2) bands.plot(point_labels=['K', r'$\Gamma$', 'M', 'K']) plt.show()
([-1, 0], 'A1', 'B1', 'gamma0'), # layer 2 ([0, 0], 'A2', 'B2', 'gamma0'), ([0, 1], 'A2', 'B2', 'gamma0'), ([-1, 0], 'A2', 'B2', 'gamma0'), # interlayer ([0, 0], 'B1', 'A2', 'gamma1')) return lat lattice = bilayer_graphene() lattice.plot() plt.show() lattice.plot_brillouin_zone() plt.show() model = pb.Model(bilayer_graphene(), pb.translational_symmetry()) solver = pb.solver.lapack(model) a_cc = 0.142 Gamma = [0, 0] K1 = [-4 * pi / (3 * sqrt(3) * a_cc), 0] M = [0, 2 * pi / (3 * a_cc)] K2 = [2 * pi / (3 * sqrt(3) * a_cc), 2 * pi / (3 * a_cc)] bands = solver.calc_bands(K1, Gamma, M, K2) bands.plot(point_labels=['K', r'$\Gamma$', 'M', 'K']) plt.show()
pb.pltutils.use_style() def checkerboard(d=0.2, delta=1.1, t=0.6): lat = pb.Lattice(a1=[d, 0], a2=[0, d]) lat.add_sublattices( ('A', [0, 0], -delta), ('B', [d/2, d/2], delta) ) lat.add_hoppings( ([ 0, 0], 'A', 'B', t), ([ 0, -1], 'A', 'B', t), ([-1, 0], 'A', 'B', t), ([-1, -1], 'A', 'B', t) ) return lat lattice = checkerboard() lattice.plot() plt.show() lattice.plot_brillouin_zone() plt.show() model = pb.Model(checkerboard(), pb.translational_symmetry()) solver = pb.solver.lapack(model) bands = solver.calc_bands([0, 0], [0, 5*pi], [5*pi, 5*pi], [0, 0]) bands.plot() plt.show()
T3_20 = [[t3_33, t3_13, t3_23], [t3_31, t3_11, t3_21], [t3_32, t3_12, t3_22]] T3_22 = [[t3_22, t3_23, t3_21], [t3_32, t3_33, t3_31], [t3_12, t3_13, t3_11]] # create a simple 2D lattice with vectors a1 and a2 lattice = pb.Lattice(a1=[d, 0], a2=[-0.5 * d, d * rt3 / 2]) lattice.add_sublattices( ('A', [0, 0], h0) # add an atom called 'A' at position [0, 0] ) lattice.add_hoppings( # (relative_index, from_sublattice, to_sublattice, energy) ([0, 1], 'A', 'A', T1_01), ([1, 0], 'A', 'A', T1_10), ([1, 1], 'A', 'A', T1_11), ([1, -1], 'A', 'A', T2_m11), ([2, 1], 'A', 'A', T2_21), ([1, 2], 'A', 'A', T2_12), ([0, 2], 'A', 'A', T3_02), ([2, 0], 'A', 'A', T3_20), ([2, 2], 'A', 'A', T3_22)) #lattice.plot() #lattice.plot_brillouin_zone() model = pb.Model(lattice, pb.translational_symmetry()) model.plot() # solver = pb.solver.lapack(model) # Gamma = [0, 0] # M = [0, 2*pi/3] # K = [2*pi/(3*sqrt(3)), 2*pi/3] # bands = solver.calc_bands(Gamma, M, K, Gamma) # bands.plot(point_labels=[r'$\Gamma$', 'M', 'K',r'$\Gamma$']) plt.show()
([ 0, -1], 'C', 'D', 't5'), ) return lat plt.figure(figsize=(6, 6)) lattice = phosphorene_4band() lattice.plot() plt.show() lattice.plot_brillouin_zone() plt.show() model = pb.Model(phosphorene_4band(), pb.translational_symmetry()) solver = pb.solver.lapack(model) ax = 0.438 ay = 0.332 kx = pi / ax ky = pi / ay bands = solver.calc_bands([kx, ky], [kx, 0], [0, 0], [0, ky], [kx, ky]) bands.plot(point_labels=['S', 'Y', '$\Gamma$', 'X', 'S']) plt.show() model.lattice.plot_brillouin_zone(decorate=False) bands.plot_kpath(point_labels=['S', 'Y', '$\Gamma$', 'X', 'S']) plt.show()