Skip to content

stb-defect

Point Defect Generator · menu code 4.5 · guide: 4.5 Point Defect Generator

usage: stb-defect [-h] -f FILENAME --type {vacancy,substitution,interstitial}
                  [--index INDEX | --nearest X Y Z | --all-inequivalent-sites]
                  [--nearest-format {fractional,cartesian}]
                  [--filter-species FILTER_SPECIES] [--symprec SYMPREC] [--ml-rank]
                  [--new-species NEW_SPECIES] [--position X Y Z]
                  [--position-format {fractional,cartesian}] [--species SPECIES]
                  [--ml-relax] [--ml-relax-cell] [--model {small,medium,large}]
                  [--custom-model PATH] [--custom-model-card JSON]
                  [--device {cpu,cuda}] [--view] [-o OUTPUT] [-v] [--no-intro]

Introduces a point defect (vacancy, substitution, interstitial) into a SIESTA FDF structure.
Select the site by raw atom index, by the position closest to a target, or
automatically at every symmetrically distinct site.

options:
  -h, --help            show this help message and exit
  -f FILENAME, --file FILENAME
                        Path to the input structure file (.fdf).
  --type {vacancy,substitution,interstitial}
                        Defect type to introduce.
  --index INDEX         Comma-separated 1-indexed atom(s) to remove/substitute, e.g. '3,7'.
  --nearest X Y Z       Selects the atom closest to this position (vacancy/substitution).
  --all-inequivalent-sites
                        Generate one output structure per symmetrically distinct site (via spglib), instead of a single combined structure -- e.g. to compare defect formation energies across all inequivalent sites rather than picking one by hand. Writes '<output>_site<N>.fdf' per site instead of a single --output file. Narrow to one species with --filter-species.
  --nearest-format {fractional,cartesian}
                        How to interpret --nearest. Default: fractional.
  --filter-species FILTER_SPECIES
                        Restrict --nearest's or --all-inequivalent-sites' search to atoms of this element.
  --symprec SYMPREC     Symmetry precision for --all-inequivalent-sites and the before/after symmetry table (default: 0.01, pymatgen's own default, matches stb-symmetry/stb-unitcell).
  --ml-rank             Only valid with --all-inequivalent-sites. Quickly relaxes each candidate site's local geometry (positions only) with a MACE potential (needs the optional 'ml' extra: pip install stb_suite[ml]), then prints them ranked by relaxed energy -- a fast pre-screen for which site is most likely favorable, before spending DFT time on all of them. Overwrites each site's output file with its relaxed geometry. This is a relative comparison from a fast ML potential, not an absolute DFT formation energy. Mutually exclusive with --ml-relax (which already relaxes every output structure, just without the ranking table).
  --new-species NEW_SPECIES
                        Replacement element symbol (required for --type substitution).
  --position X Y Z      Position of the new atom (required for --type interstitial).
  --position-format {fractional,cartesian}
                        How to interpret --position. Default: fractional.
  --species SPECIES     Element symbol of the new atom (required for --type interstitial).
  --ml-relax            Pre-relax every output structure with a MACE potential before writing it out (needs the optional 'ml' extra: pip install stb_suite[ml]) -- positions only by default. Off by default. Mutually exclusive with --ml-rank.
  --ml-relax-cell       With --ml-relax, also relax the cell -- any vacuum-padded axis always stays exactly fixed. Only valid together with --ml-relax.
  --model {small,medium,large}
                        MACE-MP-0 foundation model size for --ml-relax/--ml-rank (default: medium).
  --custom-model PATH   Path to a custom fine-tuned .model file for --ml-relax/--ml-rank, instead of a MACE-MP-0 foundation size.
  --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.
  --device {cpu,cuda}   Device to run the MACE model on (default: cpu).
  --view                Open an interactive 3D view (via ASE) comparing the input structure and every output structure (page through frames in ase-gui) after writing the output file(s). Needs a display. Off by default.
  -o OUTPUT, --output OUTPUT
                        Output .fdf file name (default: defect.fdf).
  -v, --version         show program's version number and exit
  --no-intro            Do not show the introduction

Usage examples:
  stb-defect -f structure.fdf --type vacancy --index 5
  stb-defect -f structure.fdf --type substitution --index 5 --new-species Ge
  stb-defect -f structure.fdf --type vacancy --nearest 0.5 0.5 0.5 --filter-species O
  stb-defect -f structure.fdf --type interstitial --position 0.5 0.5 0.5 --species N
  stb-defect -f structure.fdf --type vacancy --all-inequivalent-sites --filter-species O
  stb-defect -f structure.fdf --type vacancy --index 5 --ml-relax --view