Skip to content

ace-jax 0.4.0

Choose a tag to compare

@jameskermode jameskermode released this 19 Oct 16:29
· 73 commits to main since this release
78fa15e

Highlights. float32 is now a real float32 calculation in LAMMPS bundles
and calculators, and a new page tells you when it is safe. The linear fit can
calculate its design rows in float32 (--row-precision float32). MD runs on
the device with JAX-MD (ace_jax.jaxmd). Larger models use the DAG product
basis automatically. aj fit fits linear ACE by default.

Upgrading from 0.3.0. Saved models are unchanged.

  • aj fit without --m-per-species now fits linear ACE (it was the hybrid
    ACE + GP model). Give --m-per-species > 0 for the hybrid model.
  • A float32 bundle or calculator made with 0.3.0 from a model loaded under
    x64 calculated in float64. Export it again for the float32 speed.
  • Models with 4,000 or more chain-form multiplications per atom use the DAG
    product basis. Results agree with 0.3.0 to round-off. Set aa_dag=None
    for the 0.3.0 form.

Fixed

  • float32 export and calculators calculated in float64. With x64 enabled,
    export_lammps(dtype="float32"), aj export --dtype float32 and
    ACECalculator(dtype=float32) on a model already loaded traced a float64
    program. Only the inputs and outputs were float32, so there was no speed-up.
    The model is now converted to float32 after the lean form and the splines
    are made in float64 (ace_jax.eval.with_dtype).
  • float32 spline tables lost the precision of their derivatives. Splined
    and learned radials and radial tables in float32 had a relative derivative
    error of up to 5e-2. The tables are now kept in a local difference form,
    made in float64: 8e-7.
  • The design rows of a fit are calculated at the highest matmul precision.
    TF32 on an A100 corrupted float32 force rows.

Changed

  • The recursive (DAG) product basis is automatic. ACECalculator and
    export_lammps default to aa_dag="auto". It uses the DAG for models with
    4,000 or more chain-form multiplications per atom, and the chain form for
    smaller models. Results below the threshold are unchanged. Larger models run
    1.2-2.7x faster on a CPU node and 1.1-1.8x faster on an A100 (linear ACE
    o4d20: 2.7x and 1.8x). calc.aa_dag and the bundle's ace_jax.aa_dag give
    the form used. Set aa_dag=None for the chain form.
  • aj fit fits linear ACE by default. The default of --m-per-species
    is now 0 (it was 500). The hybrid ACE + GP model is experimental. To use
    it, give --m-per-species > 0. The GP options (--kernel, --no-bump,
    --density, --pca-d, --embedding) without --m-per-species > 0 are
    now an error. FitConfig in Python is not changed: set arm explicitly.

Added

  • float32 design rows for the linear fit. aj fit --row-precision float32 (FitConfig.row_precision) calculates the design rows, and on a GPU
    the QR merges, in float32. The evidence, the MAP and the posterior stay in
    float64. A silicon o4d16 fit took 169 s instead of 265 s on an RTX A4500,
    with the RMSE within 1%. The GP arm and --learn-radial refuse it.
    --row-check is an optional stability check of the result.
  • The float32 error of a model. ace_jax.calc.precision.precision_check
    compares float32 with float64 on a structure. export_lammps(..., precision_structure=atoms) and aj export --dtype float32 --structure
    record it in the bundle and warn above 0.1 meV/atom or a relative force
    error of 1e-4.
  • A new page, "Choose float64 or float32" (howto/precision), gives the
    speed-up by GPU (2.1-4.5x on an RTX A4500, 1.3-1.5x on an A100), the errors,
    and which tasks can use float32. Energy line searches fail in float32: use
    a force-only optimiser, for example ASE ODE12r.
  • MD with JAX-MD (ace_jax.jaxmd, the new jaxmd extra).
    jaxmd.potential gives the energy and forces of a model to the
    integrators of JAX-MD. The neighbour list, the model and the integrator
    then run on the device in one compiled program. The energy is the energy
    of ACECalculator with the same options. K sets the slots for each
    atom. If an atom has more neighbours than K, the energy and forces are
    NaN, and overflow tells you. The model runs in blocks of atoms of the
    size that export_lammps selects, so the memory is approximately that of a
    LAMMPS bundle. See Run MD with JAX-MD.
  • write_yace(model, path, summed=True) writes one A basis for all
    neighbour species, as ace-jax evaluates the model. The default writes each
    product once for each neighbour species. The summed form has far fewer
    products for multi-element models: 849 instead of 15,021 for a
    three-element embedded model at order 3. ML-PACE reads it only with the
    summed_neighbour_A addition. ace-jax does not read summed files.

Testing

  • The pace-parity CI job builds ML-PACE from
    jameskermode/lammps-user-pace (ICAMS/lammps-user-pace#31): the
    v.2025.12.4.p1 release plus tabulated radials, recursive-evaluator
    speed-ups and summed_neighbour_A.
    tests/test_pace_mlpace_yace.py evaluates four multi-element exports with
    ML-PACE, expanded and summed, and compares them with ace-jax.

LAMMPS export

  • Bundle row blocks are sized to an element target scaled by the memory of
    the target GPU. o4d16 runs up to 2.65x faster on an RTX A4500.
  • lammps-jax is on PyPI. Install it with the new lammps extra:
    pip install "ace-jax[lammps]". The CI tests the export with lammps-jax
    0.2.0.
  • lammps-jax excludes jaxlib 0.10.2, because its GPU scatter-add is
    approximately 4x slower. With the lammps extra, Python 3.11 gets jax
    0.10.1.
  • The bundle no longer writes ace_jax.platform. lammps-jax 0.2.0 reads the
    platform key from anywhere in the bundle. Read the platform from
    export_info.platform.

Benchmarks

  • The silicon accuracy-cost figure adds linear ACE run by ML-PACE with the
    speed-ups proposed upstream (ICAMS/lammps-user-pace#31 on the CPU, and
    prototype pace/kk kernels in pace_ref/fast on the A100). Against stock
    ML-PACE on the same node it is 1.5-1.8x faster on the CPU and 1.1-1.7x
    faster on the A100 (o4d20: 2.89 against 5.31 µs/atom-step on 128 cores,
    2.42 against 4.13 on the A100).

  • The silicon accuracy-cost benchmark adds linear ACE run by ACEpotentials.jl
    on the CPU: each aj fit model rebuilt as an ACEpotentials ace_model
    (bench/scaling/julia/build_trim_acejax.jl, gated to 1e-10 against ace-jax),
    compiled with juliac --trim (ACEpotentials PR 309) and run in LAMMPS. It is
    the fastest CPU code for linear ACE up to o4d14, ties ML-PACE at o4d16 and is
    2x slower than ML-PACE at o4d20 (bench/accuracy_cost/build_trim.py,
    envs/sulis-cpu-trim.sbatch).

  • The benchmark adds NEP (NEP4, trained with GPUMD). On the CPU it runs in
    LAMMPS with pair_style nep in float64. On the A100 it runs in GPUMD in mixed
    precision, and the figure labels these points. NEP is the cheapest family on
    the A100. On the CPU, PACE reaches the same force error at a lower cost. Its
    force error stops at approximately 0.10 eV/Å, the published NEP
    result for this dataset, and it does not reach the QoI target
    (bench/accuracy_cost/fit_nep.py).