Lattices and Regions
On this page
Every matrix in caroli is built on a region: a finite, ordered list of sites of a lattice. The lattice says where the sites are and how many orbitals each one carries; the region says which sites make the sample and in which order their orbitals appear in the Hamiltonian, in the Green's functions and in every vector of results. This page describes the crate caroli-lattice, which holds these two objects, and the reduction modulo a lattice of periods with which caroli-model builds the Hamiltonians of periodic supercells. The models that live on a lattice are the subject of Tight-Binding Models.
Bravais lattices with a basis
A lattice of dimension \(d = 1, 2\) or \(3\) has \(d\) primitive vectors \(\mathbf a_1, \dots, \mathbf a_d\), given in Cartesian coordinates as vectors of three components (the third is zero in two dimensions), and a basis of sublattices. Sublattice \(\alpha\) sits at the offset \(\boldsymbol\tau_\alpha\) in the unit cell and carries \(n_\alpha\) orbitals on each of its sites, spin included: a site of the BHZ model has \(n_\alpha = 4\), a site of spinless graphene 1.
Lengths are in the unit of the primitive vectors. The square, cubic and continuum models use a lattice constant of 1, the length unit \(a = 1\) of the conventions; the graphene preset gives its nearest-neighbour distance instead.
| Constructor | Primitive vectors | Sublattices |
|---|---|---|
Lattice::new(&[a1, ...]), then .with_sublattice(name, τ, n) for each sublattice | Any 1 to 3 vectors | Any, numbered from 0 in the order they are added |
Lattice::square(a, n) | \((a, 0, 0)\), \((0, a, 0)\) | A at the origin |
Lattice::cubic(a, n) | \((a, 0, 0)\), \((0, a, 0)\), \((0, 0, a)\) | A at the origin |
Lattice::honeycomb(a, n) | \((\sqrt 3\, a, 0, 0)\), \((\sqrt 3\, a/2, 3a/2, 0)\) | A at the origin, B at \((0, a, 0)\) |
The honeycomb lattice is given by its nearest-neighbour distance \(a\): its lattice constant is \(\sqrt 3\, a\) and the area of its cell \(3\sqrt 3\, a^2/2\). The three neighbours of the A site of cell \(\mathbf R\) are the B sites of the cells \(\mathbf R\), \(\mathbf R - \mathbf a_2\) and \(\mathbf R + \mathbf a_1 - \mathbf a_2\), at the distance \(a\) in the directions 90°, 210° and 330°. The first primitive vector is a zigzag direction. A ribbon cut along it by Region::cuboid has its edges along the zigzag direction, terminated as bearded edges: the A sites of the first row of cells and the B sites of the last row keep a single neighbour, the bond inside their cell. Without these sites (Region::shaped, Region::from_sites) the edges are zigzag (Spectra and Bands shows how their bands differ).
A one-dimensional chain is Lattice::new(&[[a, 0.0, 0.0]]) with one sublattice, as the continuum models and the chain preset of the caroli command build it.
The constructors panic on a lattice with no vector or more than three, and on a sublattice without orbitals. They do not check that the vectors are linearly independent, nor that two sublattices sit at different positions.
Sites and their positions
A site is a pair \((\mathbf R, \alpha)\): the cell \(\mathbf R\), given by its integer coordinates \((n_1, n_2, n_3)\) along the primitive vectors (the coordinates beyond the dimension are 0 by convention), and the index \(\alpha\) of its sublattice. Its Cartesian position is
$$ \mathbf r(\mathbf R, \alpha) = \sum_{i=1}^{d} n_i\, \mathbf a_i + \boldsymbol\tau_\alpha . $$
Sites are compared, hashed and ordered by their integers (the cell, then the sublattice), never by their positions, so the identity of a site is exact. Positions enter only where a length enters the physics: the shape of a region, the Peierls phases of a magnetic field, the displacement of a bond (velocities, uniform vector potentials).
Regions
A region is a finite, ordered set of distinct sites of one lattice. Three constructors make one:
| Constructor | Sites | Order |
|---|---|---|
Region::cuboid(lattice, [N1, N2, N3]) | Every sublattice of the cells \(0 \le n_i \lt N_i\) along each primitive vector (the extents beyond the dimension are ignored) | The first axis slowest, the sublattice fastest |
Region::shaped(lattice, extent, inside) | The sites of the same cuboid whose position \(\mathbf r\) satisfies inside(r) | That of the cuboid |
Region::from_sites(lattice, sites) | The sites given; a duplicate or an unknown sublattice panics | As given |
shaped cuts a sample out of a parallelepiped of cells: a disc, a ring, a polygonal flake. It starts from the cells \(0 \le n_i \lt N_i\), so the shape must lie there. from_sites takes any list, for the geometries no cuboid holds (crosses, Hall bars, rings with arms) or for an order of one's own. translated(cells) moves a region by a whole number of cells: the cells of a lead are translates of the slice it continues.
A region keeps a hash table from its sites to their indices: index_of tells in constant time whether a site belongs to the region, and where.
The orbital layout
The order of the sites fixes the order of the orbitals. Site \(i\) owns the \(n_i\) consecutive orbitals that start at
$$ \mathrm{offset}(i) = \sum_{j \lt i} n_j , \qquad N = \sum_{i} n_i , $$
where \(n_j\) is the number of orbitals of the sublattice of site \(j\) and \(N\) the size of every matrix built on the region. The block \(H_{ij} = \langle i \rvert H \lvert j \rangle\) of a Hamiltonian fills the rows \(\mathrm{offset}(i), \dots, \mathrm{offset}(i) + n_i - 1\) and the columns \(\mathrm{offset}(j), \dots, \mathrm{offset}(j) + n_j - 1\); orbital \(a\) of site \(i\) is the index \(\mathrm{offset}(i) + a\) of a vector. Within a site, the orbitals follow the rows of its sublattice's matrices: \((E_1\uparrow, H_1\uparrow, E_1\downarrow, H_1\downarrow)\) for BHZ, the spin fastest for the presets of the caroli command with spin = true.
On a square lattice of 4 orbitals, for instance, Region::cuboid(&lattice, [3, 2, 0]) holds 6 sites and 24 orbitals; its site 1 is the cell \((0, 1)\), and its site 2 starts at orbital 8.
This layout is that of every dense and sparse Hamiltonian, every Green's function and every result of the transport, Keldysh and spectral methods. Only the tori of Periodic Supercells store their wave functions differently, component by component.
The cuboid order and contiguous slices
Region::cuboid lists the sites with the first axis varying slowest and the sublattice fastest. With \(S\) sublattices, the site of the cell \((n_1, n_2, n_3)\) and sublattice \(\alpha\) has the index
$$ i = \big( (n_1 N_2 + n_2)\, N_3 + n_3 \big)\, S + \alpha , $$
with \(N_3 = 1\) in two dimensions and \(N_2 = N_3 = 1\) in one. The sites of a column \(n_1\) are therefore consecutive, and so are their orbitals. For a ribbon along \(\mathbf a_1\) whose hoppings reach at most the next column, the Hamiltonian of the region is block tridiagonal in its own order,
$$ H = \begin{pmatrix} H_{00} & V_0 & & \\ V_0^{\dagger} & H_{11} & V_1 & \\ & V_1^{\dagger} & H_{22} & \ddots \\ & & \ddots & \ddots \end{pmatrix}, $$
with \(H_{nn}\) the Hamiltonian of column \(n\) and \(V_n = \langle n \rvert H \lvert n + 1 \rangle\) its coupling to the next one. The slices of the transport solvers along the first axis, and the order of their results, are then those of the region itself. A cuboid cut along another axis gives correct slices too (next section), but they are not contiguous in the order of the region.
Slices along an axis
Region::slices(axis) cuts a region into slices along a primitive vector: slice \(n\) holds the sites whose cell coordinate along axis is the \(n\)-th smallest value present, in their relative order in the region. Each slice is a region of its own, its offsets starting from 0. A slice is one cell thick: for a region without gaps along the axis, the slices are the planes \(n_{\text{axis}} = \text{const}\).
Model::slice_blocks(region, axis) returns the slices and the blocks the recursive Green's function works on,
$$ H_{nn} = \langle n \rvert H \lvert n \rangle , \qquad V_n = \langle n \rvert H \lvert n + 1 \rangle . $$
It requires every hopping of the model to reach at most the next cell along the axis, \(\lvert \text{offset}_{\text{axis}} \rvert \le 1\), and panics otherwise: a slice couples only to its two neighbours. A model whose hoppings reach further along the transport axis is written on a lattice whose primitive vector along that axis is as long as the longest hopping, with as many sublattices as the larger cell holds sites.
The two-terminal solvers attach their leads to the first and last slices, and the leads share the cross-section of the device at the interfaces (Conventions). The multi-terminal solvers take, for each lead, a slice of the device and the lattice step that points away from it, and make the cells of the lead as translates of that slice (Lead Modes and Self-Energies).
Periodic supercells
A region can also stand for one cell of a larger crystal: the supercell repeated along \(m\) linearly independent periods \(\mathbf T_1, \dots, \mathbf T_m\), integer combinations of the primitive vectors (\(m \le d\)), with twisted boundary conditions. A hopping from site \(i\) of the region to a site \(p\) outside it reaches the image of a site \(j\) of the region, \(p = j + \sum_l n_l \mathbf T_l\), and picks up the Bloch phase of the periods it crosses:
$$ H_{ij}(\boldsymbol\theta) = \sum_{\mathbf n} \Big\langle i \Big\rvert H \Big\lvert j + \sum_l n_l \mathbf T_l \Big\rangle\, e^{i \sum_l n_l \theta_l}, \qquad \theta_l = \mathbf k \cdot \mathbf T_l . $$
Model::bloch_hamiltonian(region, periods, phases) and its sparse version build this matrix: \(\boldsymbol\theta = 0\) is the torus (periodic boundaries), \(\boldsymbol\theta \ne 0\) twisted boundaries. The directions no period spans stay open: a partner beyond the region in such a direction is dropped. For a region of one cell and periods equal to the primitive vectors, \(H(\boldsymbol\theta)\) is the Bloch Hamiltonian of the conventions, with \(\theta_i = \mathbf k \cdot \mathbf a_i\).
Finding the images
The partner of a hopping is reduced modulo the lattice of periods exactly, whatever the periods and the range of the hopping. The \(m \times 3\) integer matrix \(P\) whose rows are the periods is brought to row echelon (Hermite) form
$$ E = W P $$
by unimodular integer row operations (Euclid's algorithm down each column, each pivot made positive): \(W\) is an integer matrix of determinant \(\pm 1\), and the pivots of \(E\) sit in the columns \(c_1 \lt c_2 \lt \dots \lt c_m\). A cell \(x\) is reduced along the pivots in turn,
$$ x \leftarrow x - q_i E_i , \qquad q_i = \big\lfloor x_{c_i} / E_{i c_i} \big\rfloor , $$
which leaves \(0 \le x_{c_i} \lt E_{i c_i}\) on every pivot column. This representative is the same for every cell of a class modulo the periods. Each site of the region is filed under its class (representative cell, sublattice) with its coefficients \(q\); a partner of the same class with the coefficients \(q'\) lies
$$ n_l = \sum_i (q'_i - q_i)\, W_{il} $$
periods away from the site of the region filed there. Locating a partner costs a few integer operations, \(O(m^2)\) with \(m \le 3\), and one hash lookup.
This handles sheared periods (a slanted supercell, a graphene cell periodic along the armchair direction), any choice of fundamental domain (a region whose sites are spread over several cells of the period lattice), and hoppings longer than the supercell: a second-neighbour hopping of a one-cell chain lands two periods away and gets the phase \(e^{2i\theta}\). The builders panic when the periods are not linearly independent, or when two sites of the region are a whole number of periods apart. A class missing from the region acts as a vacancy: the hoppings into it are dropped without a message, so a region meant to be periodic must hold one site of every class.
The same reduction serves the velocity operator (Model::sparse_velocity) and the list of bonds (Model::bonds). Their displacements are those of the hoppings themselves, \(\mathbf r_p - \mathbf r_i\) with \(p\) the image across the boundary: a velocity or a uniform vector potential on a torus sees each bond with its true length (Tight-Binding Models).
The caroli command makes a torus of the whole sample with periodic = true: the periods are its sizes along the lattice directions, \(\mathbf T_i = N_i \mathbf a_i\), and \(\boldsymbol\theta = 0\). The spectrum of a clean torus is then the bulk spectrum at the \(N_1 N_2 \cdots\) points \(\mathbf k \cdot \mathbf a_i = 2\pi m_i / N_i\) (Spectra and Bands).
Accuracy and tests
The geometry is integer arithmetic and has no rounding. The tests check the conventions and the reduction:
| Test | What it checks |
|---|---|
cuboid_orders_by_first_axis (caroli-lattice) | The order, the offsets and the slices of a 3 × 2 cuboid of 4-orbital sites |
honeycomb_positions (caroli-lattice) | The position of a B site to \(10^{-15}\); a shaped region keeps fewer sites than its cuboid |
long_hoppings_reach_far_images (caroli-model) | A one-cell chain with first and second neighbours: \(H(\theta) = 2t_1 \cos\theta + 2t_2 \cos 2\theta\) to \(10^{-14}\), dense and sparse |
sheared_periods (caroli-model) | One cell with the periods \((1, 0)\) and \((1, 1)\) and hoppings along \((1, 0)\), \((0, 1)\), \((1, 1)\), \((1, -1)\): \(H(\theta_1, \theta_2)\) against its expansion on the periods, to \(10^{-14}\) |
any_fundamental_domain (caroli-model) | A slanted square supercell \(\{(j, j)\}\) against the straight one \(\{(0, j)\}\), and a graphene cell of 120 sites periodic along \(-\mathbf a_1 + 2\mathbf a_2 = (0, 3a)\) against the same with half of its sites moved by one period: the same spectra to \(10^{-12}\), Hermitian to \(10^{-15}\) |
sparse_matches_dense (caroli-model) | Open and twisted-periodic sparse BHZ Hamiltonians (5 × 4 cells, \(\lambda = 0.1\), phases \((0.3, -1.1)\)) equal to the dense ones to \(10^{-15}\) |
Every transport and spectral test of the other crates also runs on these regions: the golden cases of the thesis reproduce its flake spectra and ribbon bands to \(10^{-10}\) with the cuboid order (Spectra and Bands).
In the code
Crate caroli-lattice (re-exported as caroli::lattice), and the periodic builders of caroli-model:
| Item | Role |
|---|---|
Lattice | Primitive vectors and sublattices: new, with_sublattice, square, cubic, honeycomb, dim, vectors, sublattices, position |
Sublattice | Name, offset in the cell, number of orbitals |
Site | A cell and a sublattice index |
Vec3, Cell | A Cartesian vector, the integer coordinates of a cell |
Region | cuboid, shaped, from_sites, offset, site_orbitals, orbitals, index_of, slices, translated |
Model::slice_blocks | The slices of a region and their blocks \(H_{nn}\), \(V_n\) |
Model::bloch_hamiltonian, Model::sparse_bloch_hamiltonian | The Hamiltonian of a supercell with twisted boundaries, dense or sparse |
References
- C. W. Groth, M. Wimmer, A. R. Akhmerov and X. Waintal, Kwant: a software package for quantum transport, New J. Phys. 16, 063065 (2014): the lattices, sites and builders on which caroli's lattices, regions and site-dependent terms are modelled.
- H. Cohen, A Course in Computational Algebraic Number Theory, Springer (1993): the Hermite normal form of an integer matrix.