cli_ofdft
- class OFDFTRunResult(xyz_path: Path, energies: Energies, converged: bool, coeffs: Tensor | None, sample: OFData, sample_path: Path | None)[source]
Container summarizing the outcome of a single OFDFT calculation.
- __eq__(other)
Return self==value.
- __init__(xyz_path: Path, energies: Energies, converged: bool, coeffs: Tensor | None, sample: OFData, sample_path: Path | None) None
- __repr__()
Return repr(self).
- _config_to_log_dict(config: Any) Mapping[str, Any] | None[source]
Convert config-like objects into a mapping suitable for logging.
- add_sad_kwargs(ofdft_kwargs: dict, basis_info: BasisInfo) None[source]
Inject SAD initialization options into the OFDFT configuration.
- console_filter(record: dict) bool[source]
Filter to exclude messages marked as file-only from console output.
- Parameters:
record (
dict) – Log record.- Returns:
True if the message should be logged to console, False otherwise.
- Return type:
bool
- extract_group(prefix: str, args: Namespace, cls: type | None = None)[source]
Extract args starting with “prefix_” and optionally instantiate
cls.
- log_config(base_args, model_args, optimizer_args, logger)[source]
Log the configuration to the logger.
- run_ofdft(base_config: BaseConfig, model_config: ModelConfig, optimizer_config: OptimizerConfig, logger_format: str | None = None) list[OFDFTRunResult][source]
Run OFDFT calculations using dataclass-based CLI configuration.
This helper instantiates the sample generator, optimizer, and set of input structures from the provided configuration dataclasses before delegating to
run_ofdft_from_components(). It is the high-level entry point exposed to the command line interface but remains usable programmatically for automated workflows.- Parameters:
base_config – Settings describing the molecular inputs and run options.
model_config – Parameters identifying and configuring the trained model.
optimizer_config – Hyperparameters controlling the density optimizer.
logger_format – Optional loguru format string for auxiliary log files.
- Returns:
A list of
OFDFTRunResultobjects, one for each processed XYZ structure.
- run_ofdft_from_components(*, base_config: BaseConfig, sample_generator: SampleGenerator, optimizer: Optimizer, xyzfiles: Sequence[Path], model_config: ModelConfig | Mapping[str, Any] | None = None, optimizer_config: OptimizerConfig | Mapping[str, Any] | None = None, logger_format: str | None = None) list[OFDFTRunResult][source]
Run OFDFT calculations using pre-instantiated dependencies.
This function executes the end-to-end OFDFT workflow given a set of already constructed components. It is suitable for library use where callers manage model loading, optimizer creation, or input discovery themselves while reusing the orchestration logic implemented for the CLI.
- Parameters:
base_config – Run configuration that supplies shared OFDFT options.
sample_generator – Prepared
SampleGeneratorinstance.optimizer – Optimizer responsible for electron density updates.
xyzfiles – Sequence of XYZ input paths to be processed.
model_config – Optional model configuration for logging purposes.
optimizer_config – Optional optimizer configuration for logging.
logger_format – Optional loguru format string for per-molecule logs.
- Returns:
A list of
OFDFTRunResultobjects containing energies, density coefficients, and bookkeeping data for each input structure.