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
nameattribute selects the registered model class (case-insensitively); the whole config is passed to that class’sfrom_config.- Returns:
The model instance built by the selected class’s
from_config. When the config’sextracarries a"dispersion"entry (a dict withname: d4(default) orname: d3plus the options ofDFTD4/DFTD3, orTruefor the PBE0-D4 defaults), the model is wrapped with the dispersion correction (D4DispersionorD3Dispersion); when it carries a"long_range"entry (a dict ofLatentEwaldoptions, orTruefor 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:
- Raises:
KeyError – If
cfg.namedoes not match any registered model.