Skip to main content

MLIP calculators with isolated Python environments

Project description

Rootstock

A proof-of-concept package for running MLIP (Machine Learning Interatomic Potential) calculators in isolated pre-built Python environments, communicating via the i-PI protocol over Unix sockets. Currently deployed on Princeton's Della cluster.

Quick Start

from ase.build import bulk
from rootstock import RootstockCalculator

atoms = bulk("Cu", "fcc", a=3.6) * (5, 5, 5)

with RootstockCalculator(
    cluster="della",
    model="mace",
    checkpoint="medium",
    device="cuda",
) as calc:
    atoms.calc = calc
    print(atoms.get_potential_energy())
    print(atoms.get_forces())

Note: Environments must be pre-built before use. See Administrator Setup.

Installation

pip install rootstock
# or
uv pip install rootstock

API

The model parameter selects the environment family. The optional checkpoint parameter selects specific model weights (defaults to the environment's default if omitted).

# Explicit checkpoint
RootstockCalculator(cluster="della", model="mace", checkpoint="medium")

# Default checkpoint (each environment has a sensible default)
RootstockCalculator(cluster="della", model="uma")

# Custom root path instead of a known cluster
RootstockCalculator(root="/scratch/gpfs/ROSENGROUP/common/rootstock", model="mace")

Available Models

Model Checkpoint Description
mace small MACE-MP-0 small
mace medium (default) MACE-MP-0 medium
chgnet (pretrained) CHGNet pretrained universal model
uma uma-s-1p1 (default) Meta UMA small model (FAIRChem)
tensornet TensorNet-MatPES-PBE-v2025.1-PES (default) TensorNet MatPES PBE (MatGL)

Architecture

Main Process                          Worker Process (subprocess)
+-------------------------+          +-----------------------------+
| RootstockCalculator     |          | Pre-built venv Python       |
| (ASE-compatible)        |          | (mace_env/bin/python)       |
|                         |          |                             |
| server.py (i-PI server) |<-------->| worker.py (i-PI client)     |
| - sends positions       |   Unix   | - receives positions        |
| - receives forces       |  socket  | - calculates forces         |
+-------------------------+          +-----------------------------+

The worker process uses a pre-built virtual environment, providing:

  • Fast startup: No dependency installation at runtime
  • Filesystem compatibility: Works on NFS, Lustre, GPFS
  • Reproducibility: Same environment every time

Directory Structure

{root}/
├── .python/                # uv-managed Python interpreters (portable)
├── environments/           # Environment SOURCE files (*.py with PEP 723)
│   ├── mace_env.py
│   ├── chgnet_env.py
│   ├── uma_env.py
│   └── tensornet_env.py
├── envs/                   # Pre-built virtual environments
│   ├── mace_env/
│   │   ├── bin/python
│   │   ├── lib/python3.11/site-packages/
│   │   └── env_source.py   # Copy of environment source
│   └── ...
├── home/                   # Fake HOME for build & workers
│   ├── .cache/fairchem/    # FAIRChem weights
│   └── .matgl/             # MatGL weights
└── cache/                  # XDG_CACHE_HOME for well-behaved libs
    ├── mace/
    └── huggingface/

CLI Commands

# Build a pre-built environment
rootstock build <env_name> --root <path> [--models m1,m2] [--force]

# Show status
rootstock status --root <path>

# Register an environment source file
rootstock register <env_file> --root <path>

# List environments
rootstock list --root <path>

Administrator Setup

Environments must be pre-built before users can run calculations.

1. Create Directory Structure

mkdir -p /scratch/gpfs/ROSENGROUP/common/rootstock/{environments,envs,cache,home}

2. Register Environment Source Files

rootstock register environments/mace_env.py --root /scratch/gpfs/ROSENGROUP/common/rootstock
rootstock register environments/chgnet_env.py --root /scratch/gpfs/ROSENGROUP/common/rootstock
rootstock register environments/uma_env.py --root /scratch/gpfs/ROSENGROUP/common/rootstock
rootstock register environments/tensornet_env.py --root /scratch/gpfs/ROSENGROUP/common/rootstock

3. Build Environments

ROOT=/scratch/gpfs/ROSENGROUP/common/rootstock

rootstock build mace_env --root $ROOT --models small,medium
rootstock build chgnet_env --root $ROOT
rootstock build uma_env --root $ROOT --models uma-s-1p1
rootstock build tensornet_env --root $ROOT

# Verify
rootstock status --root $ROOT

Local Development

uv venv && source .venv/bin/activate
uv pip install -e ".[dev]"
ruff check rootstock/
ruff format rootstock/

Project details


Download files

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

Source Distribution

rootstock-0.5.1.tar.gz (237.4 kB view details)

Uploaded Source

Built Distribution

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

rootstock-0.5.1-py3-none-any.whl (24.3 kB view details)

Uploaded Python 3

File details

Details for the file rootstock-0.5.1.tar.gz.

File metadata

  • Download URL: rootstock-0.5.1.tar.gz
  • Upload date:
  • Size: 237.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rootstock-0.5.1.tar.gz
Algorithm Hash digest
SHA256 48be0bc70f6cc27010f8a19748dc4454a2c810aa364c4caea550c136d7dac054
MD5 8d383838205f211fa8b007d5c38dd6fd
BLAKE2b-256 26eb2f59ec8f86c32dc01b395f699d23b44c917b1501da48a3e568bb9e245242

See more details on using hashes here.

Provenance

The following attestation bundles were made for rootstock-0.5.1.tar.gz:

Publisher: publish.yml on Garden-AI/rootstock

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

File details

Details for the file rootstock-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: rootstock-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 24.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rootstock-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e332e720164b793484a693679b136ad50f7403470f1d7c466e0e3d2e989a5f89
MD5 3bcf597ca10d72d42f9d1e3d8a6cbac1
BLAKE2b-256 ff846d55301b19e8d2f9b81a03497c7c7223b3e2ae8fbe22c6b2b8365e1eb5ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for rootstock-0.5.1-py3-none-any.whl:

Publisher: publish.yml on Garden-AI/rootstock

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

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page