SPRKKR

class ase2sprkkr.sprkkr.calculator.SPRKKR(label=None, directory='.', atoms=None, potential=None, input_file=True, output_file=True, potential_file=True, input_parameters=None, options=None, print_output=None, mpi=None, empty_spheres=None, executable_suffix=None, executable_dir=None, profile=None, executor=None, project=None, **kwargs)[source]

ASE-facing calculator for SPR-KKR.

SPRKKR is a mutable facade holding defaults shared by calculations: structure/potential, input parameters, filename templates, working directory and execution policy. Preparation snapshots run-specific configuration and materializes the selected physical state into independent calculation files.

Selected Atoms and Potential objects are mutable physical working state, not per-run snapshots. This applies both to calculator defaults and explicitly supplied objects: preparation may promote or normalize the structure, add automatic empty spheres, and synchronize the potential. Once preparation finishes, the returned PreparedCalculation owns its concrete files and resources, so execution no longer depends on subsequent changes to those physical objects.

A calculator instance is not intended to be prepared concurrently from multiple threads because filename-template counters and physical preprocessing are mutable state. Prepared runners themselves own independent resources and may run concurrently.

Class hierarchy

Inheritance diagram of ase2sprkkr.sprkkr.calculator.SPRKKR


Constructor

Parameters:
  • mpi (Optional[bool])

  • empty_spheres (Optional[Union[str, bool, Dict]])

  • executable_dir (Optional[Union[str, bool]])

__init__(label=None, directory='.', atoms=None, potential=None, input_file=True, output_file=True, potential_file=True, input_parameters=None, options=None, print_output=None, mpi=None, empty_spheres=None, executable_suffix=None, executable_dir=None, profile=None, executor=None, project=None, **kwargs)[source]
Parameters:
  • mpi (bool | None)

  • empty_spheres (str | bool | Dict | None)

  • executable_dir (str | bool | None)

implemented_properties: list[str] = ['energy']

Properties calculator can handle (energy, forces, …)

property print_output
property empty_spheres
property input_parameters

Default InputParameters used for new calculations.

set(options=None, value=None, *, unknown='find', **kwargs)[source]

Set values on the calculator’s persistent input-parameter defaults.

Parameters:

options (Dict[str, Any] | str | None)

get(name)[source]

Return an input-parameter value by name or SECTION.NAME path.

property potential: ase2sprkkr.potentials.potentials.Potential

Potential associated with the calculator, generated lazily from atoms.

property atoms: ase2sprkkr.sprkkr.sprkkr_atoms.SPRKKRAtoms

Structure associated with the calculator.

property directory

Default working directory, or False for a temporary run directory.

_advance_counter()[source]

Advance the filename-template counter used by the legacy templator.

prepare(atoms=None, input_parameters=None, potential=None, input_file=None, potential_file=None, output_file=None, directory=None, create_subdirs=False, options=None, task=None, empty_spheres=None, allow_temporary_files=True, restart_scf=False)[source]

Materialize current calculation state into one prepared calculation.

InputParameters are copied before one-shot task/options and generated file values are applied. Selected Atoms and Potential objects are not deep-copied and may be normalized or synchronized during preparation. The returned PreparedCalculation owns all concrete files and temporary directory resources, so subsequent physical-state changes do not alter the already materialized run. Call PreparedCalculation.close() when the object is not transferred to a runner.

Parameters:
static _is_temporary_directory(directory)[source]
save_input(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, return_files=False, restart_scf=False)[source]

Materialize SPR-KKR input files without starting an executable.

Preparation always works on an independent snapshot of InputParameters; generated POTFIL/DATASET values therefore never mutate calculator defaults or caller-owned parameter objects.

False as input_file or potential_file requests a managed named temporary artifact. Temporary artifacts are useful for an executing runner, but save_input cannot return ownership of a temporary POTFIL because its public tuple exposes only the pathname. Supply a persistent POTFIL name when return_files=True.

directory=False is intentionally rejected here: a temporary directory is owned naturally by a runner, whereas returning filenames from save_input after deleting their directory would be invalid. Use create_run()/calculate for temporary run directories.

Parameters:
create_run(atoms=None, input_parameters=None, potential=None, input_file=None, potential_file=None, output_file=None, directory=None, create_subdirs=False, options=None, task=None, empty_spheres=None, print_output=None, read_callback=None, callback=None, gdb=False, profile=None, executor=None, project=None, restart_scf=False, error_file=None, metadata=None)[source]

Prepare a calculation and return an unstarted owning runner.

An explicit per-run executor has highest precedence. Otherwise an explicit per-run profile selects its backend; if neither is supplied, the calculator-level executor (when present) overrides the calculator profile backend.

error_file=None stores stderr next to stdout as <output>.err. error_file=True deliberately merges stderr into output_file; False requests a managed temporary stderr file, and an explicit path or file object stores stderr there instead.

callback is a terminal runner callback. It can therefore be invoked with a partially populated result when backend execution or parsing fails. read_callback observes streamed stdout/stderr.

Parameters:
value_or_default(name, value)[source]

Return calculator default name when value is None.

_update_from_result(result, *, adopt_potential=False)[source]

Update calculator state from a completed synchronous result.

calculate(atoms=None, properties=('energy',), system_changes=['positions', 'numbers', 'cell', 'pbc', 'initial_charges', 'initial_magmoms'], input_parameters=None, potential=None, input_file=None, potential_file=None, output_file=None, directory=None, create_subdirs=False, empty_spheres=None, mpi=None, options=None, task=None, print_output=None, read_callback=None, executable_suffix=None, callback=None, executable_dir=None, gdb=False, profile=None, executor=None, project=None, restart_scf=False, error_file=None, metadata=None)[source]

Run one SPR-KKR task synchronously and return its parsed result.

properties and system_changes are accepted for ASE compatibility. SPR-KKR execution is task-oriented, so properties does not select a different backend task and system_changes is not used for incremental updates; each run materializes the complete supplied calculation state. Per-call mpi, executable_dir and executable_suffix values are immutable overrides of the selected execution profile.

The callback of this synchronous convenience method is intentionally a success callback: it runs only after the result has updated calculator state. This differs from the lower-level terminal callback accepted by create_run(). An unsuccessful execution raises ASE’s CalculationFailed before updating calculator state.

Parameters:
  • directory (str | bool | ase2sprkkr.common.file_utils.Directory | None)

  • create_subdirs (bool)

  • empty_spheres (str | bool | None)

  • mpi (bool)

  • read_callback (callable | None)

  • restart_scf (bool)

get_property(name, atoms=None, allow_calculation=True)[source]
scf(*args, **kwargs)[source]

Run an SCF calculation.

phagen(*args, **kwargs)[source]

Run a PHAGEN calculation.

kkrgen(*args, **kwargs)[source]

Run a KKRGEN calculation.

kkrspec(*args, **kwargs)[source]

Run a KKRSPEC calculation.

_abc_impl = <_abc._abc_data object>
kkrch(*args, **kwargs)[source]

Run a KKRCH calculation.

run_xband(executable='xband')[source]

Start the external xband executable detached from calculator IO.

copy_with_potential(potential)[source]

Return a shallow calculator copy using potential.

property potential_object

Return the calculator potential as a Potential object.

change_task(task, retain_values=False)[source]

Change the persistent default input-parameter task.