Skip to content

Allegro

Optional dependency

AllegroCalculator requires the allegro extra.

uv add "materialsframework[allegro]"
pip install "materialsframework[allegro]"

AllegroCalculator

AllegroCalculator(
    model: str = "",
    device: Literal["cpu", "cuda"] = "cpu",
    chemical_species_to_atom_type_map: dict[str, str]
    | bool
    | None = True,
    **kwargs: Any,
)

Calculator for material property calculations and structure relaxation using the Allegro potential.

Allegro is a strictly local equivariant model architecture distributed as a plugin for the nequip training and inference framework. Trained models are compiled and loaded through the same ASE interface as NequIPCalculator; installing the nequip-allegro package registers the Allegro model builders with nequip so that compiled Allegro models can be deserialized correctly.

Attributes:

Name Type Description
AVAILABLE_PROPERTIES list[str]

A list of properties that this calculator can compute, including "energy", "forces", and "stress".

References
  • Allegro: https://doi.org/10.1038/s41467-023-36329-y

Initializes the AllegroCalculator with the specified model and calculation settings.

Parameters:

Name Type Description Default
model str

The path to a compiled Allegro model.

''
device Literal['cuda', 'cpu']

The device to use for calculations. Defaults to "cpu".

'cpu'
chemical_species_to_atom_type_map Optional[Union[Dict[str, str], bool]]

A mapping from chemical species to atom types expected by the Allegro model. Defaults to True, which means that the mapping will be automatically inferred from the model.

True
**kwargs Any

Additional keyword arguments passed to the BaseCalculator and BaseMDCalculator constructors.

{}

calculator

calculator() -> Calculator

Lazily builds the ASE Calculator object for the Allegro potential, using the settings from initialization.

Returns:

Name Type Description
Calculator Calculator

The ASE Calculator object configured with the Allegro potential.