Skip to content

stb-density

Density Plotter (RHO) · menu code 2.8 · guide: 2.8 Density Plotter (RHO)

usage: stb-density [-h] -l LABEL [-o OUTPUT_DIR] [--3d | --profile] [-a {0,1,2}]
                   [-p POS] [--spin] [--rho2 FILE] [--iso-min RHO] [--cube]
                   [--vmin VMIN] [--vmax VMAX] [--contour] [--save-gnuplot] [--view]
                   [--no-intro] [-v]

Converts a SIESTA charge-density grid (.RHO) to 2D maps, 3D point clouds, or planar-averaged 1D profiles.
Plots the total charge density by default. If the .RHO file is
spin-polarized, the spin density (up-down) is now detected and reported
automatically alongside it -- --spin no longer needs to be remembered just
to notice a magnetic calculation; pass --spin to look at ONLY the spin
density (skip the charge section) instead. --rho2 subtracts a second .RHO
file's density from the first (Delta rho = rho1 - rho2), the standard way
to visualize charge transfer/bonding (e.g. adsorbate+substrate vs. isolated
fragments) -- both files must be on the same grid. --iso-min filters low
-|density| points out of a --3d export, since an unfiltered production-size
grid can produce a multi-GB file dominated by near-zero vacuum/interstitial
points. --profile writes the planar average along the chosen axis instead
of a map (useful for slabs/interfaces). --cube additionally writes a
standard Gaussian cube file (needs a <label>.XV or <label>.fdf for the
geometry) for real isosurface rendering in VESTA/VMD/Avogadro. --vmin/
--vmax fix the colorbar range manually for the primary quantity, e.g. to
compare several slices on the same scale.

options:
  -h, --help            show this help message and exit
  -l LABEL, --label LABEL
                        System Label (looks for .RHO file)
  -o OUTPUT_DIR, --output-dir OUTPUT_DIR
                        Directory to write the data/gnuplot/cube files (the report and its references file go to the current folder) and into (default: current directory). Created if it doesn't exist.
  --3d                  Export full 3D volume
  --profile             Write the planar average of the density along --axis as a 1D profile (average taken over the other two axes) instead of a 2D/3D map -- useful for slabs, interfaces, and superlattices
  -a {0,1,2}, --axis {0,1,2}
                        For a slice/profile: the axis normal to the cut plane (slice) or the axis the profile varies along (profile) (0=X, 1=Y, 2=Z)
  -p POS, --pos POS     Position (Angstrom) of the 2D cut (ignored in --profile mode)
  --spin                Process ONLY the spin density (up-down), skipping the charge density section entirely -- only available for spin-polarized .RHO files. Without this flag, spin density is now detected and reported automatically alongside the charge density whenever the .RHO file has it, no flag needed.
  --rho2 FILE           A second .RHO file to subtract from the first (Delta rho = rho1 - rho2), e.g. to visualize charge transfer upon adsorption or defect formation. Must be on the same grid (same shape) as <label>.RHO. If both files are spin-polarized, the spin difference is computed too.
  --iso-min RHO         For --3d: only export/preview points with |density| >= this threshold (e/Ang^3) -- keeps the point cloud a manageable size and visually meaningful instead of dominated by near-zero points
  --cube                Also write the primary quantity's full 3D grid as a Gaussian .cube file (needs <label>.XV or <label>.fdf for the geometry) -- for real 3D isosurface rendering in VESTA/VMD/Avogadro, which handle volumetric data better than a point cloud. Applies to the charge density, or the spin density if --spin was given -- not both at once.
  --vmin VMIN           Fix the colorbar/palette lower bound manually (e/Ang^3) for the primary quantity, e.g. to compare several slices on the same scale. Auto-detected spin density always uses its own zero-symmetric range regardless of this.
  --vmax VMAX           Fix the colorbar/palette upper bound manually (e/Ang^3), for the primary quantity (see --vmin).
  --contour             Overlay contour lines on a 2D slice map/preview (ignored for --3d/--profile)
  --save-gnuplot        Also write a .gplot script next to each .dat file this run generates. Off by default.
  --view                Show an interactive matplotlib preview of each quantity plotted this run (slice heatmap / profile line / 3D scatter, matching the mode). Off by default.
  --no-intro            Do not show the introduction
  -v, --version         show program's version number and exit

Example usage:
  stb-density --label siesta
  stb-density --label siesta --3d --iso-min 0.01
  stb-density --label siesta --spin
  stb-density --label adsorbed --rho2 isolated.RHO
  stb-density --label siesta --profile --axis 2
  stb-density --label siesta --cube --view