Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the outdate calculation restart utilities #303

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 7 additions & 35 deletions aiida_quantumespresso/utils/pseudopotential.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,30 +45,6 @@ def validate_and_prepare_pseudos_inputs(structure, pseudos=None, pseudo_family=N
return pseudos


def get_pseudos_of_calc(calc):
"""
Return a dictionary of pseudos used by a given (pw.x, cp.x) calculation.

This returns a dictionary ``pseudos`` that can be set in a builder as ``builder.pseudo = pseudos``.

:param calc: a pw.x or cp.x calculation.
:return: a dictionary where the key is the kind name and the value is the UpfData object.
"""
from aiida.common.links import LinkType

pseudos = {}
# I create here a dictionary that associates each kind name to a pseudo
inputs = calc.get_incoming(link_type=LinkType.INPUT_CALC)
for linkname in inputs.keys():
if linkname.startswith(calc._get_linkname_pseudo_prefix()):
# Note that this string might be a sequence of kind names
# concatenated by an underscore, see implementation in the
# input plugin implementation.
multiplekindstring = linkname[len(calc._get_linkname_pseudo_prefix()):]
pseudos[multiplekindstring] = inputs[linkname]
return pseudos


def get_pseudos_from_dict(structure, pseudos_uuids):
"""
Given a dictionary in the format::
Expand All @@ -78,16 +54,13 @@ def get_pseudos_from_dict(structure, pseudos_uuids):
'C': '08ad7d53-b7cc-45d5-acb8-13530790b751',
}

(i.e., associating a chemical element name to a UUID of a UpfData node
in the database), and a AiiDA structure, return a dictionary
associating each kind name with its UpfData object.
i.e., associating a chemical element name to a UUID of a `UpfData` node in the database, and a `StructureData`
return a dictionary associating each kind name with its `UpfData` object.

:param structure: a StructureData
:param pseudos_uuids: a dictionary of UUIDs of UpfData for each chemical element, as specified above
:raise MultipleObjectsError: if more than one UPF for the same element is
found in the group.
:raise NotExistent: if no UPF for an element in the group is
found in the group.
:param structure: a `StructureData`
:param pseudos_uuids: a dictionary of UUIDs of `UpfData` for each chemical element, as specified above
:raise MultipleObjectsError: if more than one UPF for the same element is found in the group.
:raise NotExistent: if no UPF for an element in the group is found in the group.
"""
from aiida.common import NotExistent
from aiida.orm import load_node
Expand All @@ -98,8 +71,7 @@ def get_pseudos_from_dict(structure, pseudos_uuids):
try:
uuid = pseudos_uuids[symbol]
except KeyError:
raise NotExistent("No UPF for element {} found in the provided pseudos_uuids dictionary".format(
symbol))
raise NotExistent("No UPF for element {} found in the provided pseudos_uuids dictionary".format(symbol))
try:
upf = load_node(uuid)
except NotExistent:
Expand Down
Loading