aiida.tools.data package#

Tool for handling data.

Subpackages#

Submodules#

Tools to operate on CifData nodes.

exception aiida.tools.data.cif.InvalidOccupationsError[source]#

Bases: Exception

An exception that will be raised if pymatgen fails to parse the structure from a cif because some site occupancies exceed the occupancy tolerance. This often happens for structures that have attached species, such as hydrogen, and specify a placeholder position for it, leading to occupancies greater than one. Pymatgen only issues a warning in this case and simply does not return a structure

__module__ = 'aiida.tools.data.cif'#
__weakref__#

list of weak references to the object (if defined)

aiida.tools.data.cif._get_aiida_structure_ase_inline(cif, **kwargs)[source]#

Creates aiida.orm.nodes.data.structure.StructureData using ASE.

Note

unable to correctly import structures of alloys.

Note

requires ASE module.

aiida.tools.data.cif._get_aiida_structure_pymatgen_inline(cif, **kwargs)[source]#

Creates aiida.orm.nodes.data.structure.StructureData using pymatgen.

Parameters:
  • occupancy_tolerance – If total occupancy of a site is between 1 and occupancy_tolerance, the occupancies will be scaled down to 1.

  • site_tolerance – This tolerance is used to determine if two sites are sitting in the same position, in which case they will be combined to a single disordered site. Defaults to 1e-4.

Note

requires pymatgen module.

aiida.tools.data.cif.refine_inline(node)[source]#

Refine (reduce) the cell of aiida.orm.nodes.data.cif.CifData, find and remove symmetrically equivalent atoms.

Parameters:

node – a aiida.orm.nodes.data.cif.CifData instance.

Returns:

dict with aiida.orm.nodes.data.cif.CifData

Note

can be used as inline calculation.

aiida.tools.data.cif.symop_string_from_symop_matrix_tr(matrix, tr=(0, 0, 0), eps=0)[source]#

Construct a CIF representation of symmetry operator plus translation. See International Tables for Crystallography Vol. A. (2002) for definition.

Parameters:
  • matrix – 3x3 matrix, representing the symmetry operator

  • tr – translation vector of length 3 (default 0)

  • eps – epsilon parameter for fuzzy comparison x == 0

Returns:

CIF representation of symmetry operator

Various utilities to deal with StructureData instances or create new ones (e.g. convert format to/from SPGLIB, create a StructureData from a different format, …)

aiida.tools.data.structure._get_cif_ase_inline(struct, parameters)[source]#

Creates aiida.orm.nodes.data.cif.CifData using ASE.

Note

requires ASE module.

aiida.tools.data.structure.spglib_tuple_to_structure(structure_tuple, kind_info=None, kinds=None)[source]#

Convert a tuple of the format (cell, scaled_positions, element_numbers) to an AiiDA structure.

Unless the element_numbers are identical to the Z number of the atoms, you should pass both kind_info and kinds, with the same format as returned by get_tuple_from_aiida_structure.

Parameters:
  • structure_tuple – the structure in format (structure_tuple, kind_info)

  • kind_info – a dictionary mapping the kind_names to the numbers used in element_numbers. If not provided, assumes {element_name: element_Z}

  • kinds – a list of the kinds of the structure.

aiida.tools.data.structure.structure_to_spglib_tuple(structure)[source]#

Convert an AiiDA structure to a tuple of the format (cell, scaled_positions, element_numbers).

Parameters:

structure – the AiiDA structure

Returns:

(structure_tuple, kind_info, kinds) where structure_tuple is a tuple of format (cell, scaled_positions, element_numbers); kind_info is a dictionary mapping the kind_names to the numbers used in element_numbers. When possible, it uses the Z number of the element, otherwise it uses numbers > 1000; kinds is a list of the kinds of the structure.

aiida.tools.data.structure.xyz_parser_iterator(xyz_string)[source]#

Yields a tuple (natoms, comment, atomiter)`for each frame in a XYZ file where `atomiter is an iterator yielding a nested tuple (symbol, (x, y, z)) for each entry.

Parameters:

xyz_string – a string containing XYZ-structured text