airsspy.scftools#

SCF convergence analysis tools for CASTEP calculations.

Provides the SCFInfo class for parsing, summarising, and plotting self-consistent field (SCF) convergence data from .castep output files.

Module Contents#

Classes#

SCFInfo

Class for storing and extracting SCF convergence information.

API#

class airsspy.scftools.SCFInfo(castep_file: str)[source]#

Class for storing and extracting SCF convergence information.

Parses SCF loop data (energy, Fermi energy, energy gain, timing) from a CASTEP .castep file and provides summary statistics and plotting methods.

Initialization

Construct an SCFInfo object from a .castep file.

Args: castep_file: Path to the .castep file.

SCF_LINE#

‘compile(…)’

ScfData#

‘namedtuple(…)’

__len__() int[source]#
reload() None[source]#

Re-read the .castep file and reparse.

parse(lines) list[airsspy.scftools.SCFInfo][source]#

Parse SCF loop data from lines of a .castep file.

Args: lines: Iterable of lines from the .castep file.

Returns: A list of ScfData namedtuples, one per geometry step.

compute_converge_data() None[source]#

Compute summary convergence information across ionic steps.

get_summary() dict[str, float][source]#

Obtain summary statistics.

Returns: Dictionary with avg_ionic_time, avg_elec_time, avg_elec_steps, ionic_steps, and total_time.

plot_scf(scf_no: int, xaxis: str = 'loops', show: bool = True)[source]#

Plot SCF convergence for a single geometry step.

Args: scf_no: Index of the SCF cycle to plot. xaxis: Which x-axis data to use ("loops" or "timers"). show: Whether to call fig.show().

Returns: The matplotlib Figure object.

plot_conv(axs=None, show: bool = True)[source]#

Plot convergence summary across all ionic steps.

Args: axs: Optional matplotlib axes (4 subplots). Created if None. show: Whether to show the figure.

Returns: The matplotlib Figure object (or None if axs was provided).