xnn.common.models.registry.build_model#

xnn.common.models.registry.build_model(cfg)[source]#

Instantiate a registered model from a configuration dataclass.

Parameters:

cfg (ModelConfig) – The model configuration. Its name attribute selects the registered model class (case-insensitively); the whole config is passed to that class’s from_config.

Returns:

The model instance built by the selected class’s from_config. When the config’s extra carries a "dispersion" entry (a dict with name: d4 (default) or name: d3 plus the options of DFTD4 / DFTD3, or True for the PBE0-D4 defaults), the model is wrapped with the dispersion correction (D4Dispersion or D3Dispersion); when it carries a "long_range" entry (a dict of LatentEwald options, or True for the defaults), the model is wrapped with the Latent Ewald Summation long-range term. Both may be combined; dispersion is applied first, so LES sees the D4-corrected model’s features (they are passed through unchanged).

Return type:

InteratomicPotential

Raises:

KeyError – If cfg.name does not match any registered model.