Skip to content

stb-opticalAnalysis

Stage 2 - Analysis of the 5.14 Optical Properties workflow · menu code 5.14.2

usage: stb-opticalAnalysis [-h] [--directory DIRECTORY] [--file FILE] [-l LABEL]
                           [--energy-min EV] [--energy-max EV]
                           [--plot-quantity {eps,n_k,alpha,R,L,sigma1,all}]
                           [--experimental PATH] [--peak-prominence FRACTION]
                           [--dimensionality-correction] [--thickness ANG] [-o OUTPUT]
                           [-v] [--no-intro] [--show] [--png] [--plot-emax EV]
                           [--energies EV [EV ...]] [--n-peaks N] [--smoothing EV]
                           [--scissor EV]

Stage 2 of 2: aggregates every direction folder written by stb-optical and derives the full set of linear optical properties.
Scans --directory for every subfolder containing a calc.fdf, identifies each one's direction from its
own %block Optical.Vector (not the folder name -- robust to renamed/reorganized folders; 'xx'/'yy'/
'zz' diagonal or 'xy'/'xz'/'yz' biaxial, the same convention stb-optical writes), reads its
SystemLabel.EPSIMG, and derives eps1(E)/eps2(E) (Kramers-Kronig transform), n(E)/k(E) (refractive
index/extinction coefficient), the absorption coefficient, normal-incidence reflectivity, the
electron energy-loss function, and the real optical conductivity -- all standard textbook relations
(Wooten/Fox, "Optical Properties of Solids"), not flagged [UNVERIFIED]. Missing or incomplete
direction folders are skipped with a warning, never block the directions that ARE ready (advisory
only, same convention as this suite's other multi-folder analysis stages).

[OFF-DIAGONAL RECONSTRUCTION] Whenever a biaxial direction ('xy'/'xz'/'yz') AND its 2 matching
diagonal directions are all present, also reconstructs the true off-diagonal dielectric-tensor
component eps_ij(E) = eps_(bisector ij)(E) - (eps_ii(E) + eps_jj(E)) / 2 (same bisector-based formula
raman_analysis.py's own raman_tensor_full uses for the Raman tensor's Rxy/Rxz/Ryz) and writes it to
its own dedicated output -- eps1_ij/eps2_ij only, NOT n/k/alpha/R/L/sigma1 (those textbook relations
assume a principal-axis/diagonal response and have no standalone meaning for a genuine off-diagonal
tensor component).

[ASSUMPTION] Reflectivity R(E) is normal-incidence, vacuum(n0=1)/material interface -- no angle-
dependent Fresnel formula or thin-film interference is computed. [KNOWN LIMITATION, 2D/1D/0D inputs]
The raw supercell values above are diluted by the vacuum region and NOT corrected by default -- pass
--dimensionality-correction (see its own --help entry) to additionally restore the intrinsic 2D
dielectric function or extract a 0D molecular polarizability, written ALONGSIDE the raw values, never
replacing them (1D is not yet implemented -- see --dimensionality-correction's own help text; this
correction is only ever applied to the 3 diagonal directions, never to a biaxial/reconstructed one).

When all 3 of xx/yy/zz are present, also computes and reports/plots an isotropic ('avg') average --
eps2 averaged across the 3 directions first, then every other quantity (including eps1) re-derived
from that averaged eps2 -- the standard convention for comparing against a polycrystalline/powder
experimental measurement, which doesn't correspond to any single crystallographic direction.

[REPORT] System/ground state and per-folder Optical settings read back from the folders; data quality
(SCF, SIESTA's f-sum check, the f-sum rule recomputed from eps2 as N_eff(E)); static eps1/n/R, absorption
onset, Tauc direct gap and Penn gap; peaks of eps2 and the plasmon; anisotropy and a symmetry-consistency
check of the tensor; optical constants at chosen energies; a plain-language interpretation. Optional:
--show/--png (9-panel matplotlib dashboard), --scissor (post-processing what-if for the DFT gap error),
--energies, --n-peaks.

options:
  -h, --help            show this help message and exit
  --directory DIRECTORY
                        Root directory written by stb-optical (default: optical_study).
  --file FILE           SIESTA output filename inside each direction folder, used only for the SCF-convergence advisory check (default: calc.out).
  -l LABEL, --label LABEL
                        SystemLabel override (default: auto-detected per folder).
  --energy-min EV       Trim the reported/plotted energy range from below (default: no trim).
  --energy-max EV       Trim the reported/plotted energy range from above (default: no trim).
  --plot-quantity {eps,n_k,alpha,R,L,sigma1,all}
                        Which quantity the combined .gplot overlays across every direction present (default: eps -- plots eps1 AND eps2 together). 'all' writes one .gplot per quantity in a single run (mutually exclusive with --experimental -- pick one specific quantity for a direct comparison instead).
  --experimental PATH   2-column (energy_eV, value) experimental spectrum (e.g. UV-Vis-NIR absorbance/reflectance) to overlay on the plot -- only valid with a single-valued --plot-quantity (alpha/R/L/sigma1), not eps/n_k/all. Peak positions are matched against the isotropic average (if all 3 directions are present) or the first available direction otherwise.
  --peak-prominence FRACTION
                        Minimum peak prominence, as a fraction of that spectrum's own max value, for --experimental's peak-finding (default: 0.01).
  --dimensionality-correction
                        Restore the intrinsic (vacuum-independent) response from the raw vacuum-padded supercell result. 2D (1 vacuum axis): rescales eps(E) via the D-field/E-field continuity argument (Laturia et al., npj 2D Mater. Appl. 2, 6, 2018; Yang & Gao, npj 2D Mater. Appl. 5, 78, 2021) -- requires --thickness. 0D (3 vacuum axes, an isolated molecule): extracts the molecular polarizability alpha(E) via the dilute-limit Clausius-Mossotti relation -- no extra input needed (uses the cell volume). 1D (2 vacuum axes): NOT implemented -- the literature approach (Maxwell-Garnett effective medium) is not a simple generalization of the 2D formula and has not been verified for this tool; prints a [NOTE] and reports only the raw supercell values. 3D (bulk): no-op, nothing to correct. Off by default -- always written ALONGSIDE (never replacing) the raw supercell .dat/.csv files.
  --thickness ANG       Physical thickness of the 2D material in Ang, required together with --dimensionality-correction for a 2D (1 vacuum axis) input. Deliberately not auto-estimated -- 'thickness' of a 2D material is not a single well-defined quantity (atomic span? + van der Waals radii? bulk interlayer spacing?), left to the user's own judgment.
  -o OUTPUT, --output OUTPUT
                        Base filename (no extension) for the .csv/.dat/.gplot outputs (default: optical_results).
  -v, --version         show program's version number and exit
  --no-intro            Do not show the introduction
  --show                Open the analysis dashboard (matplotlib, 9 panels) on screen. Needs a display.
  --png                 Save the dashboard as <directory>/<output>_summary.png.
  --plot-emax EV        Upper energy of the dashboard's x axes (default: the data range, at most 20 eV). --energy-min/--energy-max instead trim the DATA used by every analysis.
  --energies EV [EV ...]
                        Photon energies (eV) of the 'optical constants at selected energies' table (0 = static limit; default: 0 1 2 3 4 5 10).
  --n-peaks N           Number of eps2 peaks listed in the spectral-features table (default: 6).
  --smoothing EV        Gaussian sigma (eV) used only to locate peaks/zero crossings in a spiky spectrum (default: 0.05).
  --scissor EV          What-if scissor shift (eV) applied in post-processing to the reference spectrum: eps2'(E) = eps2(E - EV), eps1 re-derived by Kramers-Kronig; reports the effect on the static constant, edge, peaks and plasmon and overlays it on the dashboard.

Usage examples:
  stb-opticalAnalysis --directory optical_study --plot-quantity alpha
  stb-opticalAnalysis --directory optical_study --plot-quantity alpha --experimental uvvis.dat
  stb-opticalAnalysis --directory optical_study --plot-quantity all
  stb-opticalAnalysis --directory optical_study --dimensionality-correction --thickness 3.13