Extracting data from the Database¶
In this section we will overview some of the tools provided by AiiDA by means of you can navigate through the data inside the AiiDA database.
Finding input and output nodes¶
Let’s start with a reference node that you loaded from the database, for example the node with PK 17:
n = load_node(17)
Now, we want to find the nodes which have a direct link to this node.
There are several methods to extract this information (for developers see all
the methods and their docstring:
The most practical way to access this information, especially when working on
verdi shell, is by means of the
inp method is used to list and access the nodes with a direct link to
n in input.
The names of the input links can be printed by
list(n.inp) or interactively
n.inp. + TAB.
As an example, suppose that
n has an input
KpointsData object under the linkname
kpoints. The command:
Similar methods exists for the
out method, which will display the names of
links in output from
n and can be used to access such output nodes.
n has an output
FolderData with linkname
returns the FolderData object.
At variance with input, there can be more than one output
objects with the same linkname (for example: a code object can be used by several
calculations always with the same linkname
As such, for every output linkname, we append the string
_pk, with the pk of
the output node. There is also a linkname without pk appended, which is
assigned to the oldest link. As an example, imagine that
n is a code, which
is used by calculation #18 and #19, the linknames shown by
n.out. >> * code * code_18 * code_19
n.out.code_19 will return two different
calculation objects, and
n.out.code will return the oldest (the reference
is the creation time) between calculation
18 and 19. If one calculation (say 18) exist only in output, there is then less
ambiguity, and you are sure that the output of
n.out.code coincides with