Finite size¶
See the tutorial page for a detailed walkthrough of system construction. These are just a few quick examples.
1D lattices and line shape¶
"""1D lattice chains - finite dimension are imposed using builtin `pb.line` shape"""
import pybinding as pb
import matplotlib.pyplot as plt
pb.pltutils.use_style()
def simple_chain_lattice(a=1, t=-1):
"""Very simple 1D lattice"""
lat = pb.Lattice(a)
lat.add_one_sublattice('A', [0, 0])
lat.add_one_hopping(1, 'A', 'A', t)
return lat
model = pb.Model(
simple_chain_lattice(),
pb.line(-3.5, 3.5) # line start/end in nanometers
)
model.plot()
plt.show()
def trestle(a=0.2, t1=0.8 + 0.6j, t2=2):
"""A more complicated 1D lattice with 2 sublattices"""
lat = pb.Lattice(1.3 * a)
lat.add_sublattices(
('A', [0, 0], 0),
('B', [a/2, a], 0)
)
lat.add_hoppings(
(0, 'A', 'B', t1),
(1, 'A', 'B', t1),
(1, 'A', 'A', t2),
(1, 'B', 'B', t2)
)
lat.min_neighbors = 2
return lat
model = pb.Model(trestle(), pb.line(-0.7, 0.7))
model.plot()
plt.show()
2D lattices and builtin shapes¶
"""Several finite-sized systems created using builtin lattices and shapes"""
import pybinding as pb
from pybinding.repository import graphene
import matplotlib.pyplot as plt
from math import pi
pb.pltutils.use_style()
model = pb.Model(
graphene.monolayer(),
pb.rectangle(x=2, y=1.2)
)
model.plot()
plt.show()
model = pb.Model(
graphene.monolayer(),
pb.regular_polygon(num_sides=6, radius=1.4, angle=pi/6)
)
model.plot()
plt.show()
# A graphene-specific shape which guaranties armchair edges on all sides
model = pb.Model(
graphene.bilayer(),
graphene.hexagon_ac(side_width=1)
)
model.plot()
plt.show()