ProgramHarness

class qcengine.programs.ProgramHarness(*, name, scratch, thread_safe, thread_parallel, node_parallel, managed_memory, extras=None)[source]

Bases: BaseModel, ABC

Base class for analytic single-geometry capable harnesses.

Attributes Summary

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Methods Summary

build_input(input_model, config[, template])

build_input_model(data, *[, ...])

Quick wrapper around util.model_wrapper for inherited classes

compute(input_data, config)

Top-level compute method to be implemented for every ProgramHarness

execute(inputs[, extra_outfiles, ...])

found([raise_error])

Checks if the program can be found.

get_version()

Finds program, extracts version, returns normalized version string.

parse_output(outfiles, input_model)

Attributes Documentation

Parameters:
model_config = {'extra': 'forbid', 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Methods Documentation

build_input(input_model, config, template=None)[source]
Return type:

Dict[str, Any]

Parameters:
build_input_model(data, *, return_input_schema_version=False)[source]

Quick wrapper around util.model_wrapper for inherited classes

Return type:

Union[AtomicInput, Tuple[AtomicInput, int]]

Parameters:
abstractmethod compute(input_data, config)[source]

Top-level compute method to be implemented for every ProgramHarness

Note

This method behave in any of the following ways:
  1. Return AtomicResult upon successful completion of a calculation

  2. Return FailedOperation object if an operation was unsuccessful or raised an exception. This is most

    likely to occur if the underlying QC package has a QCSchema API that catches exceptions and returns them as FailedOperation objects to end users.

  3. Raise an exception if a computation failed. The raised exception will be handled by the

    qcng.compute() method and either raised or packaged as a FailedOperation object.

Return type:

Union[AtomicResult, FailedOperation]

Parameters:
execute(inputs, extra_outfiles=None, extra_commands=None, scratch_name=None, timeout=None)[source]
Return type:

Tuple[bool, Dict[str, Any]]

Parameters:
abstractmethod static found(raise_error=False)[source]

Checks if the program can be found.

Parameters:

raise_error (bool) – If True, raises an error if the program cannot be found.

Returns:

Returns True if the program was found, False otherwise.

Return type:

bool

get_version()[source]

Finds program, extracts version, returns normalized version string.

Returns:

Return a valid, safe python version string.

Return type:

str

parse_output(outfiles, input_model)[source]
Return type:

AtomicResult

Parameters: