Skip to content

stb-mlff

Stage 1 - Prep of the 7.1 Custom ML Force Field (MACE fine-tuning) workflow · menu code 7.1.1

usage: stb-mlff [-h] [-s STRUCTURE] [-c CALC] [--file FILE] [--n-configs N_CONFIGS]
                [--stdev STDEV [STDEV ...]] [--volume-strains PCT [PCT ...]]
                [--pseudo-dir PSEUDO_DIR] [--from-aimd LABEL] [--n-samples N_SAMPLES]
                [--n-test N_TEST] [-o OUTPUT_DIR] [--workflow JSON] [--seed SEED]
                [--d3] [--ml-screen] [--ml-model ML_MODEL] [--ml-device {cpu,cuda}]
                [--dup-threshold DUP_THRESHOLD] [--export-traj [FILE]] [--no-plots]
                [--show] [--view] [--no-intro] [-v]

Stage 1 (Prep) of the Custom ML Force Field workflow: generates training configurations (rattled displacements and/or AIMD-sampled snapshots) from a reference SIESTA calculation, ready for the user to run through SIESTA, plus an optional held-out test set (--n-test). Creates mlff_workflow.json, through which the next stages -- Train (stb-mlffAnalysis), Validate (stb-mlffValidate), Active learning (stb-mlffActiveLearning) -- find what the earlier ones did.

options:
  -h, --help            show this help message and exit
  -s STRUCTURE, --structure STRUCTURE
                        Reference structure (default: structure.fdf): lattice, species and coordinates, rewritten in every generated configuration.
  -c CALC, --calc CALC  Calculation template (default: calc.fdf), with '%include <structure>' and the basis/mesh cutoff/SCF settings, copied verbatim into every folder (a single-point config_extra.fdf is %included on top).
  --file FILE           Instead of -s/-c: one self-contained reference .fdf (structure and settings in the same file), reused verbatim with new coordinates.
  --n-configs N_CONFIGS
                        Number of rattled configurations to generate (default: 10). Ignored if --from-aimd is given without also wanting rattled configs (see --n-configs 0 to disable rattling entirely).
  --stdev STDEV [STDEV ...]
                        One or more rattling displacement standard deviations, in Angstrom (default: 0.05). Cycled round-robin across --n-configs.
  --volume-strains PCT [PCT ...]
                        Also write one configuration per volumetric strain, in % (e.g. -5 -3 -1 1 3 5): the cell scaled isotropically by (1 + PCT/100)^(1/3), atoms rattled with --stdev. Without them every configuration has the reference volume and the fitted model cannot learn the volume response (E(V), bulk modulus, pressure). Default: none. Bulk only -- in a slab this also scales the vacuum.
  --pseudo-dir PSEUDO_DIR
                        Pseudopotentials source: a bundled bank (dojo[-sr|-fr|-sr3plus][-pbe|-pbesol|-pw][-standard|-stringent], virtual_vault) or a folder with <element>.psf/.psml (default: current directory).
  --from-aimd LABEL     Also sample starting geometries from an existing AIMD trajectory ('<LABEL>.ANI' + '.out'), in addition to (or instead of, with --n-configs 0) rattled configurations -- more physically realistic diversity than rattling alone.
  --n-samples N_SAMPLES
                        Number of evenly-spaced AIMD frames to sample when --from-aimd is given (default: 5).
  --n-test N_TEST       Also write N held-out test configurations to mlff_test/test_NNN/ (default: 0): drawn like the training ones (each --stdev, each --volume-strains entry, cycled) with an independent seed, never trained on. Stage 3 (stb-mlffValidate) scores every round against them -- needed to know when to stop.
  -o OUTPUT_DIR, --output-dir OUTPUT_DIR
                        Run folder (default: mlff_runs): the training configs go to <run>/configs_round_01/mlff_config_NNN/ (they train round 1; Stage 4's picks go to configs_round_02/, ...), the test set to <run>/mlff_test/, plus the workflow file and the next stages' round_NN/ folders.
  --workflow JSON       Workflow state file shared by the 4 stages (default: <output-dir>/mlff_workflow.json). Created here; an existing one is copied to .bak first.
  --seed SEED           Random seed for rattling (default: 42).
  --d3                  Add Grimme's DFT-D3 dispersion correction (SIESTA's DFTD3 .true., its own defaults) to every folder's config_extra.fdf, so the labels -- and the model -- are PBE+D3. Recorded in the workflow file: Stage 4's picks and Stage 3's --md-check frames get it too, and Stage 2 checks every folder has it. For vdW-bonded systems (layers, molecular crystals, physisorption). Default: whatever the template says (off if nothing).
  --ml-screen           Before any SIESTA run, evaluate every config with a MACE-MP foundation model (needs the 'ml' extra): its max force and energy above the reference flag unphysical geometries, and show how far off the base model starts. Informational only -- nothing is filtered.
  --ml-model ML_MODEL   Model for --ml-screen: small/medium/large or a .model file (default: medium).
  --ml-device {cpu,cuda}
                        Device for --ml-screen (default: cpu).
  --dup-threshold DUP_THRESHOLD
                        Flag a config whose atomic environments are all closer than this to an earlier one (units of the set's typical spacing; default: 0.25; 0 disables).
  --export-traj [FILE]  Also write reference + every config as one multi-frame file in the run folder (default name: mlff_configs.xsf; .xsf, .pdb or .xyz -- extended XYZ carrying folder/set/kind per frame), e.g. for VESTA/OVITO.
  --no-plots            Do not write the coverage plots (gnuplot .dat + .gplot in <run folder>/coverage/).
  --show                Also display the coverage figure on screen (it is always saved as <run folder>/coverage/mlff_coverage.png, unless --no-plots).
  --view                Open the written configurations in ASE's interactive viewer (frame 0 = reference, then training, then test configs, in the report's order). Needs a display.
  --no-intro            Do not show the introduction
  -v, --version         show program's version number and exit

Example usage:
  stb-mlff -s structure.fdf -c calc.fdf --n-configs 10 --stdev 0.05 0.1
  stb-mlff --n-configs 30 --stdev 0.05 0.1 --volume-strains -5 -3 -1 1 3 5
  stb-mlff --n-configs 6 --from-aimd aimd --n-samples 6
  stb-mlff --n-configs 30 --stdev 0.05 0.1 --volume-strains -3 3 --n-test 8
  stb-mlff --file si.fdf --n-configs 10     # one self-contained .fdf instead