xnn.gnn.models.aimnet2_foundation.foundation_to_xnn#

xnn.gnn.models.aimnet2_foundation.foundation_to_xnn(source, dtype=None, cache_dir=None, dispersion=None, **model_options)[source]#

Resolve, load and convert a published AIMNet2 model (the body of AIMNet2.from_foundation()).

A registered name or alias, URL or DOI goes through the model hub (xnn.common.models.from_pretrained()), which converts the artifact once and caches the converted model; a local file or directory is converted on the fly, and an already-loaded artifact mapping directly.

Parameters:
  • source (str, Path or Mapping) – Name / alias / URL / DOI / local path of a checkpoint, or an artifact mapping (see load_artifact()).

  • dtype (torch.dtype or str, optional) – Final dtype; None keeps the checkpoint’s.

  • cache_dir (str or Path, optional) – Model hub cache directory.

  • dispersion (dict, str, bool or None, optional) – None adds the recorded D3(BJ) term, False serves the bare network; see load_pretrained().

  • **model_options – Overrides of the model options (coulomb, lr_cutoff, dsf_alpha, ewald_accuracy, pme_spline_order), applied before the model is built.

Returns:

The potential (bare, or inside its dispersion term), in eval mode.

Return type:

torch.nn.Module

Raises:

TypeError – If source names a model that is not an AIMNet2.