aiida_amber.utils package

Submodules

aiida_amber.utils.node_utils module

Methods for dealing with various types of files and directories that are used in processes and add them to aiida nodes

aiida_amber.utils.node_utils.add_subdir_to_node(dict_info, subdir)[source]

Add a subdir to a node.

aiida_amber.utils.node_utils.check_filepath(input_files: list)[source]

Check if an input is a file or a path.

Parameters:

input_files – The list of inputs to check

Returns:

List of files and list of subdirs

Modified from: https://github.com/sphuber/aiida-shell/blob/master/src/aiida_shell/parsers/shell.py Format the link label from a given filename with prefix. Valid link labels can only contain alphanumeric characters and underscores, without consecutive underscores. So all characters that are not alphanumeric or an underscore are converted to underscores, where consecutive underscores are merged into one. Additional: Label cannot start with a number or underscore.

Parameters:

filename – The filename.

Returns:

The link label.

aiida_amber.utils.searchprevious module

Various functions for searching through previous AiiDA processes and appending nodes from previous processes to current process nodes.

aiida_amber.utils.searchprevious.append_prev_nodes(qb, inputs, process_inputs, INPUT_DIR)[source]

Checks if previous processes exists for genericMD calcs and links the most recent SinglefileData type output nodes from previous processs as inputs to the new process if the file names match.

Parameters:
  • qb (aiida.orm.querybuilder.QueryBuilder) – The query entries of previous processes in the AiiDA database

  • inputs (list) – Input files for the command to be run via AiiDA

  • process_inputs (dict) – All inputs for the current process to be submitted

  • INPUT_DIR – base directory where outputted files are stored.

Returns:

Updated inputs for the current process

Return type:

dict

aiida_amber.utils.searchprevious.build_query()[source]

Uses AiiDA querybuilder to find previously run processes and order from newest to oldest

Returns:

the query entries

Return type:

aiida.orm.querybuilder.QueryBuilder

aiida_amber.utils.searchprevious.check_prev_process(qb)[source]

Wait for a previous process to finish if it is still running. The process state is checked every 10 seconds for up to 5 minutes and stops when the process state is set to finished. If a previous processes takes longer than 5 minutes, the latest submitted process is exited.

Parameters:

qb (aiida.orm.querybuilder.QueryBuilder) – The queries of previous processes in the AiiDA database

aiida_amber.utils.searchprevious.find_previous_file_nodes(qb)[source]

For any previous processes, store nodes that are files into a list

Parameters:

qb (aiida.orm.querybuilder.QueryBuilder) – The queries of previous processes in the AiiDA database

From https://github.com/sphuber/aiida-shell/blob/master/src/aiida_shell/parsers/shell.py Format the link label from a given filename. Valid link labels can only contain alphanumeric characters and underscores, without consecutive underscores. So all characters that are not alphanumeric or an underscore are converted to underscores, where consecutive underscores are merged into one.

Parameters:

filename – The filename to convert to a label.

Returns:

The link label used in AiiDA provenance graphs.

For an incoming process, check if an input file is an output of a previous process. If this is the case, then rename the node with the new label

Parameters:
  • input_file_labels – dictionary with keys of filenames and values the label for the node

  • inputs – dictionary used for all inputs for

aiida_amber.utils.searchprevious.save_command(executable: str, params: dict, inputs: dict)[source]

For a given cli command run via aiida-gromacs, save this as a string and use this as an attribute for the given process

aiida_amber.utils.searchprevious.strip_path(inp: str) str[source]

For a given input, strip the path from the filename

Parameters:

input – path+filename of an input used for an aiida-gromacs input

Module contents

aiida_amber

A plugin for using Amber with AiiDA for molecular dymanics simulations.