stb-xrd¶
Powder XRD Simulator · menu code 2.9 · guide: 2.9 Powder XRD Simulator
usage: stb-xrd [-h] --file FILE --format {fdf,struct_out} [--wavelength WAVELENGTH]
[--two-theta-range MIN MAX] [--top TOP] [--compare-to PATH]
[--raw-experimental] [-o OUTPUT_DIR] [--save-gnuplot] [--view] [-v]
[--no-intro]
Simulates a powder XRD pattern from a structure.
Uses pyxtal's own diffraction engine (not pymatgen's) so the same dependency
already needed by stb-crystalcast covers this too.
options:
-h, --help show this help message and exit
--file FILE Path to structure file.
--format {fdf,struct_out}
Input file format:
fdf: SIESTA structure input (%block LatticeVectors etc.)
struct_out: SIESTA post-relaxation output (.STRUCT_OUT)
--wavelength WAVELENGTH
X-ray source: a known name (CuKa, CuKa1, MoKa, CrKa, FeKa, CoKa, AgKa, ...) or a wavelength in Ang as a plain number (default: CuKa, 1.54184 Ang).
--two-theta-range MIN MAX
2-theta range in degrees to compute (default: 0 90).
--top TOP Only include the N strongest peaks in the saved data file (--save-gnuplot); default: include all of them. No effect without --save-gnuplot -- there's no console/report peak table anymore, see [2] DIFFRACTION PATTERN for a summary instead.
--compare-to PATH Compare the simulated pattern against an experimental one: a text file with 2-theta in the first column and intensity in the LAST column (any columns in between, e.g. d/h/k/l, are ignored -- so stb-xrd's own --save-gnuplot xrd_pattern.dat is a valid input too), whitespace- or comma-separated, '#' comments and blank lines allowed. If the file looks like a sparse list of discrete peaks rather than a continuous scan (e.g. a literature peak table, or this tool's own stick-pattern output), it is automatically Gaussian-broadened before comparing -- pass --raw-experimental to disable this and compare it unbroadened instead. Prints a similarity score (pyxtal's cosine-weighted metric, 0-1, higher is more similar); combine with --view for a visual overlay.
--raw-experimental With --compare-to, never auto-broaden a peak-list-looking experimental file -- compare it exactly as read. Off by default (auto-detection normally handles this correctly).
-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 xrd_pattern.dat (all peaks, pyxtal's own format) and xrd_pattern.gplot (a stick-pattern plot script) together. Off by default -- this tool used to write the data file unconditionally on every run; that's no longer the case.
--view Show an interactive matplotlib preview of the pattern (or, with --compare-to, an overlay of both patterns) before finishing. Off by default.
-v, --version show program's version number and exit
--no-intro Do not show the introduction
Usage examples:
stb-xrd --file structure.fdf --format fdf
stb-xrd --file structure.fdf --format fdf --wavelength MoKa --top 10
stb-xrd --file relaxed.STRUCT_OUT --format struct_out \
--two-theta-range 10 80 --view
stb-xrd --file structure.fdf --format fdf \
--compare-to experimental.dat --view --save-gnuplot