aiida_cusp.utils.custodian module

Utility for translating plugin input parameters for Custodian and setting up the input scripts for the Custodian executable.

class aiida_cusp.utils.custodian.CustodianSettings(vasp_cmd, stdout_fname, stderr_fname, settings={}, handlers={}, is_neb=False)

Bases: object

Class to store Custodian settings and generate the required input files

Any error handlers may be passed as either a list containing the handler names or a dict with handler names set as keys and the corresponding item defining the handler-settings as dict. In case of the handlers being passed as a list the default settings for the defined handlers will be applied.

  • vasp_cmd (list) – list of commands requird to run the VASP calculation
  • stdout_fname (str) – name of the file used to log messages send to stdout
  • stderr_fname (str) – name of the file used to log messages send to stderr
  • settings (dict) – settings for the Custodian job
  • handlers (list or dict) – a set of error-correction handlers used to correct any errors occuring during the VASP calculation

Define error handlers used by custodian.

Accepts a list of handler names which will initialize the handlers with their corresponding default values. If handlers is given as dictionary keys are assumed to be of type handler name and the corresponding item to be of type dict containing the non-default parameters for the corresponding handler.


handlers (dict or list) – list of handler names or a dictionary of handlers and their corresponding non-default parameters


dictionary of handler module paths and the corresponding handler setings for all handlers defined in the input handlers

Return type:



Define settings for the custodian program.

Removes all Custodian program specific input parameters from the passed settings and complements missing parameters with given defaults.

Parameters:settings (dict) – dictionary containing the settings for the Custodian program
Returns:input settings for the Custodian program
Return type:dict

Define settings for the VASP program.

Removes all VASP program specific input parameters from the passed settings and complements missing parameters with given defaults

  • settings (dict) – dictionary containing the settings for the VASP job
  • is_neb (bool) – set to True if the VASP job is of type NEB

Check if handlers is empty, i.e. verify all handlers have been consumed.

Parameters:handlers (dict) – dictionary of handlers and parameters
Raises:CustodianSettingsError – if any remaining handler is found in the passed dictionary

Check if settings is empty, i.e. verify that all custodian and vasp job settinhs have been consumed.

Parameters:settings (dict) – dictionary containing custodian and VASP job settings
Raises:CustodianSettingsError – if any remaining setting is found in the passed dictionary

Generate custodian specification yaml-file.

Before writing the file all settings and handler contents are properly re-arranged such that the generated yaml-file is understood by the custodian command-line executable.

Raises:CustodianSettingsError – if the file defined by the passed path_to_file variable does not contain the .yaml suffix