Skip to content

stb-chargediffAnalysis

Stage 2 - Analysis of the 5.16 Charge Density Difference workflow · menu code 5.16.2

usage: stb-chargediffAnalysis [-h] [--dir DIR] [-o OUTPUT_DIR] [--3d | --profile]
                              [-a {0,1,2}] [-p POS] [--spin] [--iso-min RHO]
                              [--no-cube] [--vmin VMIN] [--vmax VMAX] [--contour]
                              [--show] [--png] [--save-gnuplot] [--save-data]
                              [--no-intro] [-v]

Stage 2 of the Charge Density Difference workflow: given just --dir (the same folder stb-chargediffPrep wrote into), auto-discovers the combined system and every fragment from chargediff_manifest.json, reads each one's own .RHO (once SIESTA has been run in every folder), and computes Delta rho = rho_combined - sum(rho_fragment_i) -- the standard way to visualize charge accumulation/depletion regions.
Besides the map (2D slice / planar profile / 3D point cloud / Gaussian cube in e/bohr^3) the report checks the
consistency of the folders (grid, cell, mesh cutoff, level of theory, SCF, electron count), gives the
counterpoise-corrected interaction energy from the same runs, statistics of Delta rho and the charge change of
every fragment and atom (nearest-atom partition). --show / --png draw a 4-panel dashboard; --save-gnuplot writes
the .gplot; --save-data a CSV and a JSON. --spin computes the spin-density difference instead (only if the
combined system and every fragment are spin-polarized).

options:
  -h, --help            show this help message and exit
  --dir DIR             Directory stb-chargediffPrep wrote into -- must contain 'chargediff_manifest.json' plus the 'combined/' and fragment subfolders it lists, each already run in SIESTA. Default: chargediff_run (stb-chargediffPrep's own default --output-dir).
  -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 Delta rho along --axis as a 1D profile (average taken over the other two axes) instead of a 2D/3D map -- useful for bilayers, slabs, and interfaces
  -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). Default: Z for the slice; for the profile (and the dashboard's profile panel) the lattice axis along which the fragments are farthest apart.
  -p POS, --pos POS     Position (Angstrom) of the 2D cut along --axis (default: the plane where the planar integral of |Delta rho| is largest; ignored in --profile mode)
  --spin                Compute the SPIN density difference instead of the charge density difference -- only available if the combined system AND every fragment are spin-polarized.
  --iso-min RHO         For --3d: only export/preview points with |Delta rho| >= this threshold (e/Ang^3) -- keeps the point cloud a manageable size and visually meaningful instead of dominated by near-zero points
  --no-cube             Skip writing Delta rho's full 3D grid as a Gaussian .cube file (in e/bohr^3) -- written by default (needs a '*.XV' or 'structure.fdf' in the combined folder for the geometry), for real 3D isosurface rendering in VESTA/VMD/Avogadro.
  --vmin VMIN           Fix the colorbar/palette lower bound manually (e/Ang^3), e.g. to compare several slices on the same scale.
  --vmax VMAX           Fix the colorbar/palette upper bound manually (e/Ang^3).
  --contour             Overlay contour lines on a 2D slice map/dashboard (ignored for --3d/--profile)
  --show, --view        Open the 4-panel dashboard (slice with atoms, planar profile, charge change per atom, summary) on screen with matplotlib. Needs a display. Off by default (--view is the older name of this option).
  --png                 Save the dashboard as <output-dir>/<name>_summary.png. Off by default.
  --save-gnuplot        Also write a .gplot script next to each .dat file this run generates. Off by default.
  --save-data           Also write <name>_atoms.csv (charge change per atom) and <name>_results.json (every number of the report). Off by default.
  --no-intro            Do not show the introduction
  -v, --version         show program's version number and exit

Example usage:
  stb-chargediffAnalysis --dir chargediff_run --png
  stb-chargediffAnalysis --dir chargediff_run --profile --axis 2 --save-gnuplot
  stb-chargediffAnalysis --dir chargediff_run --axis 2 --pos 7.1 --contour --show --save-data
  stb-chargediffAnalysis --dir chargediff_run --3d --iso-min 0.01 --no-cube