DEM Audiocaroli Documentation
APIGitHub

The caroli Command


On this page

caroli reads a system and its calculations from a TOML file and writes one CSV table per calculation. It builds the same objects as the library and calls the same solvers: the pages of this documentation describe what each calculation computes. The reference of the format is the README of the command; commented examples are in crates/caroli-cli/inputs.


Running it

cargo install caroli-cli                      # or from the repository: cargo install --path crates/caroli-cli
caroli check input.toml                       # builds the model and the sample, describes them
caroli run input.toml                         # runs every [[run]], tables in ./input/
caroli run input.toml --out results --set J=0.3 --only 0,2

--set NAME=VALUE overrides a parameter, --only picks calculations (0 is the first).

The file

title = "BHZ ribbon with magnetic impurities"

[parameters]          # named numbers, usable in every expression below
J = 0.4
M = -0.137

[model]               # the clean model
preset = "bhz"
mass = "M"

[[disorder]]          # any number of disorder terms
type = "magnetic"
concentration = 0.2
exchange = "J"
moments = "polarized"
spin = "opposite-g"
cells = { x = [10, 50] }

[system]              # the sample
size = [60, 32]
leads = ["-x", "+x"]

[[run]]               # any number of calculations
type = "transmission"
energies = { from = -0.2, to = 0.2, count = 41 }
scan = { J = { from = 0, to = 1, count = 11 } }
configurations = 10

Unknown keys are errors, so that a misspelt option does not go unnoticed.

Numbers and expressions

Wherever a number is expected, a string is an expression of the parameters: "J/2", "2*pi/3", "1/sqrt(3)". Matrices are expressions too, with the Pauli matrices s0 sx sy sz, kron(a, b) (the index of b fastest), the imaginary unit i, + − * /, integer powers ^, pi and sqrt exp ln sin cos tan abs. A number stands for that multiple of the identity. Expressions go through the parser of the continuum models (Tight-binding models).

Lists of values (energies, scans, k): one number, a list, { from, to, count } (both ends included) or { from, to, step }.

[parameters]

Named numbers, or expressions of the other parameters (in any order, without cycles). A scanned parameter must be declared here; the parameters that depend on it follow its values.

[model]

Exactly one of:

KeyModel
preset = "bhz"The BHZ model of HgTe quantum wells on a square lattice, basis \((E_1\uparrow, H_1\uparrow, E_1\downarrow, H_1\downarrow)\); options a b c d mass lambda (defaults: the HgTe values of the thesis, \(A = 1\), \(B = -0.376406\), \(C = 0\), \(D = -0.280933\), \(M = -0.137\), \(\lambda = 0\))
preset = "bhz-up", "bhz-down"One spin block, two orbitals \((E_1, H_1)\)
preset = "graphene"Honeycomb lattice, nearest-neighbour distance spacing (default 1), hopping \(-t\) (default \(t = 1\)); spin = true for two orbitals per site
preset = "chain", "square", "cubic"Hopping \(-t\) between nearest neighbours, lattice constant spacing; spin = true for two orbitals per site
preset = "qwz"The Qi–Wu–Zhang Chern insulator, mass m (default 1)
continuum = "..."A k·p Hamiltonian in k_x k_y k_z, discretised on a chain, square or cubic lattice of constant spacing (as Kwant's continuum.discretize)
[model.lattice]A lattice of one's own: vectors, and sublattices with their name, position and orbitals, with its terms below

Terms, for any model:

  • [[model.onsite]] with sublattice and matrix: the on-site matrix of a sublattice (set for a lattice of one's own, added to a preset).
  • [[model.hopping]] with from, to (sublattices), offset (cells, one integer per lattice direction) and matrix: \(\langle (\mathbf R, \text{from}) \rvert H \lvert (\mathbf R + \text{offset}, \text{to}) \rangle\); the reverse hop is added.
  • field: a uniform magnetic field, as a phase per unit area (the flux quantum is \(2\pi\), Magnetic fields).

[[disorder]]

  • type = "anderson", strength = W: on-site energies uniform in \([-W/2, W/2)\) on every orbital of a site.
  • type = "magnetic": classical moments on a fraction concentration of the sites, coupled by exchange \(\cdot\, \mathbf n \cdot \mathbf S\).
    • moments: isotropic (default), polarized (mean mz along \(z\), \(n_z\) uniform in \([2 m_z - 1, 1]\)) or cone (half-angle theta0 in degrees around \(z\)).
    • spin: the matrices \(\mathbf S\), same-g or opposite-g (BHZ: \(g_E = \pm g_H\)), pauli (the default for two orbitals), or three matrix expressions.
  • cells = { x = [first, end], y = [...] }: where it lies (half-open cell ranges, the whole sample by default); sublattices = [...]: which sublattices carry it.
  • seed: configuration \(c\) of a calculation draws with seed + c.

The Born approximation (scba) takes the disorder as its averages over every site (the cells windows do not apply). Disorder describes the distributions.

[system]

  • size: cells along each lattice direction.
  • periodic = true: a torus (spectra, densities of states, conductivities).
  • leads: faces of the sample with a semi-infinite clean lead, among -x +x -y +y -z +z (default ["-x", "+x"]). The leads continue the clean model; -x and +x alone use the two-terminal solver, any other set the multi-terminal one. Leads are numbered in this order.

[[run]]

Every calculation takes output (the file name, default NN-type.csv), and most take scan (parameters to scan, every combination) and configurations (disorder draws, one row each). The tables start with the scanned parameters and the configuration. Scan points and configurations run in parallel, and the lead self-energies are computed once per energy and scan point and reused for every configuration (the leads are the clean model).

typeWhatOptionsColumns
transmissionTransmissions between the leads (Green's functions and the Caroli formula)energies, sectors (labels of the orbitals of a lead site, e.g. [0, 0, 1, 1] for the BHZ spins)energy, T (two leads) or T_p_q from lead q into lead p, or T_p.a_q.b between sectors
localScattering states, averaged over energies (Keldysh)occupations (per lead, default [1, 0, ...]), operators (name → on-site matrix)Per site: x y z, current jx jy jz, occupied density, local density of states ldos, and per operator its density and current
bandsBands of the ribbon, or bulk bands along a path (Spectra and bands)k (Bloch phases, default 201 in \([-\pi, \pi]\)); or path (corners in Bloch phases) and points per segmentk or s (length along the path), band, energy
spectrumEigenvalues of the sample (dense, up to 8000 orbitals)index, energy
dosDensity of states by the kernel polynomial method (KPM)energies, moments (512), vectors (10), seed, bounds, projections (name → on-site matrix)energy, dos (per sample), projected densities
conductivityKubo–Bastin conductivities of a periodic sample, in \(e^2/h\)energies (chemical potentials), components (["xx", "xy"]), temperature, moments (256), vectors, seed, boundsenergy, sigma_xx, ...
scbaSelf-consistent Born approximation of the disorder (Born)energies, k_grid (64 per direction), eta (\(10^{-3}\))energy, dos (per cell), sigma_re_k sigma_im_k (diagonal of the self-energy), residual
evolutionTime evolution on an \(n \times n\) torus under a uniform force (Time evolution)force (\(\mathbf k \to \mathbf k + \mathbf F t\)), dt, steps, every, fermi, initialt, norm, current density jx jy, excited (carriers above fermi in the instantaneous clean bands, per unit area), width

The initial state of evolution:

  • { type = "fermi-sea", fermi, vectors, seed, moments }: random-phase superpositions of the occupied states; with disorder, the ground state of the disordered Hamiltonian by a Chebyshev projection.
  • { type = "band", fermi, vectors, seed, orbitals }: the clean bands below fermi, also with disorder (which sets them in motion), only those on orbitals of the cell if given (one spin, e.g. [0, 2] for spinful graphene); excited then counts the carriers in the same bands.
  • { type = "localized", cell = [x, y], orbital, window = [lo, hi] }: one orbital, projected on the clean band states in the window.

Checks

Each run type is tested against the library call or the physics it shows (crates/caroli-cli/tests/cli.rs): transmissions and sectors, scans with dependent parameters, ribbon and bulk bands, the dense spectrum, the sum rule of the density of states and its spin projections, the Born approximation, the Stark breathing of a wave packet and the helical spin currents of BHZ. The example inputs must build, and the error messages name the faulty key or name.