Psience.Data.ScanManager
Unified scan infrastructure
ScanManager is the single entry point for both halves of a scan:
.generate(scan_iterator, ...)– drains ascan_iterator(an iterable of(index, values, atoms, coords)steps), writes one job file per step into{output_directory}/scan_data_{scan_id}/, and records ascan_info.jsonmanifest mapping each step to its file..parse(molecular_property_extractor, ...)– reads that manifest back, rebuilds aMoleculefrom each step’s electronic-structure output, runsmolecular_property_extractoron it, and stacks the results into one tensor per property key, shaped like the scan grid.
The default implementation targets ORCA (OrcaJob for generation, .out
files for parsing). To support another package, subclass and override
default_job_builder and default_output_file_generator:
class GaussianScanManager(ScanManager):
job_file_ext = ".gjf"
output_file_ext = ".log"
def default_job_builder(self, atoms, coords, charge, **opts):
return GaussianJob(atoms=atoms, cartesians=..., charge=charge, **opts)
# default_output_file_generator's extension swap (.gjf -> .log) already
# works unchanged as long as job_file_ext/output_file_ext are set above
A few free functions are provided to build scan_iterators for the two scan
types worked out previously (a local Cartesian atomic-position scan, and an
internal-coordinate scan), via structure_scan_iterator, which zips an
N-dimensional grid of coordinate values with a structure_generator into the
(index, values, atoms, coords) stream generate expects.