aiida.calculations package#
Subpackages#
Submodules#
Generic CalcJob implementation where input file is a parametrized template file.
- class aiida.calculations.templatereplacer.TemplatereplacerCalculation(*args: Any, **kwargs: Any)[source]#
Bases:
aiida.engine.processes.calcjobs.calcjob.CalcJob
Simple stub of a plugin that can be used to replace some text in a given template. Can be used for many different codes, or as a starting point to develop a new plugin.
This simple plugin takes two node inputs, both of type Dict, with the labels ‘parameters’ and ‘template’
You can also add other SinglefileData nodes as input, that will be copied according to what is written in ‘template’ (see below).
parameters: a set of parameters that will be used for substitution.
template: can contain the following parameters:
input_file_template: a string with substitutions to be managed with the format() function of python, i.e. if you want to substitute a variable called ‘varname’, you write {varname} in the text. See http://www.python.org/dev/peps/pep-3101/ for more details. The replaced file will be the input file.
input_file_name: a string with the file name for the input. If it is not provided, no file will be created.
output_file_name: a string with the file name for the output. If it is not provided, no redirection will be done and the output will go in the scheduler output file.
cmdline_params: a list of strings, to be passed as command line parameters. Each one is substituted with the same rule of input_file_template. Optional
input_through_stdin: if True, the input file name is passed via stdin. Default is False if missing.
- files_to_copy: if defined, a list of tuple pairs, with format (‘link_name’, ‘dest_rel_path’);
for each tuple, an input link to this calculation is looked for, with link labeled ‘link_label’, and with file type ‘Singlefile’, and the content is copied to a remote file named ‘dest_rel_path’ Errors are raised in the input links are non-existent, or of the wrong type, or if there are unused input files.
- retrieve_temporary_files: a list of relative filepaths, that if defined, will be retrieved and
temporarily stored in an unstored FolderData node that will be available during the Parser.parser_with_retrieved call under the key specified by the Parser.retrieved_temporary_folder key
- __abstractmethods__ = frozenset({})#
- __module__ = 'aiida.calculations.templatereplacer'#
- _abc_impl = <_abc_data object>#
- classmethod define(spec)[source]#
Define the process specification, including its inputs, outputs and known exit codes.
Ports are added to the metadata input namespace (inherited from the base Process), and a code input Port, a remote_folder output Port and retrieved folder output Port are added.
- Parameters
spec – the calculation job process spec to define.
Implementation of Transfer CalcJob.
- class aiida.calculations.transfer.TransferCalculation(*args: Any, **kwargs: Any)[source]#
Bases:
aiida.engine.processes.calcjobs.calcjob.CalcJob
Utility to copy files from different FolderData and RemoteData nodes into a single place.
The final destination for these files can be either the local repository (by creating a new FolderData node to store them) or in the remote computer (by leaving the files in a new remote folder saved in a RemoteData node).
Only files from the local computer and from remote folders in the same external computer can be moved at the same time with a single instance of this CalcJob.
The user needs to provide three inputs:
instructions
: a dict node specifying which files to copy from which nodes.source_nodes
: a dict of nodes, each with a unique identifier label as its key.metadata.computer
: the computer that contains the remote files and will contain the final RemoteData node.
The
instructions
dict must have theretrieve_files
flag. The CalcJob will create a new folder in the remote machine (RemoteData
) and put all the files there and will either:leave them there (
retrieve_files = False
) or …retrieve all the files and store them locally in a
FolderData
(retrieve_files = True
)
The instructions dict must also contain at least one list with specifications of which files to copy and from where. All these lists take tuples of 3 that have the following format:
( source_node_key, path_to_file_in_source, path_to_file_in_target)
where the
source_node_key
has to be the respective one used when providing the node in thesource_nodes
input nodes dictionary.The two main lists to include are
local_files
(for files to be taken from FolderData nodes) andremote_files
(for files to be taken from RemoteData nodes). Alternatively, files inside of RemoteData nodes can instead be put in thesymlink_files
list: the only difference is that files from the first list will be fully copied in the target RemoteData folder, whereas for the files in second list only a symlink to the original file will be created there. This will only affect the content of the final RemoteData target folder, but in both cases the full file will be copied back in the local target FolderData (ifretrieve_files = True
).- __abstractmethods__ = frozenset({})#
- __module__ = 'aiida.calculations.transfer'#
- _abc_impl = <_abc_data object>#
- classmethod define(spec)[source]#
Define the process specification, including its inputs, outputs and known exit codes.
Ports are added to the metadata input namespace (inherited from the base Process), and a code input Port, a remote_folder output Port and retrieved folder output Port are added.
- Parameters
spec – the calculation job process spec to define.
- prepare_for_submission(folder)[source]#
Prepare the calculation for submission.
Convert the input nodes into the corresponding input files in the format that the code will expect. In addition, define and return a CalcInfo instance, which is a simple data structure that contains information for the engine, for example, on what files to copy to the remote machine, what files to retrieve once it has completed, specific scheduler settings and more.
- Parameters
folder – a temporary folder on the local file system.
- Returns
the CalcInfo instance
- aiida.calculations.transfer.check_node_type(list_name, node_label, node_object, node_type)[source]#
Common utility function to check the type of a node