castep_outputs.tools.get_generated_files#

Attempt to guess the files which will be output by the castep calculation.

Notes

This is based on the working version of CASTEP, so many not exactly align with the last release.

Functions

get_generated_files([seedname, param_file, ...])

Predict files which would be produced by running inputs.

get_spectral_files(param_data, seedname, *, ...)

Get files associated with Task = Spectral.

get_xc_info(param_data)

Get relevant info from the XC parameters.

Classes

MagresTask(value)

Magres tasks.

SpectralTask(value)

Spectral tasks.

SpectralTheory(value)

Spectral theories.

Task(value)

CASTEP tasks.

UCEnum(value)

Auto upperclass enum.

class castep_outputs.tools.get_generated_files.MagresTask(value)[source]#

Bases: UCEnum

Magres tasks.

class castep_outputs.tools.get_generated_files.SpectralTask(value)[source]#

Bases: UCEnum

Spectral tasks.

class castep_outputs.tools.get_generated_files.SpectralTheory(value)[source]#

Bases: UCEnum

Spectral theories.

class castep_outputs.tools.get_generated_files.Task(value)[source]#

Bases: UCEnum

CASTEP tasks.

class castep_outputs.tools.get_generated_files.UCEnum(value)[source]#

Bases: Enum

Auto upperclass enum.

castep_outputs.tools.get_generated_files.get_generated_files(seedname='seedname', /, *, param_file=None, cell_file=None)[source]#

Predict files which would be produced by running inputs.

Parameters:
  • seedname (Path | str, optional) – Seedname of files to parse.

  • param_file (Path | str, optional) – Pre-parsed param file.

  • cell_file (Path | str, optional) – Pre-parsed cell file.

Returns:

Files which would be produced.

Return type:

set[str]

Notes

May struggle to get exact information from complex xc_definitions.

castep_outputs.tools.get_generated_files.get_spectral_files(param_data, seedname, *, is_nlxc)[source]#

Get files associated with Task = Spectral.

Parameters:
  • param_data (CellParamData) – Dict containing parameters.

  • seedname (str) – Current seedname.

  • is_nlxc (bool) – Whether XC functional is non-local.

Returns:

Files generated in spectral task.

Return type:

set[str]

Raises:

KeyError – Impossible combination.

castep_outputs.tools.get_generated_files.get_xc_info(param_data)[source]#

Get relevant info from the XC parameters.

Returns a reduced form of libxc

Parameters:

param_data (CellParamData) – Param file data containing functional definition.

Returns:

Active xc functionals.

Return type:

set[str]

Examples

>>> get_xc_info({"xc_functional": "pbe"})
{'pbe'}
>>> get_xc_info({"xc_functional": "pbe",  # xc_definition takes priority like castep.
...              "xc_definition": {"xc": {"lda": 1.}}})
{'lda'}
>>> sorted(   # Sorted to force set order.
... get_xc_info({"xc_definition": {"xc": {"pbe": 0.25,
...                                       "libxc_gga_x_2d_b86_mgc": 0.25,
...                                       "libxc_lda_c_vwn": 0.25,
...                                       "libxc_hyb_mgga_xc_revtpssh": 0.25}}})
... )
['libxc_gga', 'libxc_hyb_mgga', 'libxc_lda', 'pbe']