Skip to main content

ArrayFF

Conda Version Conda Downloads Pypi version PyPI Downloads

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.2

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.2
File Size Uploaded Provenance Actions
arrayff-0.0.2.tar.gz 68.0 kB With provenance Details for arrayff-0.0.2.tar.gz

Built distribution (wheel)

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

Total release size: 155.1 kB

Release files / arrayff-0.0.2.tar.gz

Download URL arrayff-0.0.2.tar.gz
Size 68.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bb2e8a969694e3c5cd6c7ddd03ff97b692174787b7e368beb6e7ad2048e61dc8
BLAKE2b-256 checksum
How to use checksums
7cb6fbd4052d4748e3eee0e7b12f23116e9e64afdff8fe34c5774cc0ab8e3bad
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 Nov 3, 2026.

Transparency log

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

Download URL arrayff-0.0.2-py3-none-any.whl
Size 87.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be3329d6378a2ce9a8dad3e70a9c9fbc41960ec4713ef3a976cc7ee437472e36
BLAKE2b-256 checksum
How to use checksums
9861e1af46e73a4e166987f6936bbfc525b85d3c54cc07e866b9f05555343027
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 Nov 3, 2026.

Transparency log

Security for arrayff 0.0.2

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.2.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 Nov 3, 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.2 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