DEM Audiocaroli Documentation
APIGitHub

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

StepWhat it holdsPage
LatticeBravais vectors, sublattices and their numbers of orbitalsLattices and regions
ModelOn-site and hopping matrices, site-dependent terms, a magnetic fieldTight-binding models, Magnetic fields
RegionThe sites of the sample, the order of their orbitals, its slices along an axis, periodic directionsLattices and regions
DisorderAnderson disorder, classical magnetic impurities, any site- or bond-dependent term, reproducible drawsDisorder
LeadsSemi-infinite clean wires attached to faces of the regionLead modes and self-energies
MethodTransport, Keldysh, Born, spectral, dynamical, quantum walksthe 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

QuestionMethodCost and limits
Transmission between two leadsNested dissection (default), recursive Green's functionO(n³) for an n × n sample by nested dissection, O(n⁴) by the recursion; exact at a real energy
Transmissions between many leadsNested dissection with leads anywhereThe sites the leads couple to stay at the root
Scattering matrix, transmission eigenvalues, shot noiseScattering matrix and statesPropagating modes of the leads, unit current
Local currents and densities out of equilibriumKeldysh, scattering statesBack-substitution from the lead slices
Disorder-averaged Green's functionSelf-consistent Born approximationWeak disorder; translation-invariant averages
Spectrum, bandsSpectra and bandsDense diagonalisation, up to a few thousand orbitals
Density of states, conductivity of a large sampleKernel polynomial methodSparse products only; resolution set by the number of moments
Evolution under a fieldTime evolutionSplit-operator on tori (k space), or Magnus–Chebyshev on any region
Walker coupled to spinsQuantum walksMemory 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.

CrateRole
caroli-latticeBravais lattices with a basis (1D, 2D, 3D), finite regions, slices
caroli-modelTight-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-denseDense complex kernels: Schur decomposition and reordering, LU, QR, SVD, products (Apple Accelerate on macOS, faer elsewhere)
caroli-greenSteady state: lead modes and self-energies, recursive Green's function, nested dissection (two and many terminals), Caroli transmission, scattering matrix and states
caroli-disorderReproducible random streams, Anderson disorder, classical magnetic impurities
caroli-keldyshNon-equilibrium steady state: lesser Green's function, bond and interface currents, occupations
caroli-bornSelf-consistent Born approximation
caroli-torusHamiltonians on periodic 2D supercells, the k-space part through FFTs
caroli-kpmKernel polynomial method: densities of states, Kubo–Bastin conductivities
caroli-dynamicsTime evolution: split-operator, Chebyshev propagation, fourth-order Magnus integrator
caroli-gpuChebyshev kernels and quantum-walk sweeps on the GPU (Metal, CUDA)
caroli-walkDiscrete-time quantum walks with spins on the edges of a graph
caroliThe facade: re-exports, caroli::prelude, the examples of the two thesis studies
caroli-cliThe 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, &region, 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).