stb-fetch¶
Structure Fetcher · menu code 1.6 · guide: 1.6 Structure Fetcher
usage: stb-fetch [-h] [--source {materials-project,cod,optimade}]
[--material-id MATERIAL_ID | --cod-id COD_ID | --optimade-id OPTIMADE_ID | --formula FORMULA]
[--most-stable] [--api-key API_KEY] [--provider PROVIDER]
[--list-providers] [--limit LIMIT]
[--unitcell {primitive,conventional,refined}] [--symprec SYMPREC]
[--angle-tolerance ANGLE_TOLERANCE] [-o OUTPUT] [--view] [-v]
[--no-intro]
Fetches a structure from an online database and writes it as .fdf.
Look it up by exact id, or search by formula and pick a candidate.
options:
-h, --help show this help message and exit
--source {materials-project,cod,optimade}
Database to query. Required unless --list-providers is given.
--material-id MATERIAL_ID
Exact Materials Project id (e.g. 'mp-19306'). materials-project only.
--cod-id COD_ID Exact Crystallography Open Database numeric id. cod only.
--optimade-id OPTIMADE_ID
Exact id within the chosen --provider. optimade only.
--formula FORMULA Search by chemical formula (e.g. 'Fe3O4'). Works with any source; prints a candidate table if more than one match is found.
--most-stable With --formula on materials-project, auto-pick the candidate with the lowest energy above hull instead of requiring an explicit --material-id. Not available for --source cod/optimade (no DFT energy to rank by).
--api-key API_KEY Materials Project API key. Default: the PMG_MAPI_KEY environment variable / pymatgen's own settings file.
--provider PROVIDER OPTIMADE provider: an alias (see --list-providers for a curated subset; any alias from pymatgen's own OptimadeRester.aliases also works) or a raw OPTIMADE base URL. Required with --source optimade.
--list-providers Print a curated list of OPTIMADE providers and exit. Does not require --source or a selection flag.
--limit LIMIT Cap on how many --formula candidates to display (default: 20).
--unitcell {primitive,conventional,refined}
Also reduce the fetched structure to its primitive/conventional/refined unit cell (same logic as stb-unitcell) before writing. Default: keep the structure exactly as fetched.
--symprec SYMPREC Symmetry precision, used for the fetched structure's space group summary and for --unitcell (default: 0.01, pymatgen's own default, matches stb-unitcell/stb-symmetry).
--angle-tolerance ANGLE_TOLERANCE
Symmetry angle tolerance in degrees, used the same way as --symprec (default: 5.0, pymatgen's own default).
-o OUTPUT, --output OUTPUT
Output .fdf file name (default: fetched.fdf).
--view Open an interactive 3D view of the structure (via ASE) after writing the .fdf. 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-fetch --source cod --cod-id 1010369
stb-fetch --source cod --formula 'Fe3O4'
stb-fetch --source materials-project --material-id mp-19306
stb-fetch --source materials-project --formula Fe3O4 --most-stable
stb-fetch --source optimade --provider twodmatpedia --formula MoS2
stb-fetch --source optimade --provider twodmatpedia --optimade-id 2dm-2127
stb-fetch --source cod --cod-id 1010369 --unitcell primitive
stb-fetch --list-providers