airsspy.restools#

Tools for handling res files

Module Contents#

Classes#

RESFile

Class representing a RES file.

Functions#

extract_res

Extract information from res file. Returns a dictionary. The structure of he res file is not extracted

save_airss_res

Save the relaxed structure in res format which is compatible with the cryan program.

parse_titl

Parse TITL line and return a TitlInfo object

read_res_atoms

Read a RES file, return as (TitlInfo, ase.Atoms)

read_res_pmg

Read a RES file, return as (TitlInfo, rem_lines, pymatgen.Structure, spins)

get_spacegroup_atoms

Get spacegroup of atoms using spglib

get_minsep

Calculate minimum separations given species and distance matrix

format_minsep

Return string representation of the minimum separations

Data#

API#

airsspy.restools.extract_res(fname: str) Dict[str, Union[str, float, int, List[str]]][source]#

Extract information from res file. Returns a dictionary. The structure of he res file is not extracted

airsspy.restools.save_airss_res(atoms: ase.Atoms, info_dict: Dict[str, Any], fname: Optional[str] = None, force_write: bool = False) None[source]#

Save the relaxed structure in res format which is compatible with the cryan program.

airsspy.restools.TITLE_KEYS#

[‘label’, ‘pressure’, ‘volume’, ‘enthalpy’, ‘spin’, ‘spin_abs’, ‘natoms’, ‘symm’, ‘flag1’, ‘flag2’, …

airsspy.restools.TitlInfo#

‘namedtuple(…)’

airsspy.restools.RES_COORD_PATT#

‘compile(…)’

airsspy.restools.RES_COORD_PATT_WITH_SPIN#

‘compile(…)’

airsspy.restools.parse_titl(line: str) airsspy.restools.TitlInfo[source]#

Parse TITL line and return a TitlInfo object

airsspy.restools.read_res_atoms(lines: List[str]) Tuple[airsspy.restools.TitlInfo, ase.Atoms][source]#

Read a RES file, return as (TitlInfo, ase.Atoms)

airsspy.restools.read_res_pmg(lines: List[str]) Tuple[airsspy.restools.TitlInfo, List[str], Optional[pymatgen.core.Structure], List[float]][source]#

Read a RES file, return as (TitlInfo, rem_lines, pymatgen.Structure, spins)

airsspy.restools.get_spacegroup_atoms(atoms: ase.Atoms, symprec: float = 1e-05, angle_tolerance: float = -1.0) str[source]#

Get spacegroup of atoms using spglib

airsspy.restools.get_minsep(species: List[str], distance_matrix: numpy.ndarray) Dict[str, float][source]#

Calculate minimum separations given species and distance matrix

Args: species: A list of species symbols distance_matrix: The distance matrix

Returns: Dictionary of {set(s1, s2): minsep}

airsspy.restools.format_minsep(minsep: Dict[str, float]) str[source]#

Return string representation of the minimum separations

class airsspy.restools.RESFile(structure: Union[ase.Atoms, pymatgen.core.Structure, None], data: Dict[str, Any], lines: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None)[source]#

Class representing a RES file.

The SHELX file contains both the structure and computed properties as well as metadata.

Initialization

Initialize a RESFile object.

Args: structure: ASE Atoms or pymatgen Structure instance data: Dictionary containing underlying data lines: Raw lines of the RES file metadata: Additional metadata

property rem: Optional[List[str]]#

REM lines

property atoms: Optional[ase.Atoms]#

Returns an ASE Atoms object

property data: Dict[str, Any]#

Underlying data of the object

property label: Optional[str]#

Label of the structure

property name: Optional[str]#

Alias for label

property enthalpy: Optional[float]#

Enthalpy as reported

property volume: Optional[float]#

Volume as reported

property pressure: float#

External pressure as reported

property natoms: Optional[int]#

Number of atoms

property symm: Optional[str]#

Symmetry as reported

property spin: float#

Spin as reported

property spins: List[float]#

Spin values for each atom

property spin_abs: float#

Absolute integrated spin

property composition: Optional[Any]#

Composition of the structure

property formula: str#

Formula of the structure

property reduced_formula: str#

Reduced formula of the structure

classmethod from_string(string: str) airsspy.restools.RESFile[source]#

Construct from a string

classmethod from_lines(lines: List[str], include_structure: bool = True, only_titl: bool = False) airsspy.restools.RESFile[source]#

Construct from lines

load_structure() None[source]#

Load structure from the lines

classmethod from_file(fname: str, include_structure: bool = True, only_titl: bool = False) airsspy.restools.RESFile[source]#

Construct from a file

to_res_lines() List[str][source]#

Get the raw RES representation of this object

get_minsep(string: bool = False) Union[Dict[str, float], str][source]#

Return species-wise minimum separations

__repr__() str[source]#