aiida_quantumespresso.workflows.protocols.utils#

Utilities to manipulate the workflow input protocols.

Module Contents#

Classes#

ProtocolMixin

Utility class for processes to build input mappings for a given protocol based on a YAML configuration file.

Functions#

recursive_merge(→ dict)

Recursively merge two dictionaries into a single dictionary.

get_magnetization_parameters(→ dict)

Return the mapping of suggested initial magnetic moments for each element.

get_starting_magnetization(→ dict)

Return the dictionary with starting magnetization for each kind in the structure.

class aiida_quantumespresso.workflows.protocols.utils.ProtocolMixin[source]#

Utility class for processes to build input mappings for a given protocol based on a YAML configuration file.

abstract classmethod get_protocol_filepath() pathlib.Path[source]#

Return the pathlib.Path to the .yaml file that defines the protocols.

classmethod get_default_protocol() str[source]#

Return the default protocol for a given workflow class.

Parameters:

cls – the workflow class.

Returns:

the default protocol.

classmethod get_available_protocols() dict[source]#

Return the available protocols for a given workflow class.

Parameters:

cls – the workflow class.

Returns:

dictionary of available protocols, where each key is a protocol and value is another dictionary that contains at least the key description and optionally other keys with supplementary information.

classmethod get_protocol_inputs(protocol: dict | None = None, overrides: dict | pathlib.Path | None = None) dict[source]#

Return the inputs for the given workflow class and protocol.

Parameters:
  • cls – the workflow class.

  • protocol – optional specific protocol, if not specified, the default will be used

  • overrides – dictionary of inputs that should override those specified by the protocol. The mapping should maintain the exact same nesting structure as the input port namespace of the corresponding workflow class.

Returns:

mapping of inputs to be used for the workflow class.

classmethod _load_protocol_file() dict[source]#

Return the contents of the protocol file for workflow class.

aiida_quantumespresso.workflows.protocols.utils.recursive_merge(left: dict, right: dict) dict[source]#

Recursively merge two dictionaries into a single dictionary.

If any key is present in both left and right dictionaries, the value from the right dictionary is assigned to the key.

Parameters:
  • left – first dictionary

  • right – second dictionary

Returns:

the recursively merged dictionary

aiida_quantumespresso.workflows.protocols.utils.get_magnetization_parameters() dict[source]#

Return the mapping of suggested initial magnetic moments for each element.

Returns:

the magnetization parameters.

aiida_quantumespresso.workflows.protocols.utils.get_starting_magnetization(structure: aiida.orm.StructureData, pseudo_family: aiida_pseudo.groups.family.PseudoPotentialFamily, initial_magnetic_moments: dict | None = None) dict[source]#

Return the dictionary with starting magnetization for each kind in the structure.

Parameters:
  • structure – the structure.

  • pseudo_family – pseudopotential family.

  • initial_magnetic_moments – dictionary mapping each kind in the structure to its magnetic moment.

Returns:

dictionary of starting magnetizations.