aiida_castep.calculations.helper package#

Submodules#

aiida_castep.calculations.helper.generate module#

Module for generation HELP information using CASTEP excutable.

aiida_castep.calculations.helper.generate.dot_proc(iterable)[source]#

Provide a primitive progress bar

aiida_castep.calculations.helper.generate.get_castep_commands(castep_command='castep.serial', key='all')[source]#
aiida_castep.calculations.helper.generate.parse_help_string(key, excutable='castep.serial')[source]#

Capture help string, determine if it is for PARAM or CELL

aiida_castep.calculations.helper.generate.progress(func, *args, **kwargs)[source]#

Module contents#

CASTEP HELPER Check for errors in input dictionary

class aiida_castep.calculations.helper.CastepHelper(version=None)[source]#

Bases: object

A class for helping castep inputs

__dict__ = mappingproxy({'__module__': 'aiida_castep.calculations.helper', '__doc__': '\n    A class for helping castep inputs\n    ', '__init__': <function CastepHelper.__init__>, 'load_helper_dict': <function CastepHelper.load_helper_dict>, 'help_dict': <property object>, 'castep_help_version': <property object>, 'save_helper_dict': <function CastepHelper.save_helper_dict>, '_check_dict': <function CastepHelper._check_dict>, '_from_flat_dict': <function CastepHelper._from_flat_dict>, 'check_dict': <function CastepHelper.check_dict>, 'get_suggestion': <function CastepHelper.get_suggestion>, '__dict__': <attribute '__dict__' of 'CastepHelper' objects>, '__weakref__': <attribute '__weakref__' of 'CastepHelper' objects>, '__annotations__': {}})#
__init__(version=None)[source]#
__module__ = 'aiida_castep.calculations.helper'#
__weakref__#

list of weak references to the object (if defined)

_check_dict(input_dict)[source]#

Check a dictionary of inputs. Return invalid and wrong keys

Parameters:

input_dict (dict) – A dictonary with “PARAM” and “CELL” keys.

Returns:

A list of [invalid_keys, wrong_keys].

wrong_keys is a tuple of where the key should have being. (key, “PARAM”) or (key, “CELL”)

_from_flat_dict(input_dict)[source]#

Construct a {“PARAM”:{}, “CELL”:{}} dictionary from dictionary with top-level keys other than PARAM and CELL :returns: a list of [out_dict, keys_not_found]

property castep_help_version#

Version number of CASTEP that the help info is for

check_dict(input_dict, auto_fix=True, allow_flat=False)[source]#

Check input dictionary. Apply and warn about errors :param input_dict dictionary: a dictionary as the input, contain “CELL”, “PARAM” and other keywords :param auto_fix bool: Whether we should fix error automatically :param allow_flat: Accept that the input dictionary is flat.

Returns dict:

A structured dictionary

get_suggestion(string)[source]#

Return string for suggestion of the string

property help_dict#

A dictionary containing information of the helper

load_helper_dict()[source]#

Attempts to load a dictionary containing the helper information. This dictionary should be generated by the .generate module We look for .castep_helpinfo.json in the $HOME directory.

save_helper_dict(help_dict, file_path)[source]#

Save the helper json file in to sensible location. By default it is here this module is

exception aiida_castep.calculations.helper.HelperCheckError[source]#

Bases: RuntimeError

__module__ = 'aiida_castep.calculations.helper'#
__weakref__#

list of weak references to the object (if defined)

aiida_castep.calculations.helper._get_suggestion(provided_string, allowed_strings)[source]#

Given a string and a list of allowed_strings, it returns a string to print on screen, with sensible text depending on whether no suggestion is found, or one or more than one suggestions are found.

Parameters:
  • provided_string – the string to compare

  • allowed_strings – a list of valid strings

Returns:

A string to print on output, to suggest to the user

a possible valid value.

aiida_castep.calculations.helper.check_incompatible(dict_in, inc_list)[source]#

Check any conflicting keys in the dictionary

aiida_castep.calculations.helper.find_help_info()[source]#

Return possible paths of helper dict The diction should store in the format: castep_help_info_<version>.json Search paths are the module path and the $HOME

Returns:

[path1, path2], [verion1, version2]…..

aiida_castep.calculations.helper.load_json(path)[source]#

Load a json via file path