_images/AiiDA_transparent_logo.png

The aiida-raspa plugin for AiiDA

aiida-raspa is available at http://github.com/yakutovicha/aiida-raspa

workflows

workchainaiida_raspa.workchains.base.RaspaBaseWorkChain

Workchain to run a RASPA calculation with automated error handling and restarts.

Inputs:

  • clean_workdir, Bool, optional – If True, work directories of all called calculation jobs will be cleaned at the end of execution.
  • handler_overrides, Dict, optional – Mapping where keys are process handler names and the values are a boolean, where True will enable the corresponding handler and False will disable it. This overrides the default value set by the enabled keyword of the process_handler decorator with which the method is decorated.
  • max_iterations, Int, optional – Maximum number of iterations the work chain will restart the process to finish successfully.
  • metadata, Namespace
    Namespace Ports
    • call_link_label, str, optional, non_db – The label to use for the CALL link if the process is called by another process.
    • description, str, optional, non_db – Description to set on the process node.
    • label, str, optional, non_db – Label to set on the process node.
    • store_provenance, bool, optional, non_db – If set to False provenance will not be stored in the database.
  • raspa, Namespace
    Namespace Ports
    • block_pocket, Namespace – Zeo++ block pocket file
    • code, Code, required – The Code to use for this job.
    • file, Namespace – Additional input file(s)
    • framework, Namespace – Input framework(s)
    • metadata, Namespace
      Namespace Ports
      • call_link_label, str, optional, non_db – The label to use for the CALL link if the process is called by another process.
      • computer, Computer, optional, non_db – When using a “local” code, set the computer on which the calculation should be run.
      • description, str, optional, non_db – Description to set on the process node.
      • dry_run, bool, optional, non_db – When set to True will prepare the calculation job for submission but not actually launch it.
      • label, str, optional, non_db – Label to set on the process node.
      • options, Namespace
        Namespace Ports
        • account, str, optional, non_db – Set the account to use in for the queue on the remote computer
        • append_text, str, optional, non_db – Set the calculation-specific append text, which is going to be appended in the scheduler-job script, just after the code execution
        • custom_scheduler_commands, str, optional, non_db – Set a (possibly multiline) string with the commands that the user wants to manually set for the scheduler. The difference of this option with respect to the prepend_text is the position in the scheduler submission file where such text is inserted: with this option, the string is inserted before any non-scheduler command
        • environment_variables, dict, optional, non_db – Set a dictionary of custom environment variables for this calculation
        • import_sys_environment, bool, optional, non_db – If set to true, the submission script will load the system environment variables
        • input_filename, str, optional, non_db – Filename to which the input for the code that is to be run is written.
        • max_memory_kb, int, optional, non_db – Set the maximum memory (in KiloBytes) to be asked to the scheduler
        • max_wallclock_seconds, int, optional, non_db – Set the wallclock in seconds asked to the scheduler
        • mpirun_extra_params, (list, tuple), optional, non_db – Set the extra params to pass to the mpirun (or equivalent) command after the one provided in computer.mpirun_command. Example: mpirun -np 8 extra_params[0] extra_params[1] … exec.x
        • output_filename, str, optional, non_db – Filename to which the content of stdout of the code that is to be run is written.
        • parser_name, str, optional, non_db – Set a string for the output parser. Can be None if no output plugin is available or needed
        • prepend_text, str, optional, non_db – Set the calculation-specific prepend text, which is going to be prepended in the scheduler-job script, just before the code execution
        • priority, str, optional, non_db – Set the priority of the job to be queued
        • qos, str, optional, non_db – Set the quality of service to use in for the queue on the remote computer
        • queue_name, str, optional, non_db – Set the name of the queue on the remote computer
        • resources, dict, required, non_db – Set the dictionary of resources to be used by the scheduler plugin, like the number of nodes, cpus etc. This dictionary is scheduler-plugin dependent. Look at the documentation of the scheduler for more details.
        • scheduler_stderr, str, optional, non_db – Filename to which the content of stderr of the scheduler is written.
        • scheduler_stdout, str, optional, non_db – Filename to which the content of stdout of the scheduler is written.
        • submit_script_filename, str, optional, non_db – Filename to which the job submission script is written.
        • withmpi, bool, optional, non_db – Set the calculation to use mpi
      • store_provenance, bool, optional, non_db – If set to False provenance will not be stored in the database.
    • parameters, Dict, required – Input parameters
    • parent_folder, RemoteData, optional – Remote folder used to continue the same simulation stating from the binary restarts.
    • retrieved_parent_folder, FolderData, optional – To use an old calculation as a starting poing for a new one.
    • settings, Dict, optional – Additional input parameters

Outputs:

  • output_parameters, Dict, required – The results of a calculation
  • remote_folder, RemoteData, required – Input files necessary to run the process will be stored in this folder node.
  • retrieved, FolderData, required – Files that are retrieved by the daemon will be stored in this node. By default the stdout and stderr of the scheduler will be added, but one can add more by specifying them in CalcInfo.retrieve_list.
  • warnings, List, optional – Warnings that appeared during the calculation

Outline:

setup(Call the `setup` of the `BaseRestartWorkChain` and then create the inputs dictionary in `self.ctx.inputs`. This `self.ctx.inputs` dictionary will be used by the `BaseRestartWorkChain` to submit the calculations in the internal loop.)
while(should_run_process)
    run_process(Run the next process, taking the input dictionary from the context at `self.ctx.inputs`.)
    inspect_process(Analyse the results of the previous process and call the handlers when necessary. If the process is excepted or killed, the work chain will abort. Otherwise any attached handlers will be called in order of their specified priority. If the process was failed and no handler returns a report indicating that the error was handled, it is considered an unhandled process failure and the process is relaunched. If this happens twice in a row, the work chain is aborted. In the case that at least one handler returned a report the following matrix determines the logic that is followed: Process  Handler    Handler     Action result   report?    exit code ----------------------------------------- Success      yes        == 0     Restart Success      yes        != 0     Abort Failed       yes        == 0     Restart Failed       yes        != 0     Abort If no handler returned a report and the process finished successfully, the work chain's work is considered done and it will move on to the next step that directly follows the `while` conditional, if there is one defined in the outline.)
results(Attach the outputs specified in the output specification from the last completed process.)

aiida_raspa package

Subpackages

aiida_raspa.calculations package

Module contents

Raspa input plugin.

class aiida_raspa.calculations.RaspaCalculation(*args, **kwargs)[source]

Bases: CalcJob

This is a RaspaCalculation, subclass of CalcJob, to prepare input for RASPA code. For information on RASPA, refer to: https://github.com/iraspa/raspa2.

DEFAULT_PARSER = 'raspa'
INPUT_FILE = 'simulation.input'
OUTPUT_FOLDER = 'Output'
PROJECT_NAME = 'aiida'
RESTART_FOLDER = 'Restart'
__abstractmethods__ = frozenset({})
__module__ = 'aiida_raspa.calculations'
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 54
_abc_registry = <_weakrefset.WeakSet object>
_handle_retrieved_parent_folder(inp, folder)[source]

Enable restart from the retrieved folder.

_handle_system_section(system_dict, folder)[source]

Handle framework(s) and/or box(es).

classmethod define(spec)[source]

Define the process specification, including its inputs, outputs and known exit codes.

Parameters

spec – the calculation job process spec to define.

prepare_for_submission(folder)[source]

This is the routine to be called when you want to create the input files and related stuff with a plugin.

Parameters

folder – a aiida.common.folders.Folder subclass where the plugin should put all its files.

aiida_raspa.parsers package

Module contents

Raspa output parser.

class aiida_raspa.parsers.RaspaParser(node)[source]

Bases: Parser

Parse RASPA output

__abstractmethods__ = frozenset({})
__module__ = 'aiida_raspa.parsers'
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 54
_abc_registry = <_weakrefset.WeakSet object>
parse(**kwargs)[source]

Receives in input a dictionary of retrieved nodes. Does all the logic here.

aiida_raspa.utils package

Submodules
aiida_raspa.utils.base_input_generator module

Basic raspa input generator.

class aiida_raspa.utils.base_input_generator.RaspaInput(params)[source]

Bases: object

Convert input dictionary into input file

__dict__ = mappingproxy({'__module__': 'aiida_raspa.utils.base_input_generator', '__doc__': 'Convert input dictionary into input file', '__init__': <function RaspaInput.__init__>, 'render': <function RaspaInput.render>, '_dict_to_ordered_list': <function RaspaInput._dict_to_ordered_list>, '_render_section': <staticmethod object>, '_render_item': <staticmethod object>, '__dict__': <attribute '__dict__' of 'RaspaInput' objects>, '__weakref__': <attribute '__weakref__' of 'RaspaInput' objects>, '__annotations__': {}})
__init__(params)[source]
__module__ = 'aiida_raspa.utils.base_input_generator'
__weakref__

list of weak references to the object (if defined)

_dict_to_ordered_list(input_dict)[source]

Convert dict to ordered list.

Convert dictionary {“framework_name1”: something1, “framework_name2”: something2} to [something2, something1], where the order is defined by self.system_order list

Parameters

input_dict (dict) – dictionary that looks as folows {“framework_name1”: something1, “framework_name2”: something2}

Returns

a list of items ordered according to the order of frameworks in the input file

Return type

list

static _render_item(output, key, val, indent=0)[source]

It takes one key-value item and adds to the output file

static _render_section(output, params, indent=0)[source]

It takes a dictionary and recurses through.

For key-value pair it checks whether the value is a dictionary and prepends the key with & It passes the valued to the same function, increasing the indentation If the value is a list, I assume that this is something the user wants to store repetitively

render()[source]

Perform conversion

aiida_raspa.utils.base_parser module

Basic raspa output parser.

aiida_raspa.utils.base_parser.float(number)[source]
aiida_raspa.utils.base_parser.parse_base_output(output_abs_path, system_name, ncomponents)[source]

Parse RASPA output file: it is divided in different parts, whose start/end is carefully documented.

aiida_raspa.utils.base_parser.parse_block1(flines, result_dict, prop, value=1, unit=2, dev=4)[source]

Parse block.

Parses blocks that look as follows:

Average Volume:
=================
    Block[ 0]        12025.61229 [A^3]
    Block[ 1]        12025.61229 [A^3]
    Block[ 2]        12025.61229 [A^3]
    Block[ 3]        12025.61229 [A^3]
    Block[ 4]        12025.61229 [A^3]
    ------------------------------------------------------------------------------
    Average          12025.61229 [A^3] +/-            0.00000 [A^3]
aiida_raspa.utils.base_parser.parse_block_energy(flines, res_dict, prop)[source]

Parse energy block.

Parse block that looks as follows:

Average Adsorbate-Adsorbate energy:
===================================
    Block[ 0] -443.23204         Van der Waals: -443.23204         Coulomb: 0.00000            [K]
    Block[ 1] -588.20205         Van der Waals: -588.20205         Coulomb: 0.00000            [K]
    Block[ 2] -538.43355         Van der Waals: -538.43355         Coulomb: 0.00000            [K]
    Block[ 3] -530.00960         Van der Waals: -530.00960         Coulomb: 0.00000            [K]
    Block[ 4] -484.15106         Van der Waals: -484.15106         Coulomb: 0.00000            [K]
    ------------------------------------------------------------------------------
    Average   -516.80566         Van der Waals: -516.805659        Coulomb: 0.00000            [K]
          +/- 98.86943                      +/- 98.869430               +/- 0.00000            [K]
aiida_raspa.utils.base_parser.parse_lines_with_component(res_components, components, line, prop)[source]

Parse lines that contain components

aiida_raspa.utils.inspection_tools module

RASPA inspection tools

aiida_raspa.utils.inspection_tools.add_write_binary_restart(input_dict, write_every)[source]
aiida_raspa.utils.inspection_tools.increase_box_lenght(input_dict, box_name, box_length_current)[source]

Increase the box lenght to improve the convegence.

aiida_raspa.utils.inspection_tools.modify_number_of_cycles(input_dict, additional_init_cycle, additional_prod_cycle)[source]

Modify number of cycles to improve the convergence.

Module contents

Raspa utils.

aiida_raspa.workchains package

Submodules
aiida_raspa.workchains.base module

Base work chain to run a RASPA calculation

class aiida_raspa.workchains.base.RaspaBaseWorkChain(*args, **kwargs)[source]

Bases: BaseRestartWorkChain

Workchain to run a RASPA calculation with automated error handling and restarts.

__abstractmethods__ = frozenset({})
__module__ = 'aiida_raspa.workchains.base'
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 54
_abc_registry = <_weakrefset.WeakSet object>
_process_class

alias of RaspaCalculation

check_gcmc_convergence(calc)[source]

Checks whether a GCMC calc is converged. Checking is based on the error bar on average loading.

check_gemc_box(calc)[source]

Checks whether each simulation box still satisfies minimum image convention.

check_gemc_convergence(calc)[source]

Checks whether a GEMC calc is converged. Checking is based on the error bar on average loading which is average number of molecules in each simulation box.

check_widom_convergence(calculation)[source]

Checks whether a Widom particle insertion is converged. The check is based on the error bar of the Henry coefficient.

classmethod define(spec)[source]

Define the process specification.

handle_timeout(calculation)[source]

Error handler that restarts calculation finished with TIMEOUT ExitCode.

report_error_handled(calculation, action)[source]

Report an action taken for a calculation that has failed. This should be called in a registered error handler if its condition is met and an action was taken. :param calculation: the failed calculation node :param action: a string message with the action taken

setup()[source]

Call the setup of the BaseRestartWorkChain and then create the inputs dictionary in self.ctx.inputs. This self.ctx.inputs dictionary will be used by the BaseRestartWorkChain to submit the calculations in the internal loop.

Module contents

AiiDA-RASPA workchains

Module contents

AiiDA-RASPA plugins, parsers, workflows, etc …

If you use this plugin for your research, please cite the following work:

Daniele Ongari, Aliksandr V. Yakutovich, Leopold Talirz, and Berend Smit, Building a Consistent and Reproducible Database for Adsorption Evaluation in Covalent–Organic Frameworks, ACS Cent. Sci. 2019, 5, 10, 1663-1675 (2019); https://doi.org/10.1021/acscentsci.9b00619.

If you use AiiDA for your research, please cite the following work:

Giovanni Pizzi, Andrea Cepellotti, Riccardo Sabatini, Nicola Marzari, and Boris Kozinsky, AiiDA: automated interactive infrastructure and database for computational science, Comp. Mat. Sci 111, 218-230 (2016); https://doi.org/10.1016/j.commatsci.2015.09.013; http://www.aiida.net.

aiida-raspa is released under the MIT license.

Indices and tables