Skip to main content

Overview

The mlip_arena.models module exposes three top-level objects that provide a unified interface to all registered machine learning interatomic potential (MLIP) models:
  • REGISTRY — raw dict loaded from registry.yaml
  • MLIPMap — dict mapping model names to their Python classes
  • MLIPEnum — an Enum built from MLIPMap for safe, enumerable model references
  • MLIP — the base class all native MLIP models inherit from

MLIPEnum

MLIPEnum is a Python Enum whose members are the successfully-imported MLIP model classes. It is built at import time from MLIPMap.

Iterating over all models

Accessing a model by name

Members

Members are populated at runtime from the registry. Any model whose package is not installed is silently skipped with a warning. The full set of registered models is:
Only models whose Python packages are installed in the current environment will appear as members of MLIPEnum. Missing packages produce a warning log and are skipped.

MLIPMap

MLIPMap is the plain dict from which MLIPEnum is built. Keys are model name strings; values are the corresponding Python classes.
You can use MLIPMap directly when you need a dict interface (e.g. programmatic selection, serialization).

MLIP

Inheritance

MLIP inherits from both torch.nn.Module and huggingface_hub.PyTorchModelHubMixin, and is registered with the HuggingFace Hub tags ["atomistic-simulation", "MLIP"].

Constructor

torch.nn.Module
required
The underlying PyTorch model to wrap. Stored as self.model.

from_pretrained

Class method inherited from PyTorchModelHubMixin. Downloads and instantiates a model from the HuggingFace Hub or a local path.
string | Path
required
HuggingFace Hub model ID (e.g. "atomind/mace-mp") or local directory path.
boolean
default:"false"
Re-download files even if they already exist in the cache.
boolean | None
default:"None"
Resume an incomplete download. None uses the hub’s default behaviour.
dict | None
default:"None"
Dict of proxies for HTTP/HTTPS requests, passed to requests.
string | boolean | None
default:"None"
HuggingFace authentication token. Pass True to use the cached token from huggingface-cli login.
string | Path | None
default:"None"
Override the default HuggingFace cache directory.
boolean
default:"false"
If True, only use locally cached files and raise an error if none exist.
string | None
default:"None"
Git revision (branch, tag, or commit hash) to pull from the Hub.
dict
Additional keyword arguments forwarded to the model’s __init__.
MLIP
An instantiated MLIP subclass loaded from the specified source.

forward

Delegates to self.model(x). Subclasses override this to handle graph construction and model-specific preprocessing.
Any
required
Model input. For MLIPCalculator subclasses this is a batched graph data object created by collate_fn.
Any
Raw output from the underlying model. Subclasses typically return a dict with keys energy, forces, and stress.

Code examples

Check which models are available

Instantiate a model by name

Conditional dispatch based on model