Skip to main content

MatterGraph

PyPI Python License Docs Status

MatterGraph is an open-source SDK and workbench for physics-aware materials workflows.

It helps researchers and developers turn standardized materials datasets into graph-ready, benchmark-ready, and candidate-screening artifacts. MatterGraph is dataset-agnostic and supports multi-source workflows across public materials resources.

LeMaterial is a flagship upstream companion: LeMaterial provides standardized materials datasets; MatterGraph provides the downstream workflow surface for inspection, filtering, graph export, slicing, and evaluation.

It is designed for teams building:

  • materials screening and comparison tools
  • graph-based materials ML models
  • simulation-backed discovery workflows
  • uncertainty-aware engineering decision support

MatterGraph is not a black-box “AI materials scientist.” It is infrastructure for transparent, physics-aware materials workflows.

Why MatterGraph?

Materials data is fragmented across repositories, schemas, units, structures, and property definitions. MatterGraph provides a common, provenance-aware layer for turning raw materials records into normalized, ML-ready, simulation-aware material objects.

What it does

  • Ingest public materials datasets
  • Normalize formulas, structures, units, and properties
  • Convert crystal structures into crystal graph representations
  • Track property provenance and basic confidence
  • Support transparent baseline scorecards with auditable ranking behavior
  • Provide adapters for benchmarking and simulation job specs (e.g. ASE)
  • Expose a small demo API and minimal web UI for end-to-end exploration
  • Inspect, validate, graph, rank, and export small local CSV/JSONL datasets without uploading them

Scope

The public repository focuses on transparent, reusable infrastructure for open materials workflows. Production-specific orchestration, hosting, and organization-specific workflows are out of scope for this demo.

MatterGraph Core focuses on transparent workflow primitives and guardrails. Proprietary ranking, active learning, orchestration, model routing, and customer-specific decision workflows remain private.

Install

pip install mattergraph

That installs the public toolkit without provider-specific SDKs. Opt into only the connector SDKs you need:

pip install 'mattergraph[mp]'       # Materials Project SDK
pip install 'mattergraph[jarvis]'   # JARVIS SDK
pip install 'mattergraph[all]'      # all optional public connector SDKs

Install an individual package for a smaller application surface:

pip install mattergraph-core         # schema, normalization, graphs, scoring
pip install mattergraph-connectors   # NOMAD, OPTIMADE, local data, LeMat-Bulk
pip install mattergraph-sim          # ASE job specs and runners
pip install mattergraph-benchmarks   # metrics and Matbench adapter
pip install mattergraph-api          # FastAPI demo service

Quickstart (from source)

git clone https://github.com/cyrusmo/MatterGraph.git
cd MatterGraph
python3 -m venv .venv
source .venv/bin/activate
pip install uv
uv sync --all-packages --group dev --extra all
# Optional: copy .env.example to .env and set MP_API_KEY for Materials Project
export MATTERGRAPH_DEMO_DATA=data/demo/materials_sample.jsonl
uv run uvicorn mattergraph_api.main:app --reload --host 0.0.0.0 --port 8000

For the deterministic public capability walkthrough, start the API and UI together:

./scripts/run_public_demo.sh

This runs a preflight-checked, checksummed snapshot of 24 real LeMaterial records at http://127.0.0.1:5173 without network calls or API credentials. The snapshot preserves the upstream revision, immutable IDs, license, citation, and field-level provenance.

The UI opens in Guided demo mode. Choose Local workbench to inspect a CSV or JSONL file up to 5 MiB / 5,000 rows. Imported datasets are ephemeral: normalized JSONL remains in memory, the registry is capped at eight entries and 32 MiB, and only the selected dataset is materialized. Imported content is never sent to an external service or written to disk.

Example: rank candidates with a transparent baseline scorecard (pool-relative min–max objectives plus hard constraints).

import json
from pathlib import Path

from mattergraph import Scorecard
from mattergraph_connectors import LeMatBulk

artifact = json.loads(Path("data/demo/spc_real_snapshot.json").read_text())
store = LeMatBulk.from_records(
    artifact["records"], subset="compatible_pbe"
).to_material_store()
scorecard = Scorecard(
    objectives={
        "density": {"direction": "minimize", "weight": 0.6},
        "energy_above_hull": {"direction": "minimize", "weight": 0.4},
    },
    constraints={
        "energy_above_hull": {"max": 0.05},
        "max_force": {"max": 0.2},
    },
)
df = scorecard.rank(store.materials)
print(df.head(10))

Example: turn LeMaterial-style records into a reproducible candidate slice.

import json
from pathlib import Path

from mattergraph_connectors import LeMatBulk

artifact = json.loads(Path("data/demo/spc_real_snapshot.json").read_text())
dataset = LeMatBulk.from_records(artifact["records"], subset="compatible_pbe")

candidate_slice = (
    dataset
    .filter_elements(include=["Ti", "Al", "N"])
    .filter_complexity(max_nsites=16, max_nelements=3)
    .create_slice("spc_tialn_candidates_v1", target="energy_above_hull")
)

print(candidate_slice.report())

Architecture (conceptual)

Raw dataset → MatterGraphDataset / Material → candidate slice / crystal graph / benchmark frame → scorecard or simulation job

Roadmap

High-level ROADMAP.md covers connectors, the unified schema, workflow slicing, graph building, benchmark adapters, simulation interchange, and uncertainty. For the LeMaterial companion layer, see docs/integrations/lematerial.md, and for local data see docs/local-workbench.md.

Packages

Package Role
mattergraph-core Schema, normalization, MatterGraphDataset, CandidateSlice, crystal graphs, transparent Scorecard, MaterialStore
mattergraph-connectors MP, JARVIS, NOMAD public metadata, OPTIMADE, LeMat-Bulk companion adapter, bounded local CSV/JSONL import, OQMD stub
mattergraph-benchmarks Metrics, Matbench-style adapter (optional matbench install)
mattergraph-sim ASE / stub LAMMPS+QE around job specs
mattergraph-api FastAPI demo plus ephemeral local-dataset registry, graph summaries, slicing, audited ranking, export, and labeled CHGNet reference evidence

License

Apache 2.0 — see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mattergraph-0.1.0.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mattergraph-0.1.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file mattergraph-0.1.0.tar.gz.

File metadata

  • Download URL: mattergraph-0.1.0.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mattergraph-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9a15dd55323dcadad6107e0d73fac1110d4a0ab2706310cd9a2572a9d5c5c3d4
MD5 f1ec019b9219e4cde2151d42928b0fe5
BLAKE2b-256 c27bbab9c1f8b72097acdd008849fbd614cf7de03672176290ea702918d73e10

See more details on using hashes here.

Provenance

The following attestation bundles were made for mattergraph-0.1.0.tar.gz:

Publisher: release.yml on cyrusmo/MatterGraph

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mattergraph-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mattergraph-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mattergraph-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8eb0a3067da1124594e47e88820b1253af16ffcef74a85ca7b1f642940883a1c
MD5 65803ed8c732e029baa0802731ba9637
BLAKE2b-256 5c89405c2b668f3415663f36b0987a29c854049c4152d6b817fdc35df126e515

See more details on using hashes here.

Provenance

The following attestation bundles were made for mattergraph-0.1.0-py3-none-any.whl:

Publisher: release.yml on cyrusmo/MatterGraph

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.1.1

2 files

This release

0.1.0 This release

2 files

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