xnn.gnn.models.tensornet_foundation#

The TensorNet foundation potentials of MatGL, converted weight for weight.

MatGL (BSD-3-Clause) publishes TensorNet potentials trained on MatPES as a directory of model.json (the architecture) and state.pt (the weights). Their architecture is xnn’s TensorNet with three options set: the smooth spherical Bessel radial basis (radial_basis="smooth_bessel"), a gated energy network (readout="gated") and no self pairs (self_pairs=False). The energy is data_std times the network’s sum plus the per-element references, which map onto energy_scale and atom_ref.

TensorNet.from_foundation("tensornet-matpes-pbe-2025.2") downloads a pinned revision into the model cache and converts it; a local directory loads through the model hub’s "matgl" format (xnn.common.models.from_pretrained(path)).

Module Attributes

FOUNDATION_MODELS

name -> (repository, pinned revision).

Functions

build_converted(cls, name, a, extra, n_rbf, ...)

Build cls from converted options in dtype (by default the checkpoint's); returns the model and its ModelConfig.

convert_directory(path[, dtype])

Convert a MatGL TensorNet directory into xnn's TensorNet.

fetch_foundation(name, models[, cache_dir])

Download (once) a registered MatGL potential name of models into the model cache and return its directory.

from_foundation([name, dtype, cache_dir])

Download (once) and convert a registered MatGL TensorNet potential.

potential_options(path, a, state)

The options of a MatGL potential's trunk and energy standardization: activation, symmetry group, species, the energy scale and the element references.

read_matgl_directory(path, model_class)

The parts of a MatGL potential directory whose model is model_class.

transplant(model, state, species, n_layers)

Copy MatGL's weights into model: the same layer names, the embedding rows by atomic number, the 3F outputs of the last scalar layers reordered from per feature to per part.

trunk_options(kwargs, a, unsupported)

The radial basis of a MatGL TensorNet trunk as xnn options, and the number of its functions.