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.toolsto prevent the ORM namespace from getting too cluttered.
The ORM class should define basic functions to set and get data from the object
to prevent the ORM namespace from getting too cluttered.
Note
Modules in this sub package may require the database environment to be loaded
aiida.tools.
CalculationTools
Bases: object
object
Base class for CalculationTools.
__dict__
__init__
Initialize self. See help(type(self)) for accurate signature.
__module__
__weakref__
list of weak references to the object (if defined)
DbImporter
Base class implementation for an external database importer.
get_supported_keywords
Returns the list of all supported query keywords.
list of strings
query
Method to query the database.
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
NotImplementedError – if search using given keyword is not implemented.
setup_db
Sets the database parameters. The method should reconnect to the database using updated parameters, if already connected.
delete_group_nodes
Delete nodes contained in a list of groups (not the groups themselves!).
This command will delete not only the nodes, but also the ones that are linked to these and should be also deleted in order to keep a consistent provenance according to the rules explained in the concepts section of the documentation. In summary:
If a DATA node is deleted, any process nodes linked to it will also be deleted.
2. If a CALC node is deleted, any incoming WORK node (callers) will be deleted as well whereas any incoming DATA node (inputs) will be kept. Outgoing DATA nodes (outputs) will be deleted by default but this can be disabled.
3. If a WORK node is deleted, any incoming WORK node (callers) will be deleted as well, but all DATA nodes will be kept. Outgoing WORK or CALC nodes will be kept by default, but deletion of either of both kind of connected nodes can be enabled.
These rules are ‘recursive’, so if a CALC node is deleted, then its output DATA nodes will be deleted as well, and then any CALC node that may have those as inputs, and so on.
pks – a list of the groups
dry_run – If True, return the pks to delete without deleting anything. If False, delete the pks without confirmation If callable, a function that return True/False, based on the pks, e.g. dry_run=lambda pks: True
dry_run=lambda pks: True
traversal_rules – graph traversal rules. See aiida.common.links.GraphTraversalRules what rule names are toggleable and what the defaults are.
aiida.common.links.GraphTraversalRules
(node pks to delete, whether they were deleted)
delete_nodes
Delete nodes given a list of “starting” PKs.
This command will delete not only the specified nodes, but also the ones that are linked to these and should be also deleted in order to keep a consistent provenance according to the rules explained in the Topics - Provenance section of the documentation. In summary:
Deprecated since version 1.6.0: The verbosity keyword will be removed in v2.0.0, set the level of DELETE_LOGGER instead.
Deprecated since version 1.6.0: The force keyword will be removed in v2.0.0, use the dry_run option instead.
pks – a list of starting PKs of the nodes to delete (the full set will be based on the traversal rules)
traversal_rules – graph traversal rules. See aiida.common.links.GraphTraversalRules for what rule names are toggleable and what the defaults are.
(pks to delete, whether they were deleted)
get_explicit_kpoints_path
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
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 startingand ending point of each label section
‘point_coords’: a dictionary with ‘kpoints-label’: [float coordinates]
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
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
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
dictionary as described above in the docstring
get_kpoints_path
spglib_tuple_to_structure
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.
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.
structure_to_spglib_tuple
Convert an AiiDA structure to a tuple of the format (cell, scaled_positions, element_numbers).
structure – the AiiDA structure
(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.