PreparedCalculation

class ase2sprkkr.sprkkr.calculation.PreparedCalculation(input_parameters, input_file, potential_file, output_file, directory, counter, _file_resources, _directory_resources, _temporary_potential=False, _temporary_directory=False, _closed=False)[source]

One fully materialized SPR-KKR calculation.

Instances own the concrete parameter snapshot, path-backed calculation files and, when applicable, an entered temporary working-directory context. Ownership can be transferred to a runner, explicitly released for the legacy save_input(return_files=True) API, or terminated with close().

prepare() is the canonical factory because it resolves all public calculator sentinels and establishes these invariants. The generated dataclass constructor validates path-backed file invariants as well, so it cannot silently create an execution-incompatible instance.

Class hierarchy

Inheritance diagram of ase2sprkkr.sprkkr.calculation.PreparedCalculation


Constructor

Parameters:
  • input_parameters (ase2sprkkr.input_parameters.input_parameters.InputParameters)

  • input_file (object)

  • potential_file (str | None)

  • output_file (object | None)

  • directory (str)

  • counter (int)

  • _file_resources (contextlib.ExitStack | None)

  • _directory_resources (contextlib.ExitStack | None)

  • _temporary_potential (bool)

  • _temporary_directory (bool)

  • _closed (bool)

__init__(input_parameters, input_file, potential_file, output_file, directory, counter, _file_resources, _directory_resources, _temporary_potential=False, _temporary_directory=False, _closed=False)
Parameters:
  • input_parameters (ase2sprkkr.input_parameters.input_parameters.InputParameters)

  • input_file (object)

  • potential_file (str | None)

  • output_file (object | None)

  • directory (str)

  • counter (int)

  • _file_resources (contextlib.ExitStack | None)

  • _directory_resources (contextlib.ExitStack | None)

  • _temporary_potential (bool)

  • _temporary_directory (bool)

  • _closed (bool)

Return type:

None

input_parameters: ase2sprkkr.input_parameters.input_parameters.InputParameters
input_file: object
potential_file: str | None
output_file: object | None
directory: str
counter: int
_file_resources: contextlib.ExitStack | None
_directory_resources: contextlib.ExitStack | None
_temporary_potential: bool = False
_temporary_directory: bool = False
_closed: bool = False
classmethod prepare(*, default_atoms, default_potential, default_input_parameters, default_input_file, default_potential_file, default_output_file, default_directory, default_empty_spheres, label, counter, atoms=None, input_parameters=None, potential=None, input_file=None, potential_file=None, output_file=False, directory=None, create_subdirs=False, options=None, task=None, empty_spheres=None, allow_temporary_files=False, restart_scf=False)[source]

Materialize all state and files required for one SPR-KKR run.

default_* arguments are supplied by the calculator facade; explicit per-call arguments override them. On success the returned object owns every resource opened by preparation. On failure every resource acquired up to that point is released before the original exception is propagated.

Relative filenames and references inside input parameters use the calculation directory as their base. Files opened here have absolute names; filename mappings serialize references relative to that directory, including when the input file is stored in a subdirectory.

Return type:

ase2sprkkr.sprkkr.calculation.PreparedCalculation

create_run(*, result_context=None, profile, executor=None, project=None, print_output=False, read_callback=None, callback=None, gdb=False, error_file=None, create_subdirs=False, metadata=None)[source]

Create an unstarted runner and transfer this calculation’s resources.

The prepared calculation does not depend on the calculator facade. result_context is optional runtime context for output readers; the SPRKKR facade supplies itself so result convenience APIs can construct follow-up calculations, while standalone prepared runs may leave the context unset.

error_file=None stores stderr as <output_file>.err. True explicitly merges stderr into output_file; False requests a managed temporary stderr file; a path or file object is used directly. Tracked runs require persistent working-directory and stderr paths so they can be recovered after the client exits.

Parameters:

profile (ase2sprkkr.sprkkr.profile.SPRKKRProfile)

property closed

Whether this object has relinquished or closed all owned resources.

property temporary_potential

Whether POTFIL is a managed temporary pathname.

release_file_ownership()[source]

Transfer ownership of open input/output files to the caller.

The files themselves are not closed. This supports the legacy save_input(return_files=True) API. A temporary POTFIL cannot be transferred by that API because it returns only its pathname; callers must supply a persistent POTFIL name in that case.

close_directory_context()[source]

Close the entered working-directory context after file transfer.

_update_closed_state()[source]
close()[source]

Close all resources still owned by this prepared calculation.