Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

matscikit

Fast Rust kernels for computational materials science, with Python and WebAssembly bindings.

Packages whose functionality matscikit covers, with measured speedups, and the interfaces it is exposed through

  • Structures and chemistry: compositions with exact rational amounts, periodic structures, CIF and extxyz I/O, symmetry and protostructure labels, Niggli and Minkowski reduction with integer transforms, primitive cells that respect magnetic and constraint order, structure matching, MP2020 corrections and convex hulls (also finite-temperature)
  • Relaxation, NEB and MD: batched geometry optimization, nudged elastic bands, NVT and NPT molecular dynamics, equations of state and elastic constants
  • Phonons: harmonic and anharmonic lattice dynamics, QHA, thermal conductivity (with four-phonon scattering), force-constant fitting, TDEP and SSCHA
  • docs/alloys.md: solid solutions, derivative-structure enumeration, SQS and lattice Monte Carlo
  • docs/free-energy.md: absolute free energies and melting points by nonequilibrium thermodynamic integration
  • docs/calphad.md: CALPHAD Gibbs models, phase equilibria, binary phase diagrams, TDB I/O and fitting
  • docs/mace.md: native MACE inference on CPU, Metal, CUDA and ROCm
  • docs/wasm.md: the WebAssembly bindings, their API coverage and numerics

Design

  • One model interface. Anything with compute(structures, properties) -> list[dict] is a model. Energy, forces and stress have fixed slots; every other head (magnetic moments, charges, ...) is a named array, so new physics never changes the interface. Adapters wrap existing calculators.
  • Native MACE. matscikit.MACE runs MACE foundation models (MACE-MH-1, all heads) without torch on CPU (f64/f32), Apple GPUs (Metal), NVIDIA GPUs (CUDA feature) and AMD GPUs (ROCm, hip feature), with f64 parity to mace-torch at 1e-13 eV/atom on the materials heads (≤ 1e-15 relative on every head) for all 89 supported elements. It loads mace-torch .model checkpoints directly (a native zip and pickle reader, no torch at any point), is thread-safe, and its metadata records the checkpoint sha256 and matscikit.BUILD_ID (a hash of the source the extension was built from); see docs/mace.md.
  • Batched by default. Relaxation, MD and thermodynamic integration advance many structures (replicas, phases, temperatures) in lock step with one model call per step.

Install

uv pip install matscikit  # or `uv add matscikit` in a uv project

From source (needs a Rust toolchain):

uv pip install -e .

The type stub bindings/python/matscikit/_core.pyi is generated from the PyO3 signatures: after changing src/python/, regenerate it with uvx maturin@1.16.0 generate-stubs -q -F stubs --out bindings/python (the pre-push pyo3-stubs hook does this, and CI fails when it is stale).

Python

Anything with compute(structures, properties) is a model, so the same workflows run with EMT, EAM, MACE or an adapted ASE calculator:

import matscikit as msk

cu = msk.Structure([[0, 1.8, 1.8], [1.8, 0, 1.8], [1.8, 1.8, 0]], ["Cu"], [[0, 0, 0]])
print(msk.symmetry_dataset(cu)["hm_short"])  # F m -3 m

# batched relaxation: one model call per step for all structures
[result] = msk.relax([cu.make_supercell(2)], msk.EMT(), f_max=0.01)
print(result["converged"], result["energy"])  # eV

# harmonic phonons
phonons = msk.Phonons(cu, [4, 4, 4])
phonons.generate_displacements(distance=0.01)
phonons.produce_fc2(msk.EMT())  # or forces as an (n_sets, n_atoms, 3) array
print(phonons.frequencies([[0, 0, 0], [0.5, 0, 0.5]]))  # THz, (n_q, n_bands)
print(phonons.thermal_properties([16, 16, 16], t_max_k=1000)["free_energy_kj_per_mol"][-1])

# the same calls with a MACE foundation model, read straight from the mace-torch checkpoint
mace = msk.MACE("mace-mh-1.model", head="omat_pbe", device="metal", dtype="float32")
[result] = msk.relax([cu.make_supercell(2)], mace, f_max=0.01)
print(result["converged"], result["energy"])

JavaScript / WebAssembly

The same kernels run in browsers and Node through WebAssembly bindings with TypeScript types (src/wasm/, cargo feature wasm): everything except the Metal, CUDA and HIP engines, the ASE adapters and the few workflows docs/wasm.md lists as Python-only, MACE-MH-1 on CPU included. Results match the Python bindings bitwise or to round-off (MACE float64 forces within 1e-14 eV/Å).

uv run scripts/build_wasm.py  # bindings/wasm/pkg: the npm package matscikit, with license files
import init, { EMT, Structure, relax } from './pkg/matscikit.js'
await init()
const cu = new Structure([[0, 1.8, 1.8], [1.8, 0, 1.8], [1.8, 1.8, 0]], [`Cu`], [[0, 0, 0]])
const [result] = relax([cu.make_supercell(2)], new EMT(), { f_max: 0.01 })

See docs/wasm.md for usage per area, the API coverage table and measured numerics.

Source

The Rust source by module, areas proportional to non-blank lines (inline tests included); regenerate with uv run --no-project docs/source_treemap.py.

Treemap of the Rust source by module and file

Acknowledgements

matscikit builds on, and is tested against, these projects:

License

MIT (license). Bundled data and fixtures: docs/third-party-notices.md. Linked Rust crates: docs/crate-licenses.md.

Metadata

Release files for matscikit 0.1.0b1

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

Source distribution (sdist)

Source distribution for matscikit 0.1.0b1
File Size Uploaded Provenance Actions
matscikit-0.1.0b1.tar.gz 2.4 MB Without provenance Details for matscikit-0.1.0b1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for matscikit 0.1.0b1
File Actions
matscikit-0.1.0b1-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for matscikit-0.1.0b1-cp311-abi3-win_amd64.whl
matscikit-0.1.0b1-cp311-abi3-manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.28+ x86-64 Details for matscikit-0.1.0b1-cp311-abi3-manylinux_2_28_x86_64.whl
matscikit-0.1.0b1-cp311-abi3-manylinux_2_28_aarch64.whl CPython 3.11 abi3 Linux glibc 2.28+ ARM64 Details for matscikit-0.1.0b1-cp311-abi3-manylinux_2_28_aarch64.whl
matscikit-0.1.0b1-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for matscikit-0.1.0b1-cp311-abi3-macosx_11_0_arm64.whl

Total release size: 37.1 MB

Release files / matscikit-0.1.0b1.tar.gz

Download URL matscikit-0.1.0b1.tar.gz
Size 2.4 MB
Tags Source
SHA-256 checksum
How to use checksums
d842a6ba7666cf4748a243d4cbeda061cbacf30d4654f5fe2dd56b8b54d97d2a
BLAKE2b-256 checksum
How to use checksums
ff1ba24678154941d13d780b47a02017c365daad15ea06ac4dd202c7c2af48bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / matscikit-0.1.0b1-cp311-abi3-win_amd64.whl

Download URL matscikit-0.1.0b1-cp311-abi3-win_amd64.whl
Size 9.5 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
feab7da56d929af279f4ad5ee8054454a14ce17b8ac2d6cd6181358c623a866b
BLAKE2b-256 checksum
How to use checksums
517f4ed7cec3e3cb5d0a6fac6b2cd8162d6ad79fe74789370d36a1e7026c15f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / matscikit-0.1.0b1-cp311-abi3-manylinux_2_28_x86_64.whl

Download URL matscikit-0.1.0b1-cp311-abi3-manylinux_2_28_x86_64.whl
Size 9.2 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
f2c0aee4fa1d0084e0676fbba48aafbc47da7a742fdc185739212038af8edbca
BLAKE2b-256 checksum
How to use checksums
233e0b24808ff1aad48b7a7e8dd121b6da469002b192dbc24a4bbf09ae9d7ba7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / matscikit-0.1.0b1-cp311-abi3-manylinux_2_28_aarch64.whl

Download URL matscikit-0.1.0b1-cp311-abi3-manylinux_2_28_aarch64.whl
Size 8.1 MB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
f3f24548f17d3ef585b00ec2550073b8af2167f55f3865fd81835818d62e949f
BLAKE2b-256 checksum
How to use checksums
394477696106365fd4aa92874e7544fe94a10fd7999e73661973ff2c6d50028b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / matscikit-0.1.0b1-cp311-abi3-macosx_11_0_arm64.whl

Download URL matscikit-0.1.0b1-cp311-abi3-macosx_11_0_arm64.whl
Size 7.8 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a44a011c1f0b10392fdb05b95929e9940891a2ac3ce7b7d1533312765fe88b51
BLAKE2b-256 checksum
How to use checksums
c817efcbd5e8798009355fe7059a51768acc27cc36ed1349c879dada43082a8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for matscikit 0.1.0b1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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