stb-irAnalysis¶
Stage 3 - Analysis of the 5.12 IR Spectrum workflow · menu code 5.12.3
usage: stb-irAnalysis [-h] [-dir DIRECTORY] [-l LABEL] [--file FILE]
[--linewidth LINEWIDTH] [--temperature K] [-o OUTPUT]
[--experimental FILE] [--peak-prominence FRACTION]
[--degenerate-tol THZ] [--save-gnuplot] [--view] [--view-modes]
[--animation-frames ANIMATION_FRAMES] [--symprec SYMPREC] [-v]
[--no-intro]
Stage 3 of 3: analyzes a stb-irModes displacement sweep and computes the IR spectrum.
Auto-detects, per mode, which path Stage 2 used (from the MODE_TABLE's own
`path` column, never inferred from which files happen to exist):
- NONBULK: reads the total dipole moment (SIESTA's own "Electric dipole
(a.u.)" line) from each mode's +/-delta dipole_disp/mode_*/ folder,
central-differences to get dmu/dQ directly as a 3-vector.
- BULK: reads the Born effective charge tensors (SystemLabel.BC) from the
single shared born_charge_disp/equilibrium/ folder, combines with each
mode's own eigendisplacement (a JSON sidecar Stage 2 already wrote) via
dmu_beta/dQ = sum_atom sum_tau Z*[atom,tau,beta] * e[atom,tau].
- HYBRID (2D slab): both of the above at once -- the in-plane dmu/dQ
components come from the same Born-charge x eigendisplacement formula as
BULK (computed with a vacuum-aware PolarizationGrids that only covers
the two periodic axes), the vacuum-axis component comes from the same
dipole-difference formula as NONBULK. A naive dipole is only valid along
a non-periodic direction, and Born-effective-charge/Berry-phase is only
valid along a periodic one -- neither method alone covers all 3 axes of
a slab correctly, so this combines one component from each.
Either way, IR intensity is |dmu/dQ|^2 -- same formula, only the derivation
differs. Builds a Lorentzian-summed spectrum and always lists its detected
peaks; the gnuplot .dat/.gplot pair itself is opt-in (--save-gnuplot, under
<directory>/plot/) and an on-screen matplotlib preview is available too
(--view). Also always reloads Stage 1's force constants to write an
extended-XYZ vibration animation per analyzed mode under
<directory>/mode_animations/ (skipped gracefully if phonon_disp/ is gone),
optionally opened one at a time in ASE's interactive viewer (--view-modes).
Near-degenerate mode groups get a combined, basis-independent intensity
alongside their individual (basis-dependent) values.
options:
-h, --help show this help message and exit
-dir DIRECTORY, --directory DIRECTORY
Root directory written by stb-ir/stb-irModes (default: ir_study).
-l LABEL, --label LABEL
SystemLabel used in Stage 2's calc.fdf (default: auto-detected).
--file FILE SIESTA output filename inside each displacement folder (default: calc.out).
--linewidth LINEWIDTH
Lorentzian linewidth (cm^-1) for the summed spectrum (default: 10.0).
--temperature K Weight each mode's spectrum contribution by the Stokes Bose-Einstein thermal population factor (n+1) at this temperature (Kelvin). Default: no weighting (every mode contributes by its raw intensity alone, as before this option existed).
-o OUTPUT, --output OUTPUT
Base filename (no extension) for the spectrum .dat/.gplot pair (default: ir_spectrum).
--experimental FILE Overlay a measured IR spectrum (2-column text file: frequency cm^-1, intensity) on the simulated one, and report a nearest-neighbor peak match (simulated vs. experimental peak positions, one row per experimental peak). Plotted on a separate y-axis (simulated intensity and real intensity aren't on the same scale).
--peak-prominence FRACTION
Minimum peak prominence, as a fraction of that spectrum's own max intensity, for peak detection (both the standalone [3] SPECTRUM peak list and --experimental's matching) (default: 0.01 -- filters out sub-1% noise bumps).
--degenerate-tol THZ Two modes within this frequency tolerance (THz) are reported as a degenerate group with a combined intensity, in addition to their individual values -- |dmu/dQ|^2 is not itself basis-independent within a degenerate subspace (Phonopy's returned eigenvectors are an arbitrary orthogonal basis of it), but the GROUP's summed intensity is the physically meaningful, basis-independent quantity (default: 0.001 THz, comfortably above float round-trip noise through the MODE_TABLE's 6-decimal text format, comfortably below any real frequency splitting between genuinely distinct modes).
--save-gnuplot Also save the spectrum (and, with --experimental, the overlaid measured spectrum) as gnuplot .dat + .gplot scripts, under '<directory>/plot/'. Off by default.
--view View the IR spectrum (and, with --experimental, the overlaid measured spectrum on a second y-axis) interactively via matplotlib now. Off by default. Needs a display. Independent of --save-gnuplot -- matplotlib here is only an on-screen preview, never written to disk.
--view-modes Open each analyzed mode's eigendisplacement animation interactively in ASE's 3D viewer, one at a time (close a window to advance to the next) -- needs a display and Stage 1's 'phonon_disp/' folder to still be present (reloads the same force constants Stage 2/this stage's own always-on XYZ export already use). Off by default.
--animation-frames ANIMATION_FRAMES
Frames per mode animation, for both --view-modes and the always-on extended-XYZ export below (default: 20).
--symprec SYMPREC Symmetry-detection tolerance (Ang), only used when reloading the phonon force constants for mode animations (--view-modes and the always-on XYZ export) -- same default as every other stage of this workflow (0.01, pymatgen's own default). Does not affect the IR-active/inactive classification (that was already decided in Stage 2) or the spectrum itself.
-v, --version show program's version number and exit
--no-intro Do not show the introduction
Usage examples:
stb-irAnalysis --directory ir_study
stb-irAnalysis --directory ir_study --save-gnuplot --view
stb-irAnalysis --directory ir_study --view-modes --animation-frames 30