airsspy.analysis.collect#

Data collection and analysis utilities for AIRSS search results.

Provides functions for collecting RES file data into DataFrames, reading ca command output, combining similar structures via cryan, and computing minsep ranges from ensembles.

Module Contents#

Functions#

read_stream

Read from a stream of RES file contents and return lists of TitlInfo and Atoms objects.

read_ca

Read results from the ca command into a DataFrame.

collect_res_in_df

Collect a list of RESFile objects into a DataFrame.

combine_res_cryan

Reduce similar structures using the cryan command.

get_minsep_range

Create ranged minseps from an ensemble of minsep entries.

get_entry

Create ComputedEntry objects from a DataFrame containing structure data.

export_dataframe_as_res

Write all structures in a DataFrame into RES format for export.

get_pressure_gpa

Convert a stress tensor to isostatic pressure in GPa.

API#

airsspy.analysis.collect.read_stream(stream) tuple[list, list][source]#

Read from a stream of RES file contents and return lists of TitlInfo and Atoms objects.

Args: stream: Iterable of lines from concatenated RES files.

Returns: Tuple of (titl_list, atoms_list).

airsspy.analysis.collect.read_ca(lines: list[str]) pandas.DataFrame[source]#

Read results from the ca command into a DataFrame.

Args: lines: String lines as returned by the ca command.

Returns: A DataFrame with columns for label, pressure, volume, enthalpy, spin info, formula, symmetry, etc.

airsspy.analysis.collect.collect_res_in_df(res_collection: list[airsspy.restools.RESFile], norm_mode: str = 'per_atom') pandas.DataFrame[source]#

Collect a list of RESFile objects into a DataFrame.

Args: res_collection: A collection of RESFile objects. norm_mode: Normalisation mode for energy and volume. "per_atom" (default) or "per_formula_unit".

Returns: A DataFrame with collected data from the RESFile objects.

airsspy.analysis.collect.combine_res_cryan(dframe: pandas.DataFrame, thres: float = 0.1, ntop: int = 30) pandas.DataFrame[source]#

Reduce similar structures using the cryan command.

Args: dframe: DataFrame with a res column containing RESFile objects. thres: Threshold for combining structures. ntop: The number of top structures to be returned.

Returns: A DataFrame of output from the cryan command.

airsspy.analysis.collect.get_minsep_range(minseps: list[dict[str, float]], cap: Optional[tuple[float, float]] = None) dict[str, list[float]][source]#

Create ranged minseps from an ensemble of minsep entries.

Args: minseps: A list of minsep dictionaries (species pair -> distance). cap: Optional (min, max) cap for distances.

Returns: A dictionary mapping species pairs to [min, max] ranges.

airsspy.analysis.collect.get_entry(dataframe: pandas.DataFrame, pmg_col: str = 'pmg_struct', label_col: str = 'label', uuid_col: str = 'uuid', umap_col: str = 'umap', xc_col: str = 'functional', eng_col: str = 'energy') list[pymatgen.entries.computed_entries.ComputedEntry][source]#

Create ComputedEntry objects from a DataFrame containing structure data.

Args: dataframe: DataFrame with structure and energy data. pmg_col: Column name for pymatgen Structure objects. label_col: Column name for structure labels. uuid_col: Column name for UUIDs. umap_col: Column name for Hubbard U mapping. xc_col: Column name for functional labels. eng_col: Column name for energy values.

Returns: A list of ComputedEntry objects.

airsspy.analysis.collect.export_dataframe_as_res(dataframe: pandas.DataFrame, comment: str = 'VASP export', extra_comments: Optional[list] = None, stress_key: Optional[str] = None) None[source]#

Write all structures in a DataFrame into RES format for export.

Creates an exports/ directory and writes one .res file per row.

Args: dataframe: DataFrame with structure and energy data. Must have pmg_struct_relaxed, energy_per_atom, volume_per_fu, nform_refine, and label columns. comment: Comment to include in REM lines. extra_comments: Additional REM comment strings. stress_key: Column name for stress data (optional).

airsspy.analysis.collect.get_pressure_gpa(stress: Union[list, numpy.ndarray]) float[source]#

Convert a stress tensor to isostatic pressure in GPa.

Args: stress: A 3x3 stress tensor (in kBar units).

Returns: The isostatic pressure in GPa.