aiida_lsmo.utils package

Submodules

aiida_lsmo.utils.cp2k_utils module

Utilities related to CP2K.

aiida_lsmo.utils.cp2k_utils.get_bsse_section(natoms_a, natoms_b, mult_a=1, mult_b=1, charge_a=0, charge_b=0)[source]

Get the &FORCE_EVAL/&BSSE section.

aiida_lsmo.utils.cp2k_utils.get_kinds_info(atoms)[source]

Get kinds information from ASE atoms

Parameters

atoms – ASE atoms instance

Returns

list of kind_info dictionaries (keys: ‘kind’, ‘element’, ‘magnetization’)

aiida_lsmo.utils.cp2k_utils.get_kinds_section(atoms, protocol, with_ghost_atoms=False)[source]

Write the &KIND sections given the structure and the settings_dict

Parameters
  • atoms – ASE atoms instance

  • protocol – protocol dict

  • with_ghost_atoms – if true, add ghost atoms for BSSE counterpoise correction (optional)

aiida_lsmo.utils.cp2k_utils.get_multiplicity_section(atoms, protocol)[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

= 1 + sum_i magnetization_j, for each atomic site j

Parameters
  • atoms – ASE atoms instance

  • protocol – protocol dict

Returns

dict (for cp2k input)

aiida_lsmo.utils.cp2k_utils.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]

aiida_lsmo.utils.isotherm_molecules_schema module

Voluptuous schema for isotherm_molecules.yaml

aiida_lsmo.utils.multiply_unitcell module

Utilities for unit cell multiplication, typically for cut-off issues.

aiida_lsmo.utils.multiply_unitcell.check_resize_unit_cell(cif, threshold)[source]

Returns the multiplication factors for the cell vectors to respect, in every direction: min(perpendicular_width) > threshold.

aiida_lsmo.utils.multiply_unitcell.check_resize_unit_cell_legacy(struct, threshold)[source]

Returns the multiplication factors for the cell vectors to respect, in every direction: min(perpendicular_width) > threshold. TODO: this has been used for CP2K, make it uniform to the other one used for Raspa (from CifFile).

aiida_lsmo.utils.multiply_unitcell.resize_unit_cell(struct, resize)[source]

Resize the StructureData according to the resize Dict

aiida_lsmo.utils.other_utilities module

Other utilities

aiida_lsmo.utils.other_utilities.aiida_cif_merge(aiida_cif_a, aiida_cif_b)[source]

Merge the coordinates of two CifData into a sigle one. Note: the two unit cells must be the same.

aiida_lsmo.utils.other_utilities.aiida_dict_merge(to_dict, from_dict)[source]

Merge two aiida Dict objects.

aiida_lsmo.utils.other_utilities.aiida_structure_merge(aiida_structure_a, aiida_structure_b)[source]

Merge the coordinates of two StructureData into a sigle one. Note: the two unit cells must be the same.

aiida_lsmo.utils.other_utilities.ase_cells_are_similar(ase_a, ase_b, thr=2)[source]

Return True if the cell of two ASE objects are similar up to “thr” decimals. This avoids to give error if two Cells are different at a nth decimal number, tipically because of some truncation.

aiida_lsmo.utils.other_utilities.dict_merge(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, dict_merge recurses down into dicts nested to an arbitrary depth, updating keys. The merge_dct is merged into dct. :param dct: dict onto which the merge is executed :param merge_dct: dct merged into dct :return: None

aiida_lsmo.utils.other_utilities.get_cif_from_structure(structuredata)[source]

Convert CifData to StructureData maintaining the provenance.

aiida_lsmo.utils.other_utilities.get_structure_from_cif(cifdata)[source]

Convert StructureData to CifData maintaining the provenance.

aiida_lsmo.utils.other_utilities.validate_dict(dict_node, port, schema)[source]

Validate dictionary against schema.

To be used as validator in process input ports using functools:

validator = functools.partial(validate_dict, schema=cls.parameters_schema)

Module contents

aiida-lsmo utils