Skip to content

stb-mlrelax

ML Pre-Relaxation · menu code 1.7 · guide: 1.7 ML Pre-Relaxation

usage: stb-mlrelax [-h] -f FILENAME [--relax-cell] [--vacuum-gap VACUUM_GAP]
                   [--model {small,medium,large}] [--custom-model PATH]
                   [--custom-model-card JSON] [--fmax FMAX] [--max-steps MAX_STEPS]
                   [--optimizer {FIRE,BFGS,LBFGS}] [--device {cpu,cuda}] [-o OUTPUT]
                   [--save-data] [--view] [-v] [--no-intro]

Fast ML pre-relaxation with the MACE-MP-0 foundation potential.
Cleans up obviously-wrong geometry (bad lattice guesses, freshly-added
defect/passivant atoms at the wrong bond length) cheaply, so a follow-up
SIESTA relaxation starts much closer to its own equilibrium and needs far
fewer ionic steps. This is a pre-relaxation heuristic, NOT a substitute for
a real DFT relaxation -- universal MLIPs are trained mostly on
Materials-Project-like inorganic crystals and are less reliable far from
that distribution.

options:
  -h, --help            show this help message and exit
  -f FILENAME, --file FILENAME
                        Path to the input structure file (.fdf).
  --relax-cell          Also relax the lattice, not just atomic positions. Automatically adapts to the structure's periodicity: for a slab/wire (vacuum-padded axes, e.g. from stb-slab), only the genuinely periodic direction(s) relax and the vacuum thickness is held exactly fixed -- relaxing stress along a vacuum direction would be physically meaningless. A fully isolated structure (vacuum in all 3 directions, e.g. a molecule) has nothing to relax; --relax-cell is ignored.
  --vacuum-gap VACUUM_GAP
                        Gap (Ang) used to detect vacuum-padded axes for --relax-cell (default: 10.0, matches stb-kgrid).
  --model {small,medium,large}
                        MACE-MP-0 model size: speed/accuracy tradeoff (default: medium). Ignored if --custom-model is given.
  --custom-model PATH   Use a custom MACE model file instead of the MACE-MP-0 foundation potential -- e.g. one fine-tuned on your own SIESTA data via stb-mlffAnalysis. Overrides --model.
  --custom-model-card JSON
                        Model card of the --custom-model file: the mlff_model_card.json that stb-mlffAnalysis wrote next to it (training data, level of theory, accuracy, energy scale). Required with --custom-model -- the card is checked against the model file and used to warn when a structure is outside what the model was trained on.
  --fmax FMAX           Force convergence threshold, eV/Ang (default: 0.05).
  --max-steps MAX_STEPS
                        Maximum optimizer steps (default: 200).
  --optimizer {FIRE,BFGS,LBFGS}
                        ASE optimizer to use (default: FIRE).
  --device {cpu,cuda}   Device to run the model on (default: cpu).
  -o OUTPUT, --output OUTPUT
                        Output .fdf file name (default: relaxed.fdf).
  --save-data           Also write the raw per-step relaxation convergence trace (<stem>_relax_convergence.dat). Off by default.
  --view                Open an interactive 3D view (via ASE) comparing the structure before and after relaxation (page through frames in ase-gui). Needs a display. Off by default.
  -v, --version         show program's version number and exit
  --no-intro            Do not show the introduction

Usage examples:
  stb-mlrelax -f defect.fdf
  stb-mlrelax -f bulk.fdf --relax-cell -o bulk_relaxed.fdf
  stb-mlrelax -f slab2d.fdf --relax-cell -o slab2d_relaxed.fdf
  stb-mlrelax -f defect.fdf --save-data --view

Note: an initial guess that's very far from equilibrium (e.g. a lattice constant off by 15-20% or more) can occasionally lead a universal MLIP to a spurious low-energy state instead of the real minimum -- sanity-check a large --relax-cell change before trusting it.