aiida_cp2k.utils package¶
Submodules¶
aiida_cp2k.utils.input_generator module¶
AiiDA-CP2K input generator.
-
class
aiida_cp2k.utils.input_generator.
Cp2kInput
(params=None)[source]¶ Bases:
object
Transforms dictionary into CP2K input
-
DISCLAIMER
= '!!! Generated by AiiDA !!!'¶
-
__dict__
= mappingproxy({'__module__': 'aiida_cp2k.utils.input_generator', '__doc__': 'Transforms dictionary into CP2K input', 'DISCLAIMER': '!!! Generated by AiiDA !!!', '__init__': <function Cp2kInput.__init__>, '__getitem__': <function Cp2kInput.__getitem__>, 'add_keyword': <function Cp2kInput.add_keyword>, 'render': <function Cp2kInput.render>, '_add_keyword': <staticmethod object>, '_render_section': <staticmethod object>, '__dict__': <attribute '__dict__' of 'Cp2kInput' objects>, '__weakref__': <attribute '__weakref__' of 'Cp2kInput' objects>})¶
-
__module__
= 'aiida_cp2k.utils.input_generator'¶
-
__weakref__
¶ list of weak references to the object (if defined)
-
static
_add_keyword
(kwpath, value, params, ovrd, cfct)[source]¶ Add keyword into the given nested dictionary
-
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 & (CP2K section). 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 eg: .. highlight:
dict['KEY'] = ['val1', 'val2'] ===> KEY val1 KEY val2 or dict['KIND'] = [{'_': 'Ba', 'ELEMENT':'Ba'}, {'_': 'Ti', 'ELEMENT':'Ti'}, {'_': 'O', 'ELEMENT':'O'}] ====> &KIND Ba ELEMENT Ba &END KIND &KIND Ti ELEMENT Ti &END KIND &KIND O ELEMENT O &END KIND
-
add_keyword
(kwpath, value, override=True, conflicting_keys=None)[source]¶ Add a value for the given keyword.
Args:
- kwpath: Can be a single keyword, a path with / as divider for sections & key,
or a sequence with sections and key.
value: the value to set the given key to
override: whether to override the key if it is already present in the self._params
conflicting_keys: list of keys that cannot live together with the provided key (SOMETHING1/[..]/SOMETHING2/KEY). In case override is True, all conflicting keys will be removed, if override is False and conflicting_keys are present the new key won’t be added.
-
aiida_cp2k.utils.parser module¶
AiiDA-CP2K input plugin.
aiida_cp2k.utils.workchains module¶
AiiDA-CP2K utilities for workchains
-
aiida_cp2k.utils.workchains.
check_resize_unit_cell
(struct, threshold)[source]¶ Returns the multiplication factors for the cell vectors to respect, in every direction: min(perpendicular_width) > threshold.
-
aiida_cp2k.utils.workchains.
get_input_multiplicity
(structure, protocol_settings)[source]¶ Compute the total multiplicity of the structure, by summing the atomic magnetizations: multiplicity = 1 + sum_i ( natoms_i * magnetization_i ), for each atom_type i
-
aiida_cp2k.utils.workchains.
get_kinds_section
(structure, protocol_settings)[source]¶ Write the &KIND sections given the structure and the settings_dict
-
aiida_cp2k.utils.workchains.
merge_Dict
(d1, d2)[source]¶ Make all the data in the second Dict overwrite the corrisponding data in the first Dict
-
aiida_cp2k.utils.workchains.
merge_dict
(dct, merge_dct)[source]¶ Taken from https://gist.github.com/angstwad/bf22d1822c38a92ec0a9 Recursive dict merge. Inspired by :meth:
dict.update()
, instead of updating only top-level keys, merge_dict recurses down into dicts nested to an arbitrary depth, updating keys. Themerge_dct
is merged intodct
. :param dct: dict onto which the merge is executed :param merge_dct: dct merged into dct (overwrites dct data if in both) :return: None
-
aiida_cp2k.utils.workchains.
ot_has_small_bandgap
(cp2k_input, cp2k_output, bandgap_thr_ev)[source]¶ Returns True if the calculation used OT and had a smaller bandgap then the guess needed for the OT. (NOTE: It has been observed also negative bandgap with OT in CP2K!) cp2k_input: dict cp2k_output: dict bandgap_thr_ev: float [eV]
Module contents¶
AiiDA-CP2K utils