turbomoleio.input package

Subpackages

Submodules

turbomoleio.input.define module

Module with classes and functions to run define.

exception turbomoleio.input.define.DefineError(message=None)[source]

Bases: Exception

Base exception for define errors.

Construct DefineError object.

Parameters:

message (str) – the message describing the error

exception turbomoleio.input.define.DefineExpectError(message, pattern)[source]

Bases: DefineError

Exception raised when an expect fail, going in timeout or EOF.

Construct DefineExpectError object.

Parameters:
  • message (str) – the message describing the error

  • pattern (list) – the pattern passed to define that failed to be found

exception turbomoleio.input.define.DefineIredError(message=None)[source]

Bases: DefineError

Exception raised for problems related to the generation of internal coordinates.

Even in the case of incomplete set in internal coordinates and ired is True.

Construct DefineError object.

Parameters:

message (str) – the message describing the error

exception turbomoleio.input.define.DefineParameterError(message=None)[source]

Bases: DefineError

Exception raised when parameters are not defined properly.

This happens when the options are, e.g. incompatible among them or with the other files provided, like coord or a previous control.

Construct DefineError object.

Parameters:

message (str) – the message describing the error

class turbomoleio.input.define.DefineRunner(parameters, timeout=60, log_filepath='define.log', workdir=None, executable=None, use_popen=True)[source]

Bases: object

Class that runs the define executable.

This uses pexpect to communicate with the code.

Construct a DefineRunner object.

Parameters:
  • parameters (dict) – dictionary with the parameters defining the execution. The dictionary will be copied to avoid side effects during the execution.

  • timeout (int) – integer with the maximum time waited by “expect” before raising a timeout exception.

  • log_filepath (str) – string with a path to the file used to log the input and output of define. If None no log will be created.

  • workdir (str) – directory where the define will be executed. If None runs in the current directory.

  • executable (str) – path to the executable that will be used to run define. If None will first search in an environment variable and then default to “define”, that should be in the $PATH.

  • use_popen (bool) – if True the pexpect.popen_spawn.PopenSpawn implementation of pexpect based on popen is used. Otherwise the standard spawn (based on pty).

dump_command_file(filepath='define_commands')[source]

Dump a file with the commands given to define.

Can be used as an input for define to test its behavior: define < define_commands

Parameters:

filepath – path to the file that should be written.

Returns:

None

run_full()[source]

Run define going through all the menus using the parameters.

If The jobs reaches the end without exceptions being raised it will check if the job ended normally or abnormally.

Returns:

True if define ended normally otherwise abnormally.

Return type:

bool

run_generate_mo_files()[source]

Run define to regenerate the molecular orbital files.

This must be run in a folder where a control file is already present and only regenerates the molecular orbital files. If the usemo option is defined the related molecular orbital will be taken from there and updated, otherwise they will be generated from scratch with the extended hueckel guess. (N.B. the control should not be the one currently being edited by define)

Also allows to change some information in the geometry. If at least one of the following options is enabled it will enter the geometry menu: sym, desy, ired. Notice that if the geometry menu should be skipped these options should be disabled.

Quits terminating define “abnormally”.

The function can only return True or fail with an exception. The return value is given to provide an interface similar to the other running methods.

Returns:

always returns True if the function completes.

Return type:

bool

run_update_internal_coords()[source]

Run the define to update internal coordinates of the system.

This is run in a folder where a control file is already present and uses the parameters to update the internal coordinates of the system. Quits afterwards terminating define “abnormally”.

Returns:

True if internal coordinates were successfully updated.

Return type:

bool

exception turbomoleio.input.define.UnsupportedDefineStateError(message=None)[source]

Bases: DefineError

Exception for unexpected behavior of define.

This exception is raised when, according to the current implementation, a specific behavior is expected from define, but a proper way of handling with the case has not been implemented.

Construct DefineError object.

Parameters:

message (str) – the message describing the error

turbomoleio.input.utils module

Module with utility functions and classes for define execution and validation.

exception turbomoleio.input.utils.ParametersValidationError(message=None)[source]

Bases: DefineError

Exception raised when the validation of the parameters fails.

This is raised when the parameters do not follow the defined schema.

Construct DefineError object.

Parameters:

message (str) – the message describing the error

turbomoleio.input.utils.ex_setter(value)[source]

Set excited states in the cerberus schema of DefineRunner.

turbomoleio.input.utils.get_define_template(name)[source]

Return the dict generate from the default templates available.

Parameters:

name (str) – name of the template present in the folder.

Returns:

the template converted from the yaml file.

Return type:

dict

turbomoleio.input.utils.schema_define_params = {'basis': {'default': None, 'nullable': True, 'type': 'string'}, 'basis_atom': {'keysrules': {'type': 'string'}, 'nullable': True, 'type': 'dict', 'valuesrules': {'type': 'string'}}, 'cavity': {'default': None, 'dependencies': {'use_cosmo': True}, 'nullable': True, 'type': 'string'}, 'charge': {'default': None, 'nullable': True, 'type': 'integer'}, 'coord_file': {'default': None, 'nullable': True, 'type': 'string'}, 'copymo': {'default': None, 'nullable': True, 'type': 'string'}, 'desy': {'default': True, 'type': 'boolean'}, 'desy_eps': {'default': None, 'dependencies': {'desy': True}, 'nullable': True, 'type': 'float'}, 'disex': {'default': None, 'dependencies': {'use_cosmo': True}, 'min': 0, 'nullable': True, 'type': 'float'}, 'disp': {'allowed': ['DFT-D1', 'DFT-D2', 'DFT-D3', 'DFT-D3 BJ'], 'default': None, 'nullable': True, 'type': 'string'}, 'ecp_atom': {'keysrules': {'type': 'string'}, 'nullable': True, 'type': 'dict', 'valuesrules': {'type': 'string'}}, 'epsilon': {'default': None, 'dependencies': {'use_cosmo': True}, 'nullable': True, 'type': 'float'}, 'ex_all_states': {'default_setter': <function ex_setter.<locals>.setter>, 'dependencies': ['ex_method', 'ex_multi'], 'min': 0, 'nullable': True, 'type': 'integer'}, 'ex_exopt': {'default': None, 'min': 0, 'nullable': True, 'type': 'integer'}, 'ex_frequency': {'default_setter': <function ex_setter.<locals>.setter>, 'nullable': True, 'type': 'float'}, 'ex_frequency_unit': {'default_setter': <function ex_setter.<locals>.setter>, 'nullable': True, 'type': 'string'}, 'ex_irrep_states': {'dependencies': ['ex_method', 'ex_multi'], 'keysrules': {'type': 'string'}, 'nullable': True, 'type': 'dict', 'valuesrules': {'type': 'integer'}}, 'ex_method': {'allowed': ['rpa', 'cis', 'dynpol', 'polly'], 'default': None, 'dependencies': {'ex_multi': ['singlet', 'doublet', 'triplet']}, 'nullable': True, 'type': 'string'}, 'ex_mp2': {'dependencies': ['ex_method', 'ex_multi'], 'keysrules': {'type': 'string'}, 'nullable': True, 'type': 'dict', 'valuesrules': {'type': 'list', 'valuesrules': {'min': 0, 'type': 'integer'}}}, 'ex_multi': {'allowed': ['singlet', 'doublet', 'triplet'], 'default': None, 'dependencies': {'ex_method': ['rpa', 'cis', 'dynpol', 'polly']}, 'nullable': True, 'type': 'string'}, 'functional': {'default': None, 'nullable': True, 'type': 'string'}, 'gridsize': {'default': None, 'nullable': True, 'type': 'string'}, 'ired': {'default': True, 'type': 'boolean'}, 'marij': {'default': False, 'oneof': [{'allowed': [True], 'dependencies': {'ri': True, 'rijk': False}}, {'allowed': [False]}], 'type': 'boolean'}, 'maxcor': {'default': None, 'dependencies': {'method': ['mp2', 'adc(2)', 'ccsd(t)', 'ccsdt']}, 'nullable': True, 'type': 'float'}, 'maxiter': {'default': None, 'dependencies': {'method': ['mp2', 'adc(2)', 'ccsd(t)', 'ccsdt']}, 'nullable': True, 'type': 'integer'}, 'method': {'allowed': ['dft', 'hf', 'mp2', 'adc(2)', 'ccsd(t)', 'ccsdt'], 'default': 'dft', 'type': 'string'}, 'metric': {'default': None, 'nullable': True, 'type': 'integer'}, 'mp2energy': {'default': None, 'nullable': True, 'type': 'integer'}, 'nppa': {'default': None, 'dependencies': {'use_cosmo': True}, 'min': 0, 'nullable': True, 'type': 'integer'}, 'nspa': {'default': None, 'dependencies': {'use_cosmo': True}, 'min': 0, 'nullable': True, 'type': 'integer'}, 'refind': {'default': None, 'dependencies': {'use_cosmo': True}, 'nullable': True, 'type': 'float'}, 'ri': {'default': False, 'oneof': [{'allowed': [True], 'dependencies': {'rijk': False}}, {'allowed': [False]}], 'type': 'boolean'}, 'rijk': {'default': False, 'oneof': [{'allowed': [True], 'dependencies': {'ri': False}}, {'allowed': [False]}], 'type': 'boolean'}, 'routf': {'default': None, 'dependencies': {'use_cosmo': True}, 'nullable': True, 'type': 'float'}, 'rsolv': {'default': None, 'dependencies': {'use_cosmo': True}, 'min': 0, 'nullable': True, 'type': 'float'}, 'scfconv': {'max': 9, 'min': 4, 'nullable': True, 'type': 'integer'}, 'scfiterlimit': {'default': 200, 'type': 'integer'}, 'solvent': {'default': None, 'dependencies': {'use_cosmo': True}, 'nullable': True, 'type': 'string'}, 'sym': {'default': None, 'nullable': True, 'type': 'string'}, 'sym_eps': {'default': None, 'nullable': True, 'type': 'float'}, 'title': {'default': '', 'nullable': True, 'type': 'string'}, 'unpaired_electrons': {'default': None, 'nullable': True, 'type': 'integer'}, 'use_cosmo': {'default': False, 'type': 'boolean'}, 'use_f12': {'default': False, 'oneof': [{'allowed': [True], 'dependencies': {'method': ['mp2', 'adc(2)', 'ccsd(t)', 'ccsdt']}}, {'allowed': [False]}], 'type': 'boolean'}, 'use_f12*': {'default': False, 'oneof': [{'allowed': [True], 'dependencies': {'method': ['mp2', 'adc(2)', 'ccsd(t)', 'ccsdt'], 'use_f12': True}}, {'allowed': [False]}], 'type': 'boolean'}, 'use_old_amat': {'default': None, 'dependencies': {'use_cosmo': True}, 'nullable': True, 'type': 'boolean'}, 'usemo': {'default': None, 'nullable': True, 'type': 'string'}}

The schema for the validation of the DefineRunner parameters. Based on cerberus.

turbomoleio.input.utils.validate_parameters(parameters)[source]

Validate the define parameters.

This function uses the cerberus tool and the schema_define_params dictionary to validate the dictionary that should be passed to DefineRunner in the parameters argument. Consider it as an experimental feature.

Parameters:

parameters (dict) – the dictionary that should be validate.

Returns:

True if valid according to the schema defined, False otherwise.

Return type:

bool

Module contents

Module of turbomoleio for input generation.