Skip to content

stb-adsorb

Stage 1 - Prep of the 5.8 Adsorption workflow · menu code 5.8.1

usage: stb-adsorb [-h] [-s STRUCTURE] [-c CALC] [-p PSEUDO_DIR]
                  [--adsorbate ADSORBATE] [--list]
                  [--site-type {ontop,bridge,hollow,all}] [--site-index SITE_INDEX]
                  [--all-sites] [--position X Y] [--positions-file PATH]
                  [--height HEIGHT] [--height-sweep MIN MAX STEP] [--anchor-atom ATOM]
                  [--optimizer {cg,broyden,fire}] [--force-tol EV_PER_ANG]
                  [--max-displ BOHR] [--fix-layers N] [--layer-tol ANG] [--both-sides]
                  [--symprec SYMPREC] [--force-spin] [--no-force-spin]
                  [--vacuum-gap VACUUM_GAP] [--vacuum-box VACUUM_BOX] [--ml-prerelax]
                  [--ml-rank] [--ml-model {small,medium,large}]
                  [--ml-custom-model PATH] [--ml-custom-model-card JSON]
                  [--ml-device {cpu,cuda}] [--ml-fmax ML_FMAX] [--ml-steps ML_STEPS]
                  [--top-k TOP_K] [--n-orientations-polar N_ORIENTATIONS_POLAR]
                  [--n-orientations-azimuthal N_ORIENTATIONS_AZIMUTHAL]
                  [--orientation-top-k ORIENTATION_TOP_K]
                  [--orientation-rmsd-tol ORIENTATION_RMSD_TOL] [-O OUTPUT_DIR]
                  [--view] [--view-plots] [-v] [--no-intro]

Prepares SIESTA folders for an adsorption-energy study: a clean slab/2D material, an isolated adsorbate, and one folder per candidate adsorption site.

options:
  -h, --help            show this help message and exit
  -s STRUCTURE, --structure STRUCTURE
                        Input slab/2D structure.fdf (vacuum along c). Default: structure.fdf.
  -c CALC, --calc CALC  calc.fdf template already configured for the slab (kgrid, basis, XC, %include structure.fdf, etc.) -- copied as-is into 'clean_slab/' and every 'sites/site_*/' folder (same lattice, so the same k-grid applies to all of them); a Gamma-only, spin-polarized derivative goes into 'adsorbate/'. A config_extra.fdf sidecar is %included on top, forcing MD.VariableCell false (see [1]/[4] in the report). Default: calc.fdf.
  -p PSEUDO_DIR, --pseudo-dir PSEUDO_DIR
                        Pseudopotentials source (optional): a bundled bank or a folder path.
  --adsorbate ADSORBATE
                        Element symbol (single atom) or ASE G2 molecule name (e.g. H2O, CO2, CH4). Comma-separated for more than one (e.g. 'O,N,C') -- the same site search runs once per adsorbate, useful for comparing binding affinity across species at the same site(s).
  --list                List the available G2 molecule names and exit.
  --site-type {ontop,bridge,hollow,all}
                        Which family of adsorption sites to search (default: ontop).
  --site-index SITE_INDEX
                        Which symmetrically distinct site of --site-type to use, 0-based (default: 0). Ignored with --all-sites or --position.
  --all-sites           Write one folder per symmetrically distinct site of --site-type, instead of just --site-index.
  --position X Y        Manual Cartesian (X, Y) position in Ang, overriding automatic site-finding entirely (--site-type/--site-index/--all-sites are ignored when this is given).
  --positions-file PATH
                        '.dat' file with one or more adsorption site positions, as in-plane fractional (a, b) coordinates relative to the file's own LATTICE_A/LATTICE_B/LATTICE_C lines ('number type frac_a frac_b' per site line; '#' comments and blank lines ignored) -- used INSTEAD of automatic site-finding (--site-type/--symprec are ignored). --all-sites/--site-index then select among the file's positions exactly as they would among auto-found ones. stb-adsorb always writes 'sites/site_positions.dat' with the lattice and positions actually used this run (auto-found or manual alike), in the same format, so it can be inspected, hand-edited, and fed back here for a future run. Mutually exclusive with --position and --both-sides.
  --height HEIGHT       Adsorption distance in Ang above the surface (default: 2.0). Ignored if --height-sweep is given.
  --height-sweep MIN MAX STEP
                        Generate one site per height in this range (inclusive), instead of a single fixed --height -- an approach-curve scan. stb-adsorbAnalysis will report E_ads vs. height for it. Same min/max/step convention as stb-convergence. Incompatible with --both-sides.
  --anchor-atom ATOM    For a molecular adsorbate: the atom that faces the surface, as an element symbol (when the molecule has one atom of it: O for H2O, C for CO) or an atom number (1-based, in the molecule's own order). The molecule is turned so that this atom is the lowest one, the rest pointing away from the surface, and --height is then the height of THIS atom above the site. Default: the molecule as the G2 database stores it (H2O: hydrogens towards the surface), its origin at --height. With --ml-rank orientation sampling it only sets the starting orientation the samples are rotated from.
  --optimizer {cg,broyden,fire}
                        Geometry optimizer written into every folder's config_extra.fdf (MD.TypeOfRun CG / Broyden / FIRE). Default: whatever --calc sets. A weakly bound molecule on a metal is ill-conditioned for SIESTA's CG -- stiff bonds next to almost free translations and rotations: H2O on Ag(111) was still at 0.03-1.3 eV/Ang after 130-146 CG steps. Try 'fire' or 'broyden' there, with a small --max-displ.
  --force-tol EV_PER_ANG
                        Force tolerance of the relaxations, MD.MaxForceTol in eV/Ang (default: --calc's own). 0.02 is a usual value; a flat energy surface (physisorbed molecule) may need 0.03-0.05 to finish at all.
  --max-displ BOHR      Largest atomic displacement per step, MD.MaxDispl in Bohr (default: --calc's own, i.e. SIESTA's 0.2). About 0.05 keeps a molecular adsorbate from overshooting.
  --fix-layers N        Hold the N lowest atomic layers of the slab fixed at their input (bulk-like) positions, in clean_slab/ and in every site folder alike: a %block Geometry.Constraints in each config_extra.fdf. The adsorbate goes on the top (+c) face. Default 0: the whole slab relaxes. The usual choice is the lower half of the layers.
  --layer-tol ANG       With --fix-layers: atoms whose heights differ by less than this are one atomic layer (default: 0.1 Ang, as in stb-slab).
  --both-sides          Adsorb on both exposed faces (for a free-standing 2D material with vacuum on both sides of the c-axis). Requires a concrete --site-type (not 'all'); incompatible with --position, --ml-rank and --height-sweep.
  --symprec SYMPREC     Symmetry-reduction tolerance for site-finding (default: 0.01, pymatgen's own default).
  --force-spin          Force Spin polarized (via config_extra.fdf, overriding --calc's own Spin tag if any) in every 'sites/site_*/' folder too, not just the isolated-adsorbate reference (default: ON) -- a single adsorbate atom (or a molecule containing one) bonded to a slab commonly leaves the combined system with a net magnetic moment (most simply, an odd total valence-electron count, which a spin-restricted calculation cannot represent at all). Costs nothing for a genuinely closed-shell site (converges to zero moment). Does not affect 'clean_slab/' (no adsorbate present).
  --no-force-spin       Leave --calc's own Spin tag untouched in 'sites/site_*/' (the isolated-adsorbate reference is still always forced polarized).
  --vacuum-gap VACUUM_GAP
                        Vacuum-axis detection threshold in Ang, used to validate the input's vacuum axis is c (default: 10.0), same convention as stb-kgrid/stb-slab.
  --vacuum-box VACUUM_BOX
                        Cubic box side (Ang) for the isolated-adsorbate reference calculation (default: 20.0).
  --ml-prerelax         Relax the isolated adsorbate's geometry (positions only) with MACE-MP-0 before writing its reference folder -- same idea as stb-phononsCreate --ml-prerelax. Mainly useful for adsorbates whose starting geometry isn't already at equilibrium (e.g. a hand-built one rather than an ASE G2 entry, which already is). Needs the optional 'ml' extra.
  --ml-rank             Pre-screen candidate sites with a MACE-MP-0 relax (substrate fixed, only the adsorbate moves) before writing SIESTA folders, ranking by relaxed energy -- a fast pre-screen for which site(s) to prioritize for real DFT, not a replacement for stb-adsorbAnalysis. Needs the optional 'ml' extra. Only valid with --all-sites.
  --ml-model {small,medium,large}
                        MACE-MP-0 model size for --ml-prerelax/--ml-rank: speed/accuracy tradeoff (default: medium). Ignored if --ml-custom-model is given.
  --ml-custom-model PATH
                        Use a custom MACE model file for --ml-prerelax/--ml-rank instead of the MACE-MP-0 foundation potential -- e.g. one fine-tuned on your own SIESTA data via stb-mlffAnalysis. Overrides --ml-model.
  --ml-custom-model-card JSON
                        Model card of the --ml-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 --ml-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.
  --ml-device {cpu,cuda}
  --ml-fmax ML_FMAX
  --ml-steps ML_STEPS   Max MACE-MP-0 optimizer steps per relax, for both --ml-prerelax and --ml-rank (default: 200). Raise it if a candidate is reported as not converged; lower it to speed up screening a large number of sites/orientations at the cost of less-relaxed rankings.
  --top-k TOP_K         With --ml-rank: only write SIESTA folders for the N best-ranked sites, instead of all of them. Counts SITES, not orientations -- if orientation sampling is also on, every already --orientation-top-k-kept orientation of each of the N selected sites is written, so the number of folders can exceed N.
  --n-orientations-polar N_ORIENTATIONS_POLAR
                        With --ml-rank and a multi-atom --adsorbate: systematically sample this many initial molecule orientations PER SITE before relaxing -- which part of the molecule ends up facing the surface (e.g. O-down vs. H-down for H2O) is otherwise fixed by the molecule's default G2 geometry alone. Default 1 = current behavior, no sampling. Combined with --n-orientations-azimuthal below (total orientations per site = polar x azimuthal); a modest 4x2=8 is a reasonable starting point -- cost scales linearly with this product (one full MACE relax per orientation per site). Works with a single --site-index too, not just --all-sites -- every sampled orientation of the SAME site is then what gets ranked. Every relaxed orientation (not just the kept/unique ones) is saved to sites/orientation_trajectory.xyz as a multi-frame trajectory (viewable in VMD/OVITO).
  --n-orientations-azimuthal N_ORIENTATIONS_AZIMUTHAL
                        With --ml-rank: this many evenly-spaced in-plane rotations sampled per polar direction (see --n-orientations-polar). Default 1.
  --orientation-top-k ORIENTATION_TOP_K
                        With --ml-rank and orientation sampling: keep only the N best unique (post-deduplication) orientations per site, instead of all surviving ones. Unset (default) keeps every unique orientation found.
  --orientation-rmsd-tol ORIENTATION_RMSD_TOL
                        With --ml-rank and orientation sampling: two relaxed orientations at the same site are treated as duplicates (only the better-energy one kept) when their adsorbate-atom RMSD is below this (Ang) AND their energy differs by less than 0.01 eV. The RMSD matches equal atoms by the best permutation (H2O with its two H swapped is one geometry) and uses the nearest periodic image. Default 0.3.
  -O OUTPUT_DIR, --output-dir OUTPUT_DIR
                        Root directory (default: adsorption_run) for 'clean_slab', 'adsorbate' and 'sites' -- everything this study needs lives under one folder, same convention as stb-hubbardu's hubbardu_runs.
  --view                Open every generated structure (clean_slab, isolated adsorbate(s), and every written site) in ASE's interactive 3D viewer as a multi-frame browser, after everything else has finished. Needs a display.
  --view-plots          Also show the matplotlib plot(s) this run generates -- the candidate-site layout, and the ML pre-screen ranking chart if --ml-rank is used -- on screen (one blocking window per plot), instead of only saving them as PNGs. Off by default. A separate flag from --view since that one already means the ASE structure viewer here.
  -v, --version         show program's version number and exit
  --no-intro            Do not show the introduction

Usage examples:
  stb-adsorb -s slab.fdf -c calc.fdf --adsorbate O --site-type ontop
  stb-adsorb -s slab.fdf -c calc.fdf --adsorbate H2O --all-sites --site-type all
  stb-adsorb -s slab.fdf -c calc.fdf --adsorbate H --all-sites --ml-rank --top-k 3
  stb-adsorb -s slab.fdf -c calc.fdf --adsorbate O,N,C --site-type ontop
  stb-adsorb -s slab.fdf -c calc.fdf --adsorbate O --height-sweep 1.5 3.0 0.5