Skip to content

Command-line reference

ace-jax and its short alias aj are the same program. The documentation build makes this page from the --help output of the program. Thus the page agrees with the installed version.

The commands, in the order of a typical workflow:

  • aj fit fits a model to labelled extxyz data. It builds the basis from --order/--max-degree, or uses a saved basis from --model. It writes the fitted model, the metrics and a fit.yaml run file to --out.
  • aj eval evaluates a fitted model (ACE .npz, gp_model.npz or PACE .yace) on an extxyz file.
  • aj calibrate recalibrates the per-atom force uncertainty of a --uq ard fit on labelled target-regime data.
  • aj basis builds a basis and saves it on its own.
  • aj ham fits and uses Hamiltonian models: aj ham fit, aj ham calibrate, aj ham predict and aj ham bands.

Each command exits with status 0 if it is successful. The default label keys are energy, forces and virial. For other names, use --energy-key, --force-key and --virial-key.

usage: ace-jax [-h] [--version]
               {fit,eval,calibrate,export,native,ham,density,basis} ...

Fit and evaluate ACE models in JAX (short alias: aj)

positional arguments:
  {fit,eval,calibrate,export,native,ham,density,basis}
    fit                 fit a linear ACE model (default), or with --m-per-species > 0
                        the experimental hybrid ACE + residual GP
    eval                evaluate a model on a dataset: RMSE table vs the labels,
                        predictions to extxyz
    calibrate           recalibrate the per-group conformal scales of an ARD posterior
                        on a labelled set (per-group replace by default)
    export              write a model for LAMMPS: an ML-PACE .yace (pair_style pace),
                        a lammps-jax bundle (.json, pair_style jax) or a Symmetrix
                        model (--format symmetrix, pair_style symmetrix/ace)
    native              the native acceleration here: the C++ kernel's compiler, flags
                        and cache, on a CUDA GPU the CUDA kernel's, and matscipy-
                        neighbours; --build compiles the kernels now
    ham                 Hamiltonian (operator) models: fit to DFT blocks, predict H
                        and S, bands and density of states
    density             electron-density models: fit to the density's expansion
                        coefficients, predict them
    basis               author a new ACE basis: a frozen model (seeded radial init)
                        saved as .npz

options:
  -h, --help            show this help message and exit
  --version             show program's version number and exit

aj fit

The options fall into groups:

  • data: --train/--test files, or one --data file divided by a seeded permutation (--ntrain, --ntest, --test-start). --ood adds a second test set. --weights sets weights for each configuration type.
  • basis: the options under "basis" below build the basis in the fit. Alternatively, --model uses a saved basis; then --r0 is necessary.
  • model: --m-per-species 0 (the default) is linear ACE. A positive value adds a Gaussian-process arm, with that number of inducing sites for each species. The GP arm is experimental. The GP options (--kernel, --no-bump, --density, --pca-d, --embedding) need --m-per-species > 0.
  • hyperparameters: --opt, --map-steps, --map-restarts, --map-polish, --strict, --init, --noise. --noise shared learns one noise scale for all weighted rows, so --weights sets the balance of E, F and V (as in ACEpotentials). The default --noise auto uses shared when you give --weights, and per-quantity when you do not. --rungs other than map adds approximations of the hyperparameter posterior, at a much higher cost.
  • uncertainty: --uq blr (default), pops or ard for the linear model. The --ard-* and --force-shape options configure ard (Per-atom force uncertainty).
  • run file: --config fit.yaml. Command-line flags override the file (Run files).
usage: ace-jax fit [-h] [--config CONFIG] [--model MODEL]
                   [--train TRAIN | --data DATA] [--test TEST] [--ood OOD]
                   [--ntrain NTRAIN] [--ntest NTEST] [--test-start TEST_START]
                   [--energy-key ENERGY_KEY] [--force-key FORCE_KEY]
                   [--virial-key VIRIAL_KEY] [--stress-key STRESS_KEY]
                   [--weights WEIGHTS] [--e0 {model,lsq,prefit}] [--baseline BASELINE]
                   [--configs-per-batch CONFIGS_PER_BATCH]
                   [--batch-pack {auto,on,off}] [--m-per-species M_PER_SPECIES]
                   [--kernel {cosine,matern32}] [--no-bump]
                   [--density {none,pair,pca}] [--pca-d PCA_D] [--embedding EMBEDDING]
                   [--objective {lml,loo}] [--lml {device,host-cache}]
                   [--lml-solver {qr,svd,cholesky}]
                   [--row-precision {float64,float32}] [--row-check]
                   [--opt {adam,lbfgs}] [--map-polish {auto,on,off}] [--strict]
                   [--noise {auto,per-quantity,shared}] [--solver {evidence,lstsq}]
                   [--map-restarts MAP_RESTARTS] [--init INIT] [--checkpoint DIR]
                   [--mpi] [--stats-only] [--checkpoint-every MIN] [--rungs RUNGS]
                   [--n-draws N_DRAWS] [--laplace {svi,fd}] [--map-steps MAP_STEPS]
                   [--vi-steps VI_STEPS] [--nuts-warmup NUTS_WARMUP]
                   [--nuts-samples NUTS_SAMPLES] [--nuts-chains NUTS_CHAINS] [--r0 R0]
                   [--uq {blr,pops,ard,ard-gp}] [--ard-mode {joint,sequential}]
                   [--ard-variance {sandwich,kappa}] [--ard-solver {auto,qr,cholesky}]
                   [--ard-cond-max ARD_COND_MAX] [--ard-prior {fit,fixed}]
                   [--ard-allow-degenerate] [--ard-val-frac ARD_VAL_FRAC]
                   [--force-shape {iso,aniso}] [--ard-coverage ARD_COVERAGE]
                   [--ard-groups {distortion,none}]
                   [--ard-cluster-size ARD_CLUSTER_SIZE] [--ard-press {exact,block}]
                   [--ard-transfer {exponent,sqrt,none}] [--ard-n-min ARD_N_MIN]
                   [--no-ard-support] [--ard-support-features {raw,normalised}]
                   [--learn-radial] [--radial-n-q RADIAL_N_Q]
                   [--radial-steps RADIAL_STEPS]
                   [--radial-reprofile-every RADIAL_REPROFILE_EVERY]
                   [--radial-opt {lbfgs,newton}] [--radial-cg-iters RADIAL_CG_ITERS]
                   [--radial-lam-grid RADIAL_LAM_GRID]
                   [--radial-val-frac RADIAL_VAL_FRAC] [--pops-ridge POPS_RIDGE]
                   [--seed SEED] [--out OUT] [--model-draws MODEL_DRAWS]
                   [--no-save-model] [--devices DEVICES] [--elements ELEMENTS]
                   [--order ORDER] [--max-degree MAX_DEGREE] [--wL WL] [--rcut RCUT]
                   [--rin RIN] [--radial-mode {onehot,glorot_normal,zero}]
                   [--pair-mode PAIR_MODE] [--radial-basis {poly,sbessel}]
                   [--no-gamma] [--no-coupling-cache]
                   [--coupling-cache-dir COUPLING_CACHE_DIR]
                   [--basis-embedding BASIS_EMBEDDING] [--nmax-by-order NMAX_BY_ORDER]
                   [--lmax-by-order LMAX_BY_ORDER] [--d-max D_MAX] [--maxl MAXL]
                   [--reduction {pca,truncate}]

options:
  -h, --help            show this help message and exit
  --config CONFIG       a fit.yaml run file (flag names as keys, the basis in a
                        `basis:` block); command-line flags override it
  --model MODEL         an ACE basis/model .npz (or give --order/--max-degree to build
                        the basis)
  --train TRAIN         training extxyz (with --test, or tested on itself)
  --data DATA           one extxyz split by a seeded permutation
                        (--ntrain/--ntest/--test-start)
  --test TEST
  --ood OOD             extra out-of-distribution test extxyz
  --ntrain NTRAIN
  --ntest NTEST
  --test-start TEST_START
  --energy-key ENERGY_KEY
  --force-key FORCE_KEY
  --virial-key VIRIAL_KEY
  --stress-key STRESS_KEY
                        stress label (eV/A^3, 3x3 or Voigt-6) used as the virial,
                        virial = -stress * volume, when a config has no virial label
  --weights WEIGHTS     JSON: an ACEfit weights dict {"default":
                        {"E":..,"F":..,"V":..}, <config_type>: ..} or a list of weight
                        factors [{"Structural": {}}, {"ConfigType": {...}}]; or the
                        path of a .json file holding either
  --e0 {model,lsq,prefit}
                        per-species E0: the model's (default); lsq fits it jointly
                        with the readout (a wide prior around a least-squares start);
                        prefit fixes it at least squares on the training energies
                        before the fit
  --baseline BASELINE   dimer_mean.npz: fit the residual to this pair mean
  --configs-per-batch CONFIGS_PER_BATCH
  --batch-pack {auto,on,off}
                        size-aware batching: pack configs into batches by an atom
                        budget (the largest config) instead of fixed groups of
                        --configs-per-batch; auto = only when the fixed layout would
                        pad badly (mixed bulk + big cells)
  --m-per-species M_PER_SPECIES
                        inducing points per species of the residual GP. 0 (default) =
                        linear ACE; > 0 adds the GP arm (experimental, advanced: much
                        slower and more memory; try 6-100)
  --kernel {cosine,matern32}
  --no-bump
  --density {none,pair,pca}
                        GP feature map: full descriptor, pair densities, or a PCA view
                        (--pca-d)
  --pca-d PCA_D
  --embedding EMBEDDING
                        MACE element table (JSON): frozen species coregionalization
  --objective {lml,loo}
  --lml {device,host-cache}
                        host-cache: cache the linear design rows in host RAM (GP,
                        pair|pca, L-BFGS, map only)
  --lml-solver {qr,svd,cholesky}
                        linear arm: the evidence and posterior by QR (stable;
                        default), by one SVD (svd: the MAP's evaluations O(L) after
                        one SVD, as stable as QR; shared noise only, else QR), or by a
                        Cholesky of the Gram (faster at large basis, but loses
                        accuracy when the fit nearly interpolates its data). The GP
                        arm always uses the Cholesky
  --row-precision {float64,float32}
                        float32: compute the design rows (and, on a GPU, their QR) in
                        float32, the bulk of a fit's work; the evidence and
                        coefficients stay float64. Linear arm with the QR solver only:
                        the GP arm and --learn-radial are not supported yet
  --row-check           with --row-precision float32: after the MAP, refit on
                        statistics perturbed at float32 rounding and record how much
                        the training RMSE changes (warns above 10%; it costs a second
                        MAP)
  --opt {adam,lbfgs}    hyperparameter MAP optimiser: lbfgs (default) = bounded
                        L-BFGS-B, then (linear arm, see --map-polish) a Newton polish
                        to a stationary point; adam = numpyro SVI for --map-steps
                        steps, which can stop far from the optimum on large data
  --map-polish {auto,on,off}
                        Newton polish of the L-BFGS MAP to a stationary point, with
                        the exact Hessian built one Hessian-vector product per free
                        hyperparameter (~2.3x the gradient's memory). auto (default):
                        on for the linear arm, off for the GP arm, where each HVP is a
                        forward-over-reverse pass through the streamed objective (one
                        gradient can take a minute, a polish hours at large scale)
  --strict              fail, instead of warning, when the MAP ends away from a
                        stationary point (a predicted Newton gain above 1e-3 nats)
  --noise {auto,per-quantity,shared}
                        noise hyperparameters: per-quantity learns sigma_E, sigma_F
                        and sigma_V separately, and at the optimum each cancels its
                        quantity's --weights; shared learns ONE sigma for every
                        weighted row (ACEpotentials' BLR), so the E:F:V weights set
                        the balance. auto (default): shared when --weights is given,
                        per-quantity otherwise (and per-quantity where shared is not
                        available: --sigma-type, joint ARD, --solver lstsq)
  --solver {evidence,lstsq}
                        lstsq: plain weighted least squares with no prior (teaching;
                        overfits a large basis)
  --map-restarts MAP_RESTARTS
                        L-BFGS multi-start (best log-posterior)
  --init INIT           theta_map.json to start the MAP from
  --checkpoint DIR      resumable fit: save the training statistics (CPU) every
                        --checkpoint-every minutes and the MAP's best hyperparameters
                        to DIR; rerunning the same command resumes from them (GBs: 8
                        L^2 bytes per quantity)
  --mpi                 shard the training statistics over MPI ranks (run under
                        srun/mpirun, one rank per node; needs the [mpi] extra): each
                        rank streams every N-th batch, the factors are merged onto
                        rank 0, which runs the rest of the fit
  --stats-only          stop after the training statistics, saved to --checkpoint DIR
                        (with --mpi: merged into one file): the first job of a two-job
                        fit; the same command without --stats-only and --mpi, on one
                        node, then runs only the MAP
  --checkpoint-every MIN
                        minutes between training-statistics checkpoints (default 45)
  --rungs RUNGS         comma-separated from map,laplace,pathfinder,vi,nuts (default
                        map; the others add hyperparameter draws and cost far more
                        than the MAP)
  --n-draws N_DRAWS
  --laplace {svi,fd}
  --map-steps MAP_STEPS
                        MAP iterations: L-BFGS-B iterations (at most 4x as many
                        evaluations), or Adam steps
  --vi-steps VI_STEPS
  --nuts-warmup NUTS_WARMUP
  --nuts-samples NUTS_SAMPLES
  --nuts-chains NUTS_CHAINS
  --r0 R0               typical nearest-neighbour distance (A); centres the GP
                        hyperprior (default when building the basis: its mean bond
                        length)
  --uq {blr,pops,ard,ard-gp}
                        pops/ard: linear arm (--m-per-species 0); ard = ARD posterior
                        with a calibrated per-atom forces_std (see --ard-variance),
                        writes posterior.npz; ard-gp: the same calibrated force UQ on
                        the GP arm (--m-per-species > 0), from the jackknife-sandwich
                        posterior over [B | k(B, B_M)] at the MAP hyperparameters;
                        writes gp_model.npz (the ARD mean) and posterior.npz
  --ard-mode {joint,sequential}
                        joint: noise + ARD scales by evidence; sequential: ARD only,
                        one Gram (low memory with --uq ard; --uq ard-gp still holds ~4
                        Dt^2 joint arrays)
  --ard-variance {sandwich,kappa}
                        ARD force-uncertainty shape: sandwich (default) = delete-one-
                        cluster PRESS jackknife (misspecification-robust); kappa = the
                        posterior A^-1 shape. Both get the per-group scales
  --ard-solver {auto,qr,cholesky}
                        ard: factorisation of the ARD evidence and posterior -- qr
                        (auto with --uq ard) factors the data rows, so the prior floor
                        can sit decades lower than cholesky's (auto with --uq ard-gp)
  --ard-cond-max ARD_COND_MAX
                        ard: the prior floor keeps cond(S) below this (default: 1e22
                        qr, 1e14 cholesky)
  --ard-prior {fit,fixed}
                        ard: fit = the ARD scales by evidence (default); fixed = keep
                        the MAP's own prior (the BLR fit's single sigma_c) in the
                        hold-out fits and the served posterior, so the calibrated per-
                        atom forces and the jackknife shape are those of the BLR
                        posterior
  --ard-allow-degenerate
                        ard: write the posterior even when every ARD scale ends on the
                        prior floor with the evidence pointing below it (by default
                        the fit stops with an error)
  --ard-val-frac ARD_VAL_FRAC
                        stratified train fraction held out to score the per-group
                        force scales (rms factor and conformal quantile) with the
                        hold-out posterior
  --force-shape {iso,aniso}
                        ard: anisotropic (Mahalanobis, default) or isotropic
                        (|e|/sqrt(v/3), spherical radius) conformal force scores
  --ard-coverage ARD_COVERAGE
                        ard: nominal coverage 1 - alpha of the per-group conformal
                        quantile
  --ard-groups {distortion,none}
                        ard: conformal groups = distortion bands x [z = z*] (8), or
                        none (2)
  --ard-cluster-size ARD_CLUSTER_SIZE
                        ard: sandwich block side in units of r_cut ('inf': whole
                        configurations)
  --ard-press {exact,block}
                        ard: PRESS correction of the jackknife scores (exact: per-
                        cluster solve; block: block approximation)
  --ard-transfer {exponent,sqrt,none}
                        ard: carry the hold-out scales to the served posterior by
                        (N/N_fit)^beta -- exponent: beta fitted per run from a second,
                        smaller hold-out fit (clipped to [0, 1/2]); sqrt: beta = 1/2;
                        none: beta = 0
  --ard-n-min ARD_N_MIN
                        ard: groups with fewer configurations borrow a neighbouring
                        group's scales
  --no-ard-support      ard: skip the covariate-shift support reference
  --ard-support-features {raw,normalised}
                        ard: support-reference features -- raw descriptors, or
                        normalised (unit-norm descriptor plus log-norm channels per
                        body order, which flag atoms losing neighbours)
  --learn-radial        learn the tensor radials (VarPro, held-out gate) before the
                        fit; the saved model is marked radial_learned and splined at
                        deploy time
  --radial-n-q RADIAL_N_Q
                        tensor-radial polynomial span after widening (with --learn-
                        radial)
  --radial-steps RADIAL_STEPS
                        optimiser iterations per roughness weight (with --learn-
                        radial)
  --radial-reprofile-every RADIAL_REPROFILE_EVERY
                        re-fit the evidence hyperparameters every this many radial
                        steps; each re-fit restarts the optimiser (with --learn-
                        radial)
  --radial-opt {lbfgs,newton}
                        radial optimiser: L-BFGS-B, or trust-region Newton with exact
                        Hessian-vector products (each costs about two gradients;
                        capped by --radial-cg-iters per iteration)
  --radial-cg-iters RADIAL_CG_ITERS
                        Hessian-vector products per Newton iteration, at most (with
                        --radial-opt newton)
  --radial-lam-grid RADIAL_LAM_GRID
                        comma-separated relative roughness weights the gate picks
                        among, alongside the initial radials (with --learn-radial)
  --radial-val-frac RADIAL_VAL_FRAC
                        fraction of the training configs held out for the gate (with
                        --learn-radial)
  --pops-ridge POPS_RIDGE
  --seed SEED
  --out OUT
  --model-draws MODEL_DRAWS
                        GP arm: hyperparameter draws stored in gp_model.npz (1 = the
                        MAP; more = evenly spaced draws of the last rung, each adding
                        a (Dt, Dt) factor)
  --no-save-model       skip writing the fitted model (model.npz linear / gp_model.npz
                        GP)
  --devices DEVICES     shard sufficient statistics over this many devices
                        (experimental)

basis (built in memory; instead of --model):
  --elements ELEMENTS   comma-separated Z numbers or symbols (default: the species in
                        the data)
  --order ORDER         correlation order
  --max-degree MAX_DEGREE
                        TotalDegree level bound
  --wL WL
  --rcut RCUT           cutoff (default 5.5; with an embedding, 2.5 x mean bond
                        length)
  --rin RIN
  --radial-mode {onehot,glorot_normal,zero}
                        initial tensor radials: onehot (R_n = P_n, the frozen-fit
                        default) or seeded glorot_normal mixtures (a random start,
                        e.g. for learned radials)
  --pair-mode PAIR_MODE
  --radial-basis {poly,sbessel}
                        tensor-radial basis: poly (ACEpotentials, polynomials of a
                        transformed distance) or sbessel (PACE's simplified spherical
                        Bessel functions of r, as pacemaker's radials)
  --no-gamma            skip the smoothness prior
  --no-coupling-cache   always compute the coupling instead of using the per-shape
                        cache
  --coupling-cache-dir COUPLING_CACHE_DIR
                        coupling cache directory (default: $ACEJAX_COUPLING_CACHE or
                        ~/.cache/ace-jax/coupling)
  --basis-embedding BASIS_EMBEDDING
                        frozen element embedding of the basis: a JSON table {Z, emb}
                        or 'identity' (builds ace_embedding_model: ace1-compatible,
                        factorised radial)
  --nmax-by-order NMAX_BY_ORDER
                        comma-separated cap on the radial degree n of each many-body
                        term, per correlation order from 1 (pacemaker's
                        nradmax_by_orders; the last entry repeats)
  --lmax-by-order LMAX_BY_ORDER
                        comma-separated cap on l per correlation order (pacemaker's
                        lmax_by_orders); with --wL 1 the TotalDegree level is
                        pacemaker's power order
  --d-max D_MAX         cap on per-order channel widths (default lossless)
  --maxl MAXL
  --reduction {pca,truncate}

aj eval

With --posterior (a posterior.npz from aj fit --uq ard), --per-atom writes the per-atom force uncertainty, and --support adds the support flag (Per-atom force uncertainty).

usage: ace-jax eval [-h] --model MODEL --data DATA [--energy-key ENERGY_KEY]
                    [--force-key FORCE_KEY] [--virial-key VIRIAL_KEY]
                    [--stress-key STRESS_KEY] [--out OUT] [--prefix PREFIX]
                    [--posterior POSTERIOR] [--per-atom PER_ATOM] [--support]
                    [--shape-path {rows,committee}] [--no-deriv-dtc]
                    [--kpts KPTS KPTS KPTS] [--nelectrons NELECTRONS] [--width WIDTH]
                    [--smearing {fermi-dirac,gaussian}] [--window WINDOW WINDOW]
                    [--overlap-threshold X] [--metrics-out METRICS_OUT]
                    [--blocks-out BLOCKS_OUT] [--threads THREADS]

options:
  -h, --help            show this help message and exit
  --model MODEL
  --data DATA
  --energy-key ENERGY_KEY
  --force-key FORCE_KEY
  --virial-key VIRIAL_KEY
  --stress-key STRESS_KEY
                        stress label (eV/A^3, 3x3 or Voigt-6) used as the virial,
                        virial = -stress * volume, when a config has no virial label
  --out OUT             extxyz to write: the input structures, every label kept, plus
                        the predictions (<prefix>energy, <prefix>forces,
                        <prefix>stress, and *_std for UQ models)
  --prefix PREFIX       name prefix of the predicted keys (default ace_)
  --posterior POSTERIOR
                        posterior.npz from `fit --uq ard` (with its model.npz) or `fit
                        --uq ard-gp` (with its gp_model.npz): adds <prefix>forces_std
  --per-atom PER_ATOM   with --posterior: extxyz of the served per-atom arrays
                        (forces_pred, forces_std, forces_q, forces_group; forces_cov,
                        forces_q_mahal for an aniso posterior)
  --support             with --posterior --per-atom: add support_ok and support_q
                        (covariate-shift support)
  --shape-path {rows,committee}
                        ard: evaluate the uncertainty shape from the whole cell's
                        force design rows (rows) or as the forces of an r-output
                        linear ACE (committee: same values, memory O(N r) not O(N L))
  --no-deriv-dtc        gp_model.npz only: SoR-only forces_std, without the
                        derivative-DTC term (whose whole-cell (n, K, d, 3) arrays may
                        not fit for a big cell)

operator (Hamiltonian) models: --data is a directory of reference blocks, or an extxyz file:
  --kpts KPTS KPTS KPTS
                        Gamma-centred k-point grid (default 3 3 3)
  --nelectrons NELECTRONS
                        electrons the bands hold: a number per cell, or Z:n,Z:n per
                        atom of each element (default: what the model file records
                        from its fit, else the atomic numbers)
  --width WIDTH         smearing width in the model's energy unit (default 0.1)
  --smearing {fermi-dirac,gaussian}
  --window WINDOW WINDOW
                        eigenvalues scored: from LO to HI of the reference Fermi level
                        (default -12 5)
  --overlap-threshold X
                        drop the combinations of orbitals whose overlap eigenvalue at
                        a k-point is below X before diagonalising (default 0: none);
                        1e-3 for a diffuse basis whose predicted bands are far off
                        although the blocks are close
  --metrics-out METRICS_OUT
                        JSON file for the electronic-structure metrics of every
                        reference structure
  --blocks-out BLOCKS_OUT
                        directory for the predicted H and S blocks of each structure
                        (DeepH layout)
  --threads THREADS     threads of the off-site evaluation on a CPU (default 1)

aj calibrate

Calculates the group scales of an ARD posterior again, on labelled configurations that were not in the training set. It writes a new posterior. The model does not change. See Recalibrate on target data.

usage: ace-jax calibrate [-h] --model MODEL --posterior POSTERIOR --data DATA
                         [--energy-key ENERGY_KEY] [--force-key FORCE_KEY]
                         [--virial-key VIRIAL_KEY] [--shape-path {rows,committee}]
                         [--append | --replace] --out OUT

options:
  -h, --help            show this help message and exit
  --model MODEL
  --posterior POSTERIOR
  --data DATA           labelled extxyz U (needs forces under --force-key)
  --energy-key ENERGY_KEY
  --force-key FORCE_KEY
  --virial-key VIRIAL_KEY
  --shape-path {rows,committee}
                        ard: evaluate the uncertainty shape from the whole cell's
                        force design rows (rows) or as the forces of an r-output
                        linear ACE (committee: same values, memory O(N r) not O(N L))
  --append              pool U with the stored T_val scores in every group
  --replace             use U only in every group
  --out OUT

aj export

Writes a model for LAMMPS: an ML-PACE .yace file, or a lammps-jax bundle. See Export a model to LAMMPS.

usage: ace-jax export [-h] [--model MODEL] [--out OUT]
                      [--format {yace,lammps,symmetrix}] [--delta DELTA]
                      [--structure STRUCTURE] [--skin SKIN] [--slots {skin,cutoff}]
                      [--layout {auto,sparse,dense,matrix}]
                      [--dtype {float64,float32}] [--platform {cuda,cpu}]
                      [--procs PROCS] [--aa-dag {auto,chain,greedy,prefix}]
                      [--print-env BUNDLE] [--ffi] [--no-ffi] [--ffi-flags FFI_FLAGS]
                      [--ffi-precision {float64,mixed}]
                      [--type-elements TYPE_ELEMENTS]

options:
  -h, --help            show this help message and exit
  --model MODEL         a model .npz (linear ACE) or .yace (required)
  --out OUT             the file to write: .yace or .json (else give --format;
                        required)
  --format {yace,lammps,symmetrix}
                        yace: ML-PACE C-tilde (exact, tabulated radials); lammps: a
                        lammps-jax bundle; symmetrix: a Symmetrix JSON model,
                        converted by the installed Symmetrix (default: from the --out
                        extension, .json being a lammps-jax bundle)
  --delta DELTA         yace: radial table spacing and ML-PACE deltaSplineBins in Å
                        (default 0.001; the cutoff must be a whole number of it)
  --structure STRUCTURE
                        lammps: the extxyz LAMMPS starts from (first configuration);
                        it sizes the buffers
  --skin SKIN           lammps: the LAMMPS neighbour skin (Å)
  --slots {skin,cutoff}
                        lammps: neighbour slots for rcut + skin (safe) or rcut
                        (tighter; stable MD only)
  --layout {auto,sparse,dense,matrix}
                        lammps: bundle layout
  --dtype {float64,float32}
                        lammps: precision
  --platform {cuda,cpu}
                        lammps: the lammps-jax backend the bundle runs on (default
                        cuda)
  --procs PROCS         lammps: the LAMMPS processor grid px,py,pz; sizes one MPI
                        rank's buffers (run LAMMPS with `processors px py pz`)
  --aa-dag {auto,chain,greedy,prefix}
                        lammps: the product basis form: auto (greedy for large bases,
                        else chain), chain, or the DAG plans greedy / prefix (on a
                        CUDA GPU, --ffi is faster than any of them)
  --print-env BUNDLE    instead of an export: print the environment that runs LAMMPS
                        on an exported kernel bundle, resolved on this machine (run it
                        where LAMMPS runs; a kernel library missing here is compiled
                        here)
  --ffi                 lammps: require ace-jax's kernel for linear ACE (one FFI call
                        per step; on --platform cpu the default takes it when it can
                        and says why not), compiled on first use with the C++ compiler
                        ($CXX, c++, g++ or clang++), or nvcc for a GPU bundle, and
                        cached
  --no-ffi              lammps, --platform cpu: the XLA program, not the C++ kernel
  --ffi-flags FFI_FLAGS
                        lammps: the kernel's compiler flags (implies --ffi; default
                        "-O3 -march=native", or "-O3 -arch=sm_XY" for a GPU): on a
                        login node for compute nodes of another CPU type, e.g. --ffi-
                        flags="-O3 -march=x86-64-v3" (with =), or -arch=sm_80 for an
                        A100
  --ffi-precision {float64,mixed}
                        lammps: 'mixed' runs the kernel's product basis in float32 and
                        the rest in float64 (faster for large models; energies carry
                        ~0.1 meV of noise in 200 atoms, so minimise with a force-based
                        min_style, not a line search); needs the kernel and float64
  --type-elements TYPE_ELEMENTS
                        lammps: comma-separated element of each LAMMPS atom type, in
                        type order (default: the model's element order)

aj native

Shows the native C++ code that ace-jax can use on this machine: the compiler, the C++ kernel and the neighbour list. --build compiles the kernel. See Installation.

usage: ace-jax native [-h] [--build] [--flags FLAGS] [--gpu-flags GPU_FLAGS]

options:
  -h, --help            show this help message and exit
  --build               compile the C++ kernel, and on a CUDA GPU the CUDA kernel,
                        into the cache now (else each is compiled on first use); on a
                        cluster, run it on a compute node. Exits 1 when one cannot be
                        compiled
  --flags FLAGS         the kernel's compiler flags (default "-O3 -march=native", or
                        ACEJAX_FFI_FLAGS), e.g. --flags="-O3 -march=x86-64-v3" (with
                        =)
  --gpu-flags GPU_FLAGS
                        the CUDA kernel's nvcc flags (default "-O3 -arch=sm_XY" for
                        this GPU, or ACEJAX_FFI_GPU_FLAGS)

aj basis

usage: ace-jax basis [-h] --elements ELEMENTS --order ORDER --max-degree MAX_DEGREE
                     [--wL WL] [--rcut RCUT] [--rin RIN]
                     [--radial-mode {onehot,glorot_normal,zero}]
                     [--pair-mode PAIR_MODE] [--radial-basis {poly,sbessel}]
                     [--no-gamma] [--no-coupling-cache]
                     [--coupling-cache-dir COUPLING_CACHE_DIR] [--embedding EMBEDDING]
                     [--nmax-by-order NMAX_BY_ORDER] [--lmax-by-order LMAX_BY_ORDER]
                     [--d-max D_MAX] [--maxl MAXL] [--reduction {pca,truncate}]
                     [--seed SEED] --out OUT [--config CONFIG]

options:
  -h, --help            show this help message and exit
  --elements ELEMENTS   comma-separated Z numbers or symbols
  --order ORDER         correlation order
  --max-degree MAX_DEGREE
                        TotalDegree level bound
  --wL WL
  --rcut RCUT           cutoff (default 5.5; with an embedding, 2.5 x mean bond
                        length)
  --rin RIN
  --radial-mode {onehot,glorot_normal,zero}
                        initial tensor radials: onehot (R_n = P_n, the frozen-fit
                        default) or seeded glorot_normal mixtures (a random start,
                        e.g. for learned radials)
  --pair-mode PAIR_MODE
  --radial-basis {poly,sbessel}
                        tensor-radial basis: poly (ACEpotentials, polynomials of a
                        transformed distance) or sbessel (PACE's simplified spherical
                        Bessel functions of r, as pacemaker's radials)
  --no-gamma            skip the smoothness prior
  --no-coupling-cache   always compute the coupling instead of using the per-shape
                        cache
  --coupling-cache-dir COUPLING_CACHE_DIR
                        coupling cache directory (default: $ACEJAX_COUPLING_CACHE or
                        ~/.cache/ace-jax/coupling)
  --embedding EMBEDDING
                        frozen element embedding of the basis: a JSON table {Z, emb}
                        or 'identity' (builds ace_embedding_model: ace1-compatible,
                        factorised radial)
  --nmax-by-order NMAX_BY_ORDER
                        comma-separated cap on the radial degree n of each many-body
                        term, per correlation order from 1 (pacemaker's
                        nradmax_by_orders; the last entry repeats)
  --lmax-by-order LMAX_BY_ORDER
                        comma-separated cap on l per correlation order (pacemaker's
                        lmax_by_orders); with --wL 1 the TotalDegree level is
                        pacemaker's power order
  --d-max D_MAX         cap on per-order channel widths (default lossless)
  --maxl MAXL
  --reduction {pca,truncate}
  --seed SEED
  --out OUT
  --config CONFIG       a fit.yaml: its `basis:` block (and `seed`); command-line
                        flags override it

aj ham

Fits a Hamiltonian model to the H and S blocks of DFT structures, predicts the blocks of new structures, and calculates bands and the density of states. See Hamiltonian models. aj eval gives the errors of a Hamiltonian model on reference structures.

aj ham fit

usage: ace-jax ham fit [-h] --data DATA --out OUT [--validation VALIDATION]
                       [--channels CHANNELS [CHANNELS ...]] [--data-memory GB]
                       [--max-structures MAX_STRUCTURES] [--bonds BONDS] [--seed SEED]
                       [--site-rcut SITE_RCUT] [--site-radials SITE_RADIALS]
                       [--bond-rcut BOND_RCUT] [--bond-radials BOND_RADIALS]
                       [--coupled N L] [--env R N L NB LB] [--no-env] [--prior PRIOR]
                       [--noise-floor SIGMA] [--ridge RIDGE] [--kpts KPTS KPTS KPTS]
                       [--nelectrons NELECTRONS] [--width WIDTH]
                       [--smearing {fermi-dirac,gaussian}] [--window WINDOW WINDOW]
                       [--threads THREADS] [--overlap-threshold X]

Fit the on-site and off-site block models to the structures under --data and write one
model file. The basis: site features of order 1 (--site-radials radial functions
within --site-rcut, every L the orbital basis needs), bond features of --bond-radials
radial functions out to --bond-rcut (default: the longest bond with a block), the
site-coupled group (--coupled N L) and the bond-environment group (--env R N L NB LB;
--no-env). --prior: the smoothness prior's scale, a number, or chosen per shell pair
and channel by the evidence or by leaving structures out ("loo", "press").

options:
  -h, --help            show this help message and exit
  --data DATA           training structures with blocks: a directory of operator
                        caches (*.npz) or DeepH-layout subdirectories
  --out OUT             the model file (.npz)
  --validation VALIDATION
                        structures with blocks to score the fitted model on (as aj
                        eval)
  --channels CHANNELS [CHANNELS ...]
                        operator channels to fit (default: every channel of the data,
                        e.g. H S)
  --data-memory GB      blocks of the training structures kept in memory (default 8);
                        a larger set is read from disk again on each pass of the fit
  --max-structures MAX_STRUCTURES
                        use the first N structures of --data (name order)
  --bonds BONDS         fit to a random N off-site blocks of each structure (default
                        0: all)
  --seed SEED           seed of the --bonds choice
  --site-rcut SITE_RCUT
                        cutoff of the site features (default 7.0)
  --site-radials SITE_RADIALS
                        radial functions of the site features (default 12)
  --bond-rcut BOND_RCUT
                        longest bond with a block (default: the longest in the data)
  --bond-radials BOND_RADIALS
                        radial functions of the two-centre features (default 12)
  --coupled N L         site-coupled features: radial functions and largest bond
                        harmonic (default 2 2; 0 0: off)
  --env R N L NB LB     bond environment: cutoff, radial functions and largest
                        harmonic about the midpoint, radial functions and largest
                        harmonic of the bond it couples with (default 5 8 4 6 4; 5 6 4
                        4 4, the default to 0.7.2, is smaller and faster)
  --no-env              no bond-environment features (faster, less accurate)
  --prior PRIOR         smoothness prior: none (default), its scale as a number, or
                        evidence, loo, press
  --noise-floor SIGMA   with --prior evidence: the smallest noise of H the evidence
                        may select, in the data's unit (the scatter of H between SCF
                        runs; approximately 1e-7 eV to 3e-6 eV for sc_accuracy_rho
                        1e-5)
  --ridge RIDGE         ridge on every coefficient (default 1e-10)
  --kpts KPTS KPTS KPTS
                        Gamma-centred k-point grid (default 3 3 3)
  --nelectrons NELECTRONS
                        electrons the bands hold: a number per cell, or Z:n,Z:n per
                        atom of each element (default: what the model file records
                        from its fit, else the atomic numbers)
  --width WIDTH         smearing width in the model's energy unit (default 0.1)
  --smearing {fermi-dirac,gaussian}
  --window WINDOW WINDOW
                        eigenvalues scored: from LO to HI of the reference Fermi level
                        (default -12 5)
  --threads THREADS     threads of the off-site evaluation on a CPU (default 1)
  --overlap-threshold X
                        drop the combinations of orbitals whose overlap eigenvalue at
                        a k-point is below X before diagonalising (default 0: none);
                        1e-3 for a diffuse basis whose predicted bands are far off
                        although the blocks are close

aj ham calibrate

usage: ace-jax ham calibrate [-h] --model MODEL --data DATA [--out OUT]
                             [--levels LEVELS [LEVELS ...]] [--bands BANDS]
                             [--distance-bands DISTANCE_BANDS] [--channel CHANNEL]
                             [--kpts KPTS KPTS KPTS] [--nelectrons NELECTRONS]
                             [--width WIDTH] [--smearing {fermi-dirac,gaussian}]
                             [--window WINDOW WINDOW] [--threads THREADS]
                             [--overlap-threshold X]

Calibrate the eigenvalue intervals of a model on structures with reference blocks that
its fit did not use (`ham.uq`: split conformal, a half-width per energy band and
level), and those of its matrix elements (per channel, species pair, distance band and
shell pair), and write the model with the calibration in its file. `aj eval` then
reports the coverage of the intervals on other structures, and
`HamiltonianCalculator.eigenvalue_half_widths` gives them.

options:
  -h, --help            show this help message and exit
  --model MODEL
  --data DATA           calibration structures with blocks (not those of the fit)
  --out OUT             the calibrated model file (default: --model, rewritten)
  --levels LEVELS [LEVELS ...]
                        coverage levels (default 0.68 0.9 0.95)
  --bands BANDS         energy bands, each with its own half-width (default 6)
  --distance-bands DISTANCE_BANDS
                        distance bands of the off-site blocks of a species pair, each
                        with its own half-widths (default 6)
  --channel CHANNEL     Hamiltonian channel (default H; H_up or H_dn of a spin model)
  --kpts KPTS KPTS KPTS
                        Gamma-centred k-point grid (default 3 3 3)
  --nelectrons NELECTRONS
                        electrons the bands hold: a number per cell, or Z:n,Z:n per
                        atom of each element (default: what the model file records
                        from its fit, else the atomic numbers)
  --width WIDTH         smearing width in the model's energy unit (default 0.1)
  --smearing {fermi-dirac,gaussian}
  --window WINDOW WINDOW
                        eigenvalues scored: from LO to HI of the reference Fermi level
                        (default -12 5)
  --threads THREADS     threads of the off-site evaluation on a CPU (default 1)
  --overlap-threshold X
                        drop the combinations of orbitals whose overlap eigenvalue at
                        a k-point is below X before diagonalising (default 0: none);
                        1e-3 for a diffuse basis whose predicted bands are far off
                        although the blocks are close

aj ham predict

usage: ace-jax ham predict [-h] --model MODEL --data DATA --out OUT [--no-overlap]
                           [--channel CHANNEL] [--threads THREADS]

The H (and S) blocks of every structure of --data, one DeepH-layout directory each
under --out: the structure files, hamiltonians_pred.h5 and overlaps_pred.h5.

options:
  -h, --help         show this help message and exit
  --model MODEL
  --data DATA        structures: an extxyz file, or a directory of structures with
                     blocks
  --out OUT          output directory: one subdirectory per structure
  --no-overlap       write H only
  --channel CHANNEL  Hamiltonian channel (default H; H_up or H_dn of a spin model)
  --threads THREADS  threads of the off-site evaluation on a CPU (default 1)

aj ham bands

usage: ace-jax ham bands [-h] --model MODEL --structure STRUCTURE [--index INDEX]
                         [--path PATH] [--npoints NPOINTS] [--channel CHANNEL]
                         [--no-reference] [--out OUT] [--plot PLOT]
                         [--plot-window PLOT_WINDOW PLOT_WINDOW]
                         [--dos-width DOS_WIDTH] [--kpts KPTS KPTS KPTS]
                         [--nelectrons NELECTRONS] [--width WIDTH]
                         [--smearing {fermi-dirac,gaussian}] [--window WINDOW WINDOW]
                         [--threads THREADS] [--overlap-threshold X]

Bands of one structure on a high-symmetry path and the density of states of a k-point
grid, written as arrays (--out, .npz) and as a figure (--plot). A structure that comes
with blocks (a cache file or a DeepH directory) also gives the reference's bands, and
the errors of the model against them are printed (--no-reference: the model alone).

options:
  -h, --help            show this help message and exit
  --model MODEL
  --structure STRUCTURE
                        an extxyz file, an operator cache (.npz) or a DeepH directory;
                        or a directory of those with --index
  --index INDEX         which structure of --structure (default the first)
  --path PATH           special points of the band path, e.g. GXMG (default: ASE's
                        path for the lattice)
  --npoints NPOINTS     k-points on the path (default 200)
  --channel CHANNEL     Hamiltonian channel (default H; H_up or H_dn of a spin model)
  --no-reference        do not compute the reference's bands from the structure's own
                        blocks
  --out OUT             arrays of the bands, the grid eigenvalues and the Fermi levels
                        (.npz)
  --plot PLOT           figure file (needs matplotlib)
  --plot-window PLOT_WINDOW PLOT_WINDOW
                        energy range of the figure from the Fermi level (default -13
                        6)
  --dos-width DOS_WIDTH
                        Gaussian width of the density of states in the figure (default
                        0.1)
  --kpts KPTS KPTS KPTS
                        Gamma-centred k-point grid (default 8 8 8)
  --nelectrons NELECTRONS
                        electrons the bands hold: a number per cell, or Z:n,Z:n per
                        atom of each element (default: what the model file records
                        from its fit, else the atomic numbers)
  --width WIDTH         smearing width in the model's energy unit (default 0.1)
  --smearing {fermi-dirac,gaussian}
  --window WINDOW WINDOW
                        eigenvalues scored: from LO to HI of the reference Fermi level
                        (default -12 5)
  --threads THREADS     threads of the off-site evaluation on a CPU (default 1)
  --overlap-threshold X
                        drop the combinations of orbitals whose overlap eigenvalue at
                        a k-point is below X before diagonalising (default 0: none);
                        1e-3 for a diffuse basis whose predicted bands are far off
                        although the blocks are close

aj density

Fits an electron-density model to the density coefficients of DFT structures, and predicts the coefficients of new structures. See Electron-density models. aj eval gives the errors of an electron-density model on reference structures.

aj density fit

usage: ace-jax density fit [-h] --data DATA --out OUT [--validation VALIDATION]
                           [--metric {overlap,plain}] [--prior PRIOR] [--scaled R]
                           [--order ORDER] [--site-rcut SITE_RCUT]
                           [--site-radials SITE_RADIALS [SITE_RADIALS ...]]
                           [--lmax L [L ...]] [--ridge RIDGE]
                           [--max-structures MAX_STRUCTURES]

Fit an electron-density model to the density files under --data and write one model
file. The model: the expansion coefficients of every auxiliary shell of angular
momentum l as a linear function of the site features of (l, (-1)^l) (correlation order
--order, --site-radials radial functions within --site-rcut). --metric overlap (the
default when every structure has the overlap of the auxiliary functions) minimises the
L2 norm of the density error; plain, the error of each coefficient. --prior: the
smoothness prior's scale, a number, or chosen by the evidence or by leaving structures
out ("loo", "press"); --scaled R: a ridge of R times the diagonal of the Gram matrix
on the feature columns.

options:
  -h, --help            show this help message and exit
  --data DATA           training structures: a directory of density files (*.npz), or
                        of DeepH directories with density.npz
  --out OUT             the model file (.npz)
  --validation VALIDATION
                        density files to score the fitted model on (as aj eval)
  --metric {overlap,plain}
                        overlap: the L2 norm of the density error (default when every
                        structure has the overlap); plain: least squares on each
                        coefficient
  --prior PRIOR         smoothness prior: none (default), its scale as a number, or
                        evidence, loo, press
  --scaled R            ridge of R times the diagonal of the Gram matrix on every
                        feature column (default 1e-6 with --prior none; not with
                        another --prior)
  --order ORDER         correlation order of the site features (default 1)
  --site-rcut SITE_RCUT
                        cutoff of the site features (default 7.0)
  --site-radials SITE_RADIALS [SITE_RADIALS ...]
                        radial functions of the site features, per correlation order
                        (default 12; higher orders 5)
  --lmax L [L ...]      largest l of the one-particle functions, per correlation order
                        (default: the largest l of the auxiliary basis; higher orders
                        3)
  --ridge RIDGE         ridge on every coefficient (default 1e-10)
  --max-structures MAX_STRUCTURES
                        use the first N structures of --data (name order)

aj density predict

usage: ace-jax density predict [-h] --model MODEL --data DATA --out OUT
                               [--nelectrons NELECTRONS]

The predicted density of every structure of --data, one density file each under --out:
the coefficients corrected to the electron count, and in the file's info `dN`, the
count error before the correction, which is also printed: a large one marks a
structure unlike the training set.

options:
  -h, --help            show this help message and exit
  --model MODEL
  --data DATA           structures: an extxyz file, or a directory of density files
  --out OUT             output directory: one density file per structure
  --nelectrons NELECTRONS
                        electrons per cell (default: the structure's record, else the
                        model's electrons per atom)