Overview
On this page
A calculation in caroli always goes through the same steps: a lattice, a model on it (the clean Hamiltonian, with a field if there is one), a finite region of the lattice (the sample), its disorder, and finally a method that turns the Hamiltonian into the quantity asked for. This page shows how these pieces fit together and where each one is described.
From a lattice to a number
| Step | What it holds | Page |
|---|---|---|
| Lattice | Bravais vectors, sublattices and their numbers of orbitals | Lattices and regions |
| Model | On-site and hopping matrices, site-dependent terms, a magnetic field | Tight-binding models, Magnetic fields |
| Region | The sites of the sample, the order of their orbitals, its slices along an axis, periodic directions | Lattices and regions |
| Disorder | Anderson disorder, classical magnetic impurities, any site- or bond-dependent term, reproducible draws | Disorder |
| Leads | Semi-infinite clean wires attached to faces of the region | Lead modes and self-energies |
| Method | Transport, Keldysh, Born, spectral, dynamical, quantum walks | the parts of the sidebar |
The model never holds a sample: the same model builds the leads (clean) and the device (with its disorder), and a disorder average draws many devices from one model and one region.
Which method for which question
| Question | Method | Cost and limits |
|---|---|---|
| Transmission between two leads | Nested dissection (default), recursive Green's function | O(n³) for an n × n sample by nested dissection, O(n⁴) by the recursion; exact at a real energy |
| Transmissions between many leads | Nested dissection with leads anywhere | The sites the leads couple to stay at the root |
| Scattering matrix, transmission eigenvalues, shot noise | Scattering matrix and states | Propagating modes of the leads, unit current |
| Local currents and densities out of equilibrium | Keldysh, scattering states | Back-substitution from the lead slices |
| Disorder-averaged Green's function | Self-consistent Born approximation | Weak disorder; translation-invariant averages |
| Spectrum, bands | Spectra and bands | Dense diagonalisation, up to a few thousand orbitals |
| Density of states, conductivity of a large sample | Kernel polynomial method | Sparse products only; resolution set by the number of moments |
| Evolution under a field | Time evolution | Split-operator on tori (k space), or Magnus–Chebyshev on any region |
| Walker coupled to spins | Quantum walks | Memory grows as \(2\lvert E \rvert \, 2^{\lvert E \rvert}\) for \(\lvert E \rvert\) edges |
The crates
caroli is a Rust workspace. The dependencies go one way, from the lattice up to the facade.
| Crate | Role |
|---|---|
caroli-lattice | Bravais lattices with a basis (1D, 2D, 3D), finite regions, slices |
caroli-model | Tight-binding models: on-site and hopping matrices, site-dependent terms, dense, sparse (CSR) and Bloch Hamiltonians, transport blocks; BHZ Dirac matrices and presets; continuum k·p models |
caroli-dense | Dense complex kernels: Schur decomposition and reordering, LU, QR, SVD, products (Apple Accelerate on macOS, faer elsewhere) |
caroli-green | Steady state: lead modes and self-energies, recursive Green's function, nested dissection (two and many terminals), Caroli transmission, scattering matrix and states |
caroli-disorder | Reproducible random streams, Anderson disorder, classical magnetic impurities |
caroli-keldysh | Non-equilibrium steady state: lesser Green's function, bond and interface currents, occupations |
caroli-born | Self-consistent Born approximation |
caroli-torus | Hamiltonians on periodic 2D supercells, the k-space part through FFTs |
caroli-kpm | Kernel polynomial method: densities of states, Kubo–Bastin conductivities |
caroli-dynamics | Time evolution: split-operator, Chebyshev propagation, fourth-order Magnus integrator |
caroli-gpu | Chebyshev kernels and quantum-walk sweeps on the GPU (Metal, CUDA) |
caroli-walk | Discrete-time quantum walks with spins on the edges of a graph |
caroli | The facade: re-exports, caroli::prelude, the examples of the two thesis studies |
caroli-cli | The caroli command |
Each crate has its page in the API reference.
Two ways to use it
As a library, with caroli = "0.1" under [dependencies] in Cargo.toml (Rust 1.88 or later). A clean BHZ ribbon of 16 × 10 sites carries two helical edge channels in its gap:
use caroli::prelude::*;
let model = bhz(BhzParams::default());
let region = Region::cuboid(model.lattice(), [16, 10, 0]);
let device = TwoTerminal::from_model(&model, &model, ®ion, 0);
assert!((device.transmission(0.0)? - 2.0).abs() < 1e-8);
Through the caroli command, installed by cargo install caroli-cli. The same model on a larger ribbon and a sweep of the Fermi energy, in a TOML file; one CSV table per calculation (The caroli command):
[model]
preset = "bhz"
[system]
size = [200, 64]
[[run]]
type = "transmission"
energies = { from = -0.16, to = 0.16, count = 33 }
Platforms and parallelism
- macOS (13.3 or later): the dense kernels call Apple's Accelerate (LAPACK and BLAS on the matrix units of Apple silicon), and the Chebyshev kernels and the quantum walks can run on the GPU through Metal.
- Linux and other systems: the dense kernels use faer and in-house algorithms; the CUDA backend (feature
cuda) runs the Chebyshev kernels in double precision on NVIDIA GPUs. - All the cores: energies, disorder configurations, k points, random vectors and the independent branches of a dissection tree run in parallel (rayon). The compiler rejects data races, and there is no unsafe code outside the calls into Accelerate, Metal and CUDA.
- Reduced precision, when chosen: some kernels run in single or double-single precision while the CPU checks a sample of the work in double precision and takes over when the error exceeds the tolerance (Reduced precision and the GPU).