airsspy.jf.runners#
Execution runners for AIRSS calculations.
Pure computation classes with no jobflow dependency. Each runner handles one buildcell invocation or one CASTEP relaxation cycle. They are usable standalone or within jobflow Makers.
Module Contents#
Classes#
Execute a CASTEP single-point calculation. |
|
Execute a cyclic CASTEP geometry optimisation. |
|
Base runner for external AIRSS relaxation scripts (gulp_relax, pp3_relax). |
|
Runner for GULP relaxation via the external |
|
Runner for pp3 relaxation via the external |
|
Execute a local VASP relaxation in |
|
Execute a local VASP single-point calculation. |
|
Execute a cyclic ABACUS geometry optimisation. |
|
Execute a single ABACUS single-point (SCF) calculation. |
Functions#
Remove files associated with a failed calculation. |
|
Run the buildcell executable to generate a random structure. |
|
Extract results from a completed CASTEP calculation. |
Data#
API#
- airsspy.jf.runners.logger#
‘getLogger(…)’
- airsspy.jf.runners.clean_files(struct_name: str, extensions: list[str], extra_paths: list[str] | None = None) None[source]#
Remove files associated with a failed calculation.
Args: struct_name: Structure name (without extension). extensions: File extensions to remove (e.g.
[".castep", ".cell"]). extra_paths: Additional paths to remove (files or directories).
- airsspy.jf.runners.run_buildcell(seed_name: str, seed_content: str, build_timeout: int = 30, write_seed: bool = True, seed_text_transform=None, max_attempts: int = 3) Optional[dict[str, str]][source]#
Run the buildcell executable to generate a random structure.
Args: seed_name: Name of the seed (without extension). seed_content: Content of the seed .cell file. build_timeout: Timeout in seconds for each buildcell attempt. write_seed: Whether to write the seed .cell file to disk. seed_text_transform: Optional callable that rewrites seed content before each buildcell attempt. max_attempts: Maximum number of buildcell attempts.
Returns: Dictionary with
struct_name,seed_name,seed_hash,struct_contentkeys, or None if all attempts timed out.
- class airsspy.jf.runners.AirssCastepSinglePointRunner(executable: str = 'castep.mpi')[source]#
Execute a CASTEP single-point calculation.
Initialization
- class airsspy.jf.runners.AirssCastepRelaxRunner(executable: str = 'castep.mpi', max_fails: int = 2, max_iterations: int = 200)[source]#
Bases:
airsspy.jf.runners.AirssCastepSinglePointRunnerExecute a cyclic CASTEP geometry optimisation.
Runs successive relaxations, copying the output cell back to the input between cycles. Requires two consecutive successful runs to declare convergence. Stops at max_iterations.
Initialization
- run(struct_name: str, cellinput, paraminput) int[source]#
Run cyclic CASTEP relaxation.
Args: struct_name: Seed name (without extension). cellinput: Cell input (CellInput instance or string). paraminput: Param input (ParamInput instance or string).
Returns: 0 if converged, 1 if not converged or failed.
- airsspy.jf.runners.compose_task_doc(struct_name: str) dict[source]#
Extract results from a completed CASTEP calculation.
Reads the .castep and .cell files, computes derived properties, writes a
<struct_name>.resfile to disk, and returns a dictionary suitable for constructing anAirssResultDoc.Args: struct_name: Seed name (without extension).
Returns: Dictionary with energy, structure, volume, formula, etc.
- class airsspy.jf.runners.AirssScriptRelaxRunner(executable: str = 'gulp', timeout: int = 600, max_attempts: int = 3)[source]#
Base runner for external AIRSS relaxation scripts (gulp_relax, pp3_relax).
Calls an external script and checks the output file for success. Subclasses must override
_get_cmdand set_param_suffix.Initialization
- run(struct_name: str, struct_content: str, param_content: str, seed_name: Optional[str] = None) int[source]#
Run relaxation via the external script.
Args: struct_name: Structure name (without extension). struct_content: Content of the .cell file. param_content: Content of the code-specific param file. seed_name: Seed name (needed by GULP for .lib file rename).
Returns: 0 on success, 1 on failure.
- class airsspy.jf.runners.AirssGulpRelaxRunner(executable: str = 'ggulp', timeout: int = 600, max_attempts: int = 3, cluster: bool = False, pressure: float = 0.0)[source]#
Bases:
airsspy.jf.runners.AirssScriptRelaxRunnerRunner for GULP relaxation via the external
gulp_relaxscript.Calls
gulp_relax <exe> <cluster> <pressure> <struct_name>and checks for success viagulp_relax_finish_ok()and"Volume"in stdout.Initialization
- class airsspy.jf.runners.AirssPp3RelaxRunner(executable: str = 'pp3', timeout: int = 600, max_attempts: int = 3)[source]#
Bases:
airsspy.jf.runners.AirssScriptRelaxRunnerRunner for pp3 relaxation via the external
pp3_relaxscript.Calls
pp3_relax <exe> <struct_name>and checks for success viagulp_relax_finish_ok().Initialization
- class airsspy.jf.runners.AirssVaspRelaxRunner(executable: str = 'vasp_std', pressure: float = 0.0, potcar_dir: str | None = None, potcar_map: dict[str, str] | None = None, max_fails: int = 2, max_iterations: int = 200)[source]#
Execute a local VASP relaxation in
<struct_name>.vasp.Initialization
- prepare_inputs(struct_name: str, cell_content: str, incar_content: str, kpoints_path: str | pathlib.Path | None = None) dict[source]#
Write top-level AIRSS inputs and prepare VASP input directory.
- run(struct_name: str, cell_content: str, incar_content: str, kpoints_path: str | pathlib.Path | None = None) int[source]#
Run a cyclic VASP relaxation.
As with the CASTEP runner, two consecutive converged VASP runs are required before declaring success. Between cycles,
CONTCARis copied back toPOSCARso the next invocation continues from the last relaxed geometry.
- class airsspy.jf.runners.AirssVaspSinglePointRunner(executable: str = 'vasp_std', pressure: float = 0.0, potcar_dir: str | None = None, potcar_map: dict[str, str] | None = None, max_fails: int = 2, max_iterations: int = 200)[source]#
Bases:
airsspy.jf.runners.AirssVaspRelaxRunnerExecute a local VASP single-point calculation.
Initialization
- class airsspy.jf.runners.AirssAbacusRelaxRunner(executable: str = 'abacus', max_fails: int = 2, max_iterations: int = 200, pressure: float = 0.0)[source]#
Execute a cyclic ABACUS geometry optimisation.
Calls the ABACUS binary directly and manages the relaxation loop in Python, following the same two-phase pattern as
abacus_relax:Three short rough runs with
relax_nmax=3Full convergence loop until two successive convergences
Between each ABACUS invocation, the structure is read from
STRU_ION_D, converted back to .cell format, and fed into the next iteration.Initialization
- prepare_inputs(struct_name: str, cell_content: str, input_content: str) None[source]#
Write .cell and .INPUT files, convert .cell to STRU.
Args: struct_name: Structure name (without extension). cell_content: Content of the .cell file. input_content: Content of the ABACUS INPUT file.
- run(struct_name: str, cell_content: str, input_content: str) int[source]#
Run cyclic ABACUS relaxation.
Phase 1: three rough runs with relax_nmax=3 for initial optimisation. Phase 2: full convergence loop until two consecutive convergences or max_iterations is reached.
Args: struct_name: Structure name (without extension). cell_content: Content of the .cell file. input_content: Content of the ABACUS INPUT file.
Returns: 0 if converged, 1 if not converged or failed.
- class airsspy.jf.runners.AirssAbacusSinglePointRunner(executable: str = 'abacus')[source]#
Execute a single ABACUS single-point (SCF) calculation.
Runs ABACUS once with
calculation scfin the INPUT file. No cyclic relaxation loop. Checks forTOTAL Timein the output to determine success.Initialization