Skip to main content

ArrayFF

The Force Field Library Based on Multiple Array Backends like NumPy, PyTorch and JAX.

Kernels are written once with autoray, so the backend is chosen by the arrays you pass in. Structural I/O uses ase.Atoms throughout.

The only required array backends are NumPy and autograd (for NumPy autodiff); PyTorch and JAX are optional extras.

Install

uv pip install -e .
uv pip install -e ".[torch]"     # optional PyTorch backend + nn wrappers
uv pip install -e ".[jax]"       # optional JAX backend
uv pip install -e ".[builders]"  # vesin / matscipy / pymatgen neighbours

Quick start

from ase.build import bulk
from arrayff.potentials import EMT, EMTCalculator

atoms = bulk("Cu", "fcc", a=3.6, cubic=True).repeat((2, 2, 2))

calc = EMT()                       # numpy backend + autograd for forces
energy, forces = calc.energy_and_forces(atoms, method="analytic")

atoms.calc = EMTCalculator()       # ASE calculator interface
energy = atoms.get_potential_energy()

Backends are selected at construction:

calc = EMT(backend="torch")        # or "jax"
calc = EMT(backend="jax", jit=True)

LennardJones() without arguments uses the OpenKIM universal shifted parameters (118 elements, cutoff 4*sigma per pair, Lorentz-Berthelot mixing: arithmetic r0/cutoff and geometric epsilon).

Each potential exposes analytic and autodiff forces/stress:

from arrayff.potentials import LennardJones

calc = LennardJones(cutoff=8.0, sigma=3.405, epsilon=0.01032)
calc.energy_and_forces(atoms, method="analytic")
calc.energy_and_forces(atoms, method="autodiff")
calc.stress(atoms, method="analytic")

jit=True compiles the array-level kernel with autoray.autojit (JAX and PyTorch are the useful backends; NumPy's compiler is best-effort).

Charge equilibration and composite potentials

from arrayff.electrostatics import QEq

qeq = QEq(chi={8: 8.5, 1: 4.5}, J={8: 10.0, 1: 12.0}, shielding=1.0)
charges = qeq.charges(atoms)       # sum == total charge

# additive composite: energy/forces/stress add, charges come from QEq
composite = LennardJones(cutoff=8.0, sigma=3.405, epsilon=0.01032) + qeq
energy, forces = composite.energy_and_forces(atoms)

QEq supports charge_response="frozen" (Hellmann-Feynman, default) and "relaxed" (differentiate through the charge solve).

Training (optional)

from arrayff.potentials import LJTorch

model = LJTorch(species=[18])           # epsilon/sigma trainable
loss = (model(atoms) - target_energy) ** 2
loss.backward()

Tests and benchmarks

pytest -q
pytest -s src/tests-benchmark/bench_potentials.py
pytest -s src/tests-benchmark/bench_derivatives.py

The benchmark tables compare analytic vs autodiff forces/stress and jit=False/True across backends.

Status

Potential State
Lennard-Jones (OpenKIM universal shifted) implemented
Lennard-Jones 9-3, Morse implemented
EMT (matches ase.calculators.emt, including asap_cutoff) implemented
EAM (setfl tables, matches ase.calculators.eam) implemented
QEq (shielded Coulomb, extended matrix, frozen/relaxed response) implemented
Additive composites (LJ + QEq, ...) implemented
MEAM, UF3, EEM, PQEq declared placeholders

Metadata

Release files for arrayff 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for arrayff 0.0.1
File Size Uploaded Provenance Actions
arrayff-0.0.1.tar.gz 63.6 kB With provenance Details for arrayff-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for arrayff 0.0.1
File Interpreter ABI Platform Actions
arrayff-0.0.1-py3-none-any.whl Python 3 none any Details for arrayff-0.0.1-py3-none-any.whl

Total release size: 144.5 kB

Release files / arrayff-0.0.1.tar.gz

Download URL arrayff-0.0.1.tar.gz
Size 63.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9002e0aa31eedaab8943fa4ccb173741f757b5882ad0009d3bf42700d4cc7cfa
BLAKE2b-256 checksum
How to use checksums
cf42462753ec9cc34fbfbe0cc37c1d850b223e762341f594e8e1d61eb2806dc6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / arrayff-0.0.1-py3-none-any.whl

Download URL arrayff-0.0.1-py3-none-any.whl
Size 80.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f7a1bab2a15836f58fd19b67ffba6e59b9f3206a3d4c9f25425460bdc25d1688
BLAKE2b-256 checksum
How to use checksums
3902f4817a640bfc071cbcbd72c4615b9bf2c7412bce603a2390ec4faed6eb48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Security for arrayff 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for arrayff-0.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page