Allegro Equivariant Deep Learning Interatomic Potentials

0.8.2 · active · verified Fri Apr 17

Allegro is an open-source Python library for building highly scalable and accurate equivariant deep learning interatomic potentials, often used in materials science and molecular dynamics. It is currently at version 0.8.2 and sees active development with frequent minor releases and occasional breaking changes in major versions.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to programmatically define and instantiate a basic `AllegroModel` instance. It sets up a minimal configuration dictionary and passes it to the `AllegroModel` constructor. Note that this only builds the model architecture; training or inference requires additional steps using the NequIP framework, including data loading and graph creation.

import torch
from allegro.model import AllegroModel

# Minimal configuration for an Allegro model
# In a real-world scenario, this would often be loaded from a YAML config file.
config = {
    "r_max": 3.0,
    "l_max": 1,
    "parity_l_max": 1,
    "chemical_species": ["H", "O"], # Define the species the model will handle
    "output_keys": {"energy": "total_energy"},
    "avg_num_neighbors": 10.0,
    "num_hidden_layers": 1,
    "layer_l_maxs": [1, 1],
    "feature_irreps_hidden": "16x0e + 16x1o",
    "nonlinearity_type": "gate",
    "cutoff_type": "wigner_d",
    "radial_basis": "gaussian",
    "radial_basis_kwargs": {"max_radial": 10, "num_basis": 8},
    "num_basis_f": 8,
    "embedding_units": 16,
    "num_layers": 1
}

# Create an instance of the Allegro model
# This initializes the model structure, but it is not yet trained.
model = AllegroModel(config)

print("AllegroModel created successfully.")
print(f"Model output irreps: {model.num_irreps_out}")

# Example of forward pass (requires a nequip.data.Graph object)
# For a full example, refer to nequip and allegro documentation
# on creating datasets and training graphs.

view raw JSON →