Configuration#
One schema#
All configuration funnels into a single dataclass tree
(xnn.common.config.schema):
Section |
Field |
Default / meaning |
|---|---|---|
|
|
the three sections below |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dict of model-specific options (see Models) |
|
|
|
structure files (read with ASE by the CLI); |
|
synchronized to |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
When loading from a file, any model key that is not a core
ModelConfig field is folded into model.extra, so model options are
written flat.
Frontends#
from xnn.common.config import (
Config, from_dict, from_yaml, from_argparse, from_hydra,
apply_overrides,
)
cfg = Config() # pure Python
cfg = from_yaml("configs/train.yaml") # YAML
cfg = from_argparse(["--config", "configs/train.yaml",
"--set", "model.cutoff=6.0"]) # CLI-style
cfg = from_hydra(dict_config) # Hydra / OmegaConf
apply_overrides(cfg, {"optim.epochs": 50}) applies dotted-key overrides
to an existing config; --set KEY=VALUE (repeatable) does the same from
the command line.
Bundled configs#
The repository ships composable templates:
configs/
train.yaml top-level training config (Hydra-style defaults list)
data/default.yaml
model/{mace,nequip,allegro,cace,schnet,physnet,hdnnp,ani,bamboo,reaxff,opls}.yaml
Upstream key translation#
Model keys copied verbatim from an upstream code’s YAML also work: a
per-model key-translation registry
(xnn.common.config.translate) rewrites foreign spellings (MACE-CLI
r_max / num_radial_basis / atomic_numbers / E0s, NequIP
num_layers, …) to the xnn canonical names at load time. The xnn
spelling wins if both are given. See Reuse Upstream MACE/NequIP Configs.