Skip to content

stb-workfunction

Work Function Calculator · menu code 2.7 · guide: 2.7 Work Function Calculator

usage: stb-workfunction [-h] -l LABEL [-f FILE] [-g GRID] [-z {0,1,2}] [--fermi FERMI]
                        [--asymmetric-tol EV] [-o OUTPUT_DIR] [--save-gnuplot]
                        [--view] [--no-intro] [-v]

Calculates the work function from a SIESTA electrostatic potential grid.
Reads <label>.VT (total potential, planar-averaged along --axis) plus the
Fermi energy from <label>.out (or --fermi to override), and locates the
vacuum plateau(s) in the averaged potential to compute Phi = E_vac - E_F.
If <label>.XV or <label>.fdf is present (and its cell matches <label>.VT's),
--axis is auto-detected from the structure's actual vacuum-padded direction
(core.kspace.detect_vacuum_axes, same mechanism as stb-kgrid/stb-mlrelax);
otherwise it defaults to z (2). An asymmetric slab (different terminations
on each side) genuinely has two different vacuum levels -- this is detected
automatically and reported as two separate work functions rather than one
physically meaningless average, along with the vacuum-level difference
(proportional to the surface dipole moment). Also reports the slab
thickness/vacuum size along the axis (when geometry is available), and
warns if a "vacuum" plateau has a systematic slope (a common symptom of a
missing dipole correction) rather than being genuinely flat.

options:
  -h, --help            show this help message and exit
  -l LABEL, --label LABEL
                        System Label (required).
  -f FILE, --file FILE  Output file (.out). Default: label.out
  -g GRID, --grid GRID  Potential grid file (.VT recommended). Default: label.VT
  -z {0,1,2}, --axis {0,1,2}
                        Axis normal to surface (0=x, 1=y, 2=z). Default: auto-detected from label.XV/label.fdf if available and matching label.VT's cell, else z (2)
  --fermi FERMI         Manually force Fermi Energy (eV).
  --asymmetric-tol EV   Vacuum levels within this many eV of each other are treated as the same physical plateau rather than a genuinely asymmetric slab (default: 0.05)
  -o OUTPUT_DIR, --output-dir OUTPUT_DIR
                        Directory to write into (and the data+gnuplot files, with --save-gnuplot; the report and its references file go to the current folder) (default: current directory). Created if it doesn't exist.
  --save-gnuplot        Also write workfunction_data.dat and workfunction.gplot (the planar-averaged potential profile, annotated with the detected vacuum level(s)/work function(s)). Off by default.
  --view                Show an interactive matplotlib preview of the potential profile before exiting. Off by default.
  --no-intro            Do not show the introduction
  -v, --version         show program's version number and exit

Example usage:
  stb-workfunction -l graphene
  stb-workfunction -l slab --axis 2
  stb-workfunction -l slab --fermi -4.5 --save-gnuplot