Installation¶
ace-jax needs Python 3.11 or later. It is tested on Python 3.11 to 3.14. It is a pure-Python package; JAX gives the compiled numerics.
Most users need only this command. With uv,
use uv pip install ..., or uv add with the same requirement in a
project.
What gets installed¶
| Install | Adds | Needed for |
|---|---|---|
ace-jax |
the core: building a basis, fitting (aj fit, every arm), learned radials, model loading, evaluation, ASE calculators, aj basis, aj eval |
everything below except the pathfinder rung |
ace-jax[gp] |
blackjax | the pathfinder rung of --rungs |
ace-jax[cuda] |
jax[cuda12] |
running on an NVIDIA GPU |
ace-jax[cuda13] |
jax[cuda13], NVIDIA's nvcc |
running on an NVIDIA GPU with a driver 580 or later, with nvcc for the CUDA kernel |
ace-jax[native] |
matscipy-neighbours | native C++ code on CPUs: faster neighbour lists (ASE's list is the fallback), with the C++ kernel |
ace-jax[lammps] |
lammps-jax | LAMMPS export |
ace-jax[jaxmd] |
jax-md (and approximately 40 dependencies, for example flax and pymatgen) | MD with JAX-MD |
ace-jax[ham] |
h5py | Hamiltonian models: the DeepH file layout. Electron-density models do not need it |
You can combine extras, for example ace-jax[gp,cuda].
Building a basis: supported platforms¶
To build a new basis (aj fit --order ..., aj basis, or build_basis in
Python), ace-jax uses ace-jax-coupling. This compiled library calculates
the symmetry-adapted coupling coefficients. pip installs it automatically on
these platforms:
- Linux x86_64 and aarch64 (manylinux_2_28, so glibc 2.28 or newer)
- macOS arm64
- Windows x64
You do not need to set up anything else, and nothing is downloaded at run time.
On other platforms, ace-jax installs without this library. All functions work, except the build of a new basis:
- A basis file built on a different machine fits and evaluates normally
(
aj fit --model basis.npz). - If you try to build a basis, ace-jax gives the error
BasisUnavailable, with this instruction.
The first build of a new basis specification calculates its coupling
coefficients. This takes milliseconds. ace-jax keeps the result in
~/.cache/ace-jax/coupling (or $ACEJAX_COUPLING_CACHE). Later builds of
the same specification read the cache.
native¶
The native extra installs matscipy-neighbours, a C++ neighbour list.
From version 1.1, matscipy-neighbours has binary wheels for Linux, macOS
(arm64) and Windows. Thus its installation needs no compiler. On other
platforms, pip compiles it, and needs CMake and a C++17 compiler. ace-jax
uses matscipy-neighbours when it can import it. If not, ace-jax uses the ASE
neighbour list.
The wheels are for CPUs only. To build the neighbour list on a GPU, compile matscipy-neighbours with the CUDA toolkit of your machine:
- Put
nvccon yourPATH. On a cluster, load the CUDA module (for example,module load CUDA). -
Compile matscipy-neighbours. Replace
80with the compute capability of your GPU (80 for an A100, 75 for a T4):
Without this step, ace-jax on a GPU builds the neighbour list on the CPU. The results agree to round-off.
ace-jax has a C++ kernel for linear ACE on CPUs (the ASE calculator with
ffi=True, and LAMMPS bundles). The ace-jax wheels for Linux (x86_64 and
aarch64) and for macOS (arm64) include the compiled kernel. Thus the kernel
needs no compiler and no extra on these platforms.
On other platforms, the kernel is included as source code. A C++17 compiler builds it the first time, and ace-jax keeps it in a cache.
The included kernel for x86_64 uses AVX2. In our tests it was as fast as a
kernel compiled for the machine (-march=native), to 5%. To compile the
kernel with your own flags, set ACEJAX_FFI_FLAGS:
Set the same variable when you run ace-jax, or ace-jax uses the included kernel.
- Install the extra:
pip install "ace-jax[native]". -
Make sure that ace-jax can use the C++ code:
The command shows the kernel, the compiler and the neighbour list. If your wheel does not include the kernel, the command compiles it. On a cluster, run it on a compute node.
The former name of the extra, fast-neighbours, installs the same packages.
GPU¶
- Add
cudato the extras that you install. -
Make sure that JAX finds the GPU:
The cuda extra installs the JAX CUDA 12 wheels. The CUDA kernel for
linear ACE (ffi=True) also needs nvcc, which compiles it the first time
that you use it. Use the nvcc of a CUDA toolkit or a module, or install the
cuda13 extra. The cuda13 extra installs the JAX CUDA 13 wheels and nvcc.
CUDA 13 needs an NVIDIA driver 580 or later. To see the driver version:
For other CUDA versions or platforms:
- Install JAX with the JAX installation guide.
- Install ace-jax.
To use the CPU on a GPU machine, set JAX_PLATFORMS=cpu.
Precision (float64)¶
Enable float64 in Python
Fitting and radial learning need float64. The aj command enables
float64 itself. In Python, enable float64 before any other code imports
JAX:
Alternatively, set JAX_ENABLE_X64=1 in the environment. ace-jax never
changes the JAX precision setting itself. The JAX default is float32.
Evaluation works in float32 and float64. By default (dtype=None),
ACECalculator uses the JAX default precision. Thus, if float64 is not
enabled, it uses float32. Enable float64 also for evaluation, unless you
need the float32 speed and accept its error.
To measure the float32 error of a model, use
ace_jax.calc.precision.precision_check(model, meta, atoms). It returns the
energy, force and stress differences from float64 on atoms. See
Choose float64 or float32.
LAMMPS¶
LAMMPS export needs lammps-jax.
- Add
lammpsto the extras that you install. - Build the lammps-jax LAMMPS plugin at the same version as the Python package.
The export uses the CPU kernel for linear ACE when it is available (see
native). If not, the export uses the XLA program.
See LAMMPS export.
Development install¶
git clone https://github.com/ACEsuit/ace-jax
cd ace-jax
uv sync # core + the gp extra's packages + dev tools
uv run pytest # the fast test suite