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.0b2

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.0b2
File Size Uploaded Provenance Actions
matscikit-0.1.0b2.tar.gz 2.5 MB Without provenance Details for matscikit-0.1.0b2.tar.gz

Built distributions (wheels)

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

Total release size: 37.6 MB

Release files / matscikit-0.1.0b2.tar.gz

Download URL matscikit-0.1.0b2.tar.gz
Size 2.5 MB
Tags Source
SHA-256 checksum
How to use checksums
bf470890ab701102fb13fb01f72e0652bcf8ef467160ec12eca64ceb532881f8
BLAKE2b-256 checksum
How to use checksums
d6418a8741191fd91d8472e32cbe67fbe0bee2015c27324dc5a8aa20709f93cf
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.0b2-cp311-abi3-win_amd64.whl

Download URL matscikit-0.1.0b2-cp311-abi3-win_amd64.whl
Size 9.6 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
f590002c985113d911197cf323b84ac8386b4905d35f7ebedac19503942dfc8b
BLAKE2b-256 checksum
How to use checksums
df83f0cf458a5930ef6f514ab93fad68409c54a9cdf537d8d3f94db766ff2bc3
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.0b2-cp311-abi3-manylinux_2_28_x86_64.whl

Download URL matscikit-0.1.0b2-cp311-abi3-manylinux_2_28_x86_64.whl
Size 9.3 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
bfd78bf871b7dde608ab58a9d599a4ec0e3df8fd0cedd98eafb011987c266243
BLAKE2b-256 checksum
How to use checksums
915857b631e9c2a13de60b6b9e7bab6a021ffcafdc0bc0849a476632bd176632
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.0b2-cp311-abi3-manylinux_2_28_aarch64.whl

Download URL matscikit-0.1.0b2-cp311-abi3-manylinux_2_28_aarch64.whl
Size 8.2 MB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
055ac4a5b8db95bf87ebf36906dfc0ff5b9e1e06f30b9516b34706c30a83e299
BLAKE2b-256 checksum
How to use checksums
451c0e7d3ce06680467b284ec4972cbddd9652b0cd6c77541899c2002833573f
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.0b2-cp311-abi3-macosx_11_0_arm64.whl

Download URL matscikit-0.1.0b2-cp311-abi3-macosx_11_0_arm64.whl
Size 7.9 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0986fc0e409e59b8bb3cc13b6408d9ada3c283550e2ffbac5b3374a6fa211b28
BLAKE2b-256 checksum
How to use checksums
a8be6a41da0cd687698f04b9a8847e08b4b16e41c8891c2b0a7cd227fcd95f41
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.0b2

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