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.
SPRKKRis 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
AtomsandPotentialobjects 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 returnedPreparedCalculationowns 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
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
InputParametersused 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)
- 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
Falsefor a temporary run directory.
- 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.
InputParametersare copied before one-shot task/options and generated file values are applied. SelectedAtomsandPotentialobjects are not deep-copied and may be normalized or synchronized during preparation. The returnedPreparedCalculationowns all concrete files and temporary directory resources, so subsequent physical-state changes do not alter the already materialized run. CallPreparedCalculation.close()when the object is not transferred to a runner.- Parameters:
directory (str | bool | ase2sprkkr.common.file_utils.Directory | None)
create_subdirs (bool)
allow_temporary_files (bool)
restart_scf (bool)
- 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.Falseasinput_fileorpotential_filerequests a managed named temporary artifact. Temporary artifacts are useful for an executing runner, butsave_inputcannot return ownership of a temporary POTFIL because its public tuple exposes only the pathname. Supply a persistent POTFIL name whenreturn_files=True.directory=Falseis intentionally rejected here: a temporary directory is owned naturally by a runner, whereas returning filenames fromsave_inputafter deleting their directory would be invalid. Usecreate_run()/calculatefor temporary run directories.- Parameters:
directory (str | bool | ase2sprkkr.common.file_utils.Directory | None)
create_subdirs (bool)
restart_scf (bool)
- 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=Nonestores stderr next to stdout as<output>.err.error_file=Truedeliberately merges stderr intooutput_file;Falserequests a managed temporary stderr file, and an explicit path or file object stores stderr there instead.callbackis a terminal runner callback. It can therefore be invoked with a partially populated result when backend execution or parsing fails.read_callbackobserves streamed stdout/stderr.- Parameters:
directory (str | bool | ase2sprkkr.common.file_utils.Directory | None)
create_subdirs (bool)
empty_spheres (str | bool | None)
read_callback (callable | None)
profile (ase2sprkkr.sprkkr.profile.SPRKKRProfile | None)
restart_scf (bool)
- _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.
propertiesandsystem_changesare accepted for ASE compatibility. SPR-KKR execution is task-oriented, sopropertiesdoes not select a different backend task andsystem_changesis not used for incremental updates; each run materializes the complete supplied calculation state. Per-callmpi,executable_dirandexecutable_suffixvalues 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’sCalculationFailedbefore 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)
- _abc_impl = <_abc._abc_data object>
- run_xband(executable='xband')[source]
Start the external
xbandexecutable detached from calculator IO.
- property potential_object
Return the calculator potential as a
Potentialobject.