The rsutil module
The top-level rsutil module is the compatibility-facing entry point for
RS-utils. It retains the historical Fortran setup wrapper and exposes the
high-throughput services and analysis packages:
Lattice processing:
process_lattice()remains available for legacy in-process setup calls.Safe setup:
rsutil.setupprovides isolated execution, validation, manifests, supercells, SQS, distortions, and 2D handling.HT campaigns:
rsutil.campaignvalidates and materializes deterministic campaigns, renders Slurm helpers, and collects evidence.Results:
rsutil.resultsparses SCF, exchange, transport/damping, and tight-binding data into versioned contracts.Analysis and interoperability: bands/DOS, visualization, exchange mapping, ASE conversion, and UppASD/LMTO47 export.
Surface preparation:
rsutil.prepare_surface()builds an RS-LMTObuildsurfinput bundle from a converged bulk calculation.Impurity preparation:
rsutil.prepare_impurity()builds an embedded impurity input bundle from a converged bulk or surface host.
Core Functions
Notes:
process_lattice(..., lmx=2)exposes setup-sidelmaxoverride from Python.process_latticealso supportslattice_dist,basis_dist,alat_scale, andseedfor reproducible geometric perturbations.process_latticesupports 2D slab mode viamode_2dand optionalz_iso_factor.process_latticesupports recursion overrides viarec_methodandrec_steps(written to&controlasrecurandlld).Current backend support in this repository is
0 <= lmax <= 3.Extended lattice keys
strux_backend,strux_want_sdot, andstrux_solve_scaleare preserved when present.CLI-level SQS controls (
--sqs,--sqs-shells,--sqs-steps,--sqs-seed) can be combined with--supercellforsetup bulkand--lmto47workflows.
Surface Preparation API
The Python API mirrors rsutil setup surface. It writes to a new output
directory and returns a manifest describing the staged files and settings:
extend_surface(surface_dir, output_dir, nlay=..., empty_spheres=...)
inherits the existing surface geometry and settings, carries forward matching
restart potentials, and seeds newly added types from the deepest available
interface or empty-sphere restart. The source surface must have been prepared
by RS-utils, and its recorded bulk source directory must remain accessible.
For SurfaceSpec, orientation="global-z" rotates the requested surface
normal onto global Z and writes a file-based lattice. The optional
align_bond and align_bond_to vectors select the remaining in-plane
rotation: align_bond is a Cartesian bond direction in the original bulk
frame, and align_bond_to is its target direction in the rotated XY plane.
Both vectors must be supplied together; the source must lie in the requested
surface plane. The Cartesian rotation matrix and alignment vectors are included
in the returned manifest and surface_setup.json. With either vector
omitted, the existing minimal normal-to-Z rotation is retained.
Submodules
The package is organized into the following submodules:
``rsutil.core``: Shared data contracts, hashing, and safe paths
``rsutil.setup``: Setup runner, service, and validation APIs
``rsutil.campaign``: Deterministic HT campaign APIs
``rsutil.results``: Versioned result models and parsers
``rsutil.ase``: Optional ASE interoperability
``rsutil.bands``: Band structure, DOS, projections, DOS moments
``rsutil.viz``: Visualization tools for structures and simulations
``rsutil.exchange``: Exchange interaction calculation and mapping
``rsutil.export``: Export functionality for other simulation formats
``rsutil.cli``: Command-line entry points and parsers for
rsutilconsole commands
Command-line Interface
The package exposes console-oriented entrypoints and helpers in rsutil.cli for running bands, dos and visualization workflows from the shell.
Exporters
Export utilities (e.g., UppASD exporters) are available under
rsutil.export.