Skip to main content

Training and evaluating machine learning models for atomistic systems.

Project description

Metatensor logo

tests status documentation coverage

metatrain is a command line interface (CLI) to train and evaluate atomistic models of various architectures. It features a common yaml option inputs to configure training and evaluation. Trained models are exported as standalone files that can be used directly in various molecular dynamics (MD) engines (e.g. ASE, LAMMPS, i-PI, TorchSim, ESPResSo,...) using the metatomic interface.

The idea behind metatrain is to have a general training hub that provides a homogeneous environment and user interface, transforming every ML architecture into an end-to-end model that can be connected to MD engines. Any custom architecture compatible with TorchScript can be integrated into metatrain, gaining automatic access to a training and evaluation interface, as well as compatibility with various MD engines.

List of Implemented Architectures

Currently metatrain supports the following architectures for building an atomistic model:

Name Description
PET Point Edge Transformer (PET), interatomic machine learning potential
SOAP-BPNN A Behler-Parrinello neural network with SOAP features
MACE A higher order equivariant message passing neural network.
GAP Sparse Gaussian Approximation Potential (GAP) using Smooth Overlap of Atomic Positions (SOAP).
FlashMD An architecture for the direct prediction of molecular dynamics

Documentation

For details, tutorials, and examples, please visit our documentation.

Installation

Install metatrain with pip:

pip install metatrain

Install specific models by specifying the model name. For example, to install the SOAP-BPNN model:

pip install metatrain[soap-bpnn]

We also offer a conda installation:

conda install -c conda-forge metatrain

⚠️ The conda installation does not install model-specific dependencies and will only work for architectures without optional dependencies such as PET.

After installation, you can use mtt from the command line to train your models!

Quickstart

To train a model, use the following command:

mtt train options.yaml

Where options.yaml is a configuration file specifying training options. For example, the following configuration trains a SOAP-BPNN model on the QM9 dataset:

# architecture used to train the model
architecture:
  name: soap_bpnn
training:
  num_epochs: 5  # a very short training run

# Mandatory section defining the parameters for system and target data of the training set
training_set:
  systems: "qm9_reduced_100.xyz"  # file where the positions are stored
  targets:
    energy:
      key: "U0"      # name of the target value
      unit: "eV"     # unit of the target value

test_set: 0.1        # 10% of the training_set are randomly split for test
validation_set: 0.1  # 10% of the training_set are randomly split for validation

Shell Completion

metatrain comes with completion definitions for its commands for bash and zsh. You must manually configure your shell to enable completion support.

To make the completions available, source the definitions in your shell’s startup file (e.g., ~/.bash_profile, ~/.zshrc, or ~/.profile):

source $(mtt --shell-completion)

Having problems or ideas?

Having a problem with metatrain? Please let us know by submitting an issue.

Submit new features or bug fixes through a pull request.

Contributors

Thanks goes to all people who make metatrain possible:

Contributors

Citing metatrain

If you found metatrain useful, you can cite its pre-print (https://doi.org/10.48550/arXiv.2508.15704) as

@misc{metatrain,
title = {Metatensor and Metatomic: Foundational Libraries for Interoperable Atomistic
Machine Learning},
shorttitle = {Metatensor and Metatomic},
author = {Bigi, Filippo and Abbott, Joseph W. and Loche, Philip and Mazitov, Arslan
and Tisi, Davide and Langer, Marcel F. and Goscinski, Alexander and Pegolo, Paolo
and Chong, Sanggyu and Goswami, Rohit and Chorna, Sofiia and Kellner, Matthias and
Ceriotti, Michele and Fraux, Guillaume},
year = {2025},
month = aug,
publisher = {arXiv},
doi = {10.48550/arXiv.2508.15704},
}

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

metatrain-2026.2.1.tar.gz (1.8 MB view details)

Uploaded Source

Built Distribution

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

metatrain-2026.2.1-py3-none-any.whl (1.8 MB view details)

Uploaded Python 3

File details

Details for the file metatrain-2026.2.1.tar.gz.

File metadata

  • Download URL: metatrain-2026.2.1.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for metatrain-2026.2.1.tar.gz
Algorithm Hash digest
SHA256 e9a59d399e86fc53215604bbdb9e3afb602b6cd3f71365d03c5779ab67c965cd
MD5 e5de62da7380dff863d36bd44727ae7e
BLAKE2b-256 bb32151ba90009aa231d2bb68bf0dbba1832f22a9841e36d935bb1f442771b74

See more details on using hashes here.

Provenance

The following attestation bundles were made for metatrain-2026.2.1.tar.gz:

Publisher: release.yml on metatensor/metatrain

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

File details

Details for the file metatrain-2026.2.1-py3-none-any.whl.

File metadata

  • Download URL: metatrain-2026.2.1-py3-none-any.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for metatrain-2026.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0cb48e9ea3f082bd4d544eacda98d5e14d6533ab49f793d997812c1642fb4f72
MD5 da1e886a7c91fca084c57ca548e6a268
BLAKE2b-256 bb3753e014f343322ddd75dd8f92c314d334302934786d6511639eec7e3942d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for metatrain-2026.2.1-py3-none-any.whl:

Publisher: release.yml on metatensor/metatrain

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