aiida.tools package

Tools to operate on AiiDA ORM class instances

What functionality should go directly in the ORM class in aiida.orm and what in aiida.tools?

  • The ORM class should define basic functions to set and get data from the object
  • More advanced functionality to operate on the ORM class instances can be placed in aiida.tools
    to prevent the ORM namespace from getting too cluttered.

Note

Modules in this sub package may require the database environment to be loaded

class aiida.tools.CalculationTools(node)[source]

Bases: object

Base class for CalculationTools.

__dict__ = mappingproxy({'__module__': 'aiida.tools.calculations.base', '__doc__': 'Base class for CalculationTools.', '__init__': <function CalculationTools.__init__>, '__dict__': <attribute '__dict__' of 'CalculationTools' objects>, '__weakref__': <attribute '__weakref__' of 'CalculationTools' objects>})
__init__(node)[source]

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'aiida.tools.calculations.base'
__weakref__

list of weak references to the object (if defined)

aiida.tools.get_kpoints_path(structure, method='seekpath', **kwargs)[source]

Returns a dictionary whose contents depend on the method but includes at least the following keys

  • parameters: Dict node

The contents of the parameters depends on the method but contains at least the keys

  • ‘point_coords’: a dictionary with ‘kpoints-label’: [float coordinates]
  • ‘path’: a list of length-2 tuples, with the labels of the starting
    and ending point of each label section

The ‘seekpath’ method which is the default also returns the following additional nodes

  • primitive_structure: StructureData with the primitive cell
  • conv_structure: StructureData with the conventional cell

Note that the generated kpoints for the seekpath method only apply on the returned primitive_structure and not on the input structure that was provided

Parameters:
  • structure – a StructureData node
  • method – the method to use for kpoint generation, options are ‘seekpath’ and ‘legacy’. It is strongly advised to use the default ‘seekpath’ as the ‘legacy’ implementation is known to have bugs for certain structure cells
  • kwargs – optional keyword arguments that depend on the selected method
Returns:

dictionary as described above in the docstring

aiida.tools.get_explicit_kpoints_path(structure, method='seekpath', **kwargs)[source]

Returns a dictionary whose contents depend on the method but includes at least the following keys

  • parameters: Dict node
  • explicit_kpoints: KpointsData node with explicit kpoints path

The contents of the parameters depends on the method but contains at least the keys

  • ‘point_coords’: a dictionary with ‘kpoints-label’: [float coordinates]
  • ‘path’: a list of length-2 tuples, with the labels of the starting
    and ending point of each label section

The ‘seekpath’ method which is the default also returns the following additional nodes

  • primitive_structure: StructureData with the primitive cell
  • conv_structure: StructureData with the conventional cell

Note that the generated kpoints for the seekpath method only apply on the returned primitive_structure and not on the input structure that was provided

Parameters:
  • structure – a StructureData node
  • method – the method to use for kpoint generation, options are ‘seekpath’ and ‘legacy’. It is strongly advised to use the default ‘seekpath’ as the ‘legacy’ implementation is known to have bugs for certain structure cells
  • kwargs – optional keyword arguments that depend on the selected method
Returns:

dictionary as described above in the docstring

aiida.tools.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.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.
class aiida.tools.DbImporter[source]

Bases: object

Base class for database importers.

__dict__ = mappingproxy({'__module__': 'aiida.tools.dbimporters.baseclasses', '__doc__': '\n Base class for database importers.\n ', 'query': <function DbImporter.query>, 'setup_db': <function DbImporter.setup_db>, 'get_supported_keywords': <function DbImporter.get_supported_keywords>, '__dict__': <attribute '__dict__' of 'DbImporter' objects>, '__weakref__': <attribute '__weakref__' of 'DbImporter' objects>})
__module__ = 'aiida.tools.dbimporters.baseclasses'
__weakref__

list of weak references to the object (if defined)

get_supported_keywords()[source]

Returns the list of all supported query keywords.

Returns:list of strings
query(**kwargs)[source]

Method to query the database.

Parameters:
  • id – database-specific entry identificator
  • element – element name from periodic table of elements
  • number_of_elements – number of different elements
  • mineral_name – name of mineral
  • chemical_name – chemical name of substance
  • formula – chemical formula
  • volume – volume of the unit cell in cubic angstroms
  • spacegroup – symmetry space group symbol in Hermann-Mauguin notation
  • spacegroup_hall – symmetry space group symbol in Hall notation
  • a – length of lattice vector in angstroms
  • b – length of lattice vector in angstroms
  • c – length of lattice vector in angstroms
  • alpha – angles between lattice vectors in degrees
  • beta – angles between lattice vectors in degrees
  • gamma – angles between lattice vectors in degrees
  • z – number of the formula units in the unit cell
  • measurement_temp – temperature in kelvins at which the unit-cell parameters were measured
  • measurement_pressure – pressure in kPa at which the unit-cell parameters were measured
  • diffraction_temp – mean temperature in kelvins at which the intensities were measured
  • diffraction_pressure – mean pressure in kPa at which the intensities were measured
  • authors – authors of the publication
  • journal – name of the journal
  • title – title of the publication
  • year – year of the publication
  • journal_volume – journal volume of the publication
  • journal_issue – journal issue of the publication
  • first_page – first page of the publication
  • last_page – last page of the publication
  • doi – digital object identifyer (DOI), refering to the publication
Raises:

NotImplementedError – if search using given keyword is not implemented.

setup_db(**kwargs)[source]

Sets the database parameters. The method should reconnect to the database using updated parameters, if already connected.