aiida_hubbard.utils.general#

General utilies.

Module Contents#

Functions#

set_tot_magnetization(→ bool)

Set the total magnetization based on its value and the input parameters.

is_perturb_only_atom(→ int | None)

Return the index of the perturb_only_atom key associated with the INPUTHP dictionary.

distribute_base_workchains(→ List[int])

Distribute the maximum number of BaseWorkChains to be launched.

aiida_hubbard.utils.general.set_tot_magnetization(input_parameters: dict, tot_magnetization: float) bool[source]#

Set the total magnetization based on its value and the input parameters.

Set the SYSTEM.tot_magnetization parameters input equal to the round value of tot_magnetization. It returns whether the latter does not exceed within threshold from its original value. This is needed because tot_magnetization must be an integer for QuantumESPRESSO pw.x.

aiida_hubbard.utils.general.is_perturb_only_atom(parameters: dict) int | None[source]#

Return the index of the perturb_only_atom key associated with the INPUTHP dictionary.

Returns:

atomic index (QuantumESPRESSO format), None if the key is not in parameters

aiida_hubbard.utils.general.distribute_base_workchains(n_atoms: int, n_total: int) List[int][source]#

Distribute the maximum number of BaseWorkChains to be launched.

The number of BaseWorkChains will be distributed over the number of atoms. The elements of the resulting list correspond to the number of q-point BaseWorkChains to be launched for each atom, in case q-point parallelization is used. Otherwise, the method will only take care of limitting the number of HpParallelizeAtomsWorkChain to be launched in parallel.

Parameters:
  • n_atoms – The number of atoms.

  • n_total – The number of base workchains to be launched.

Returns:

The number of base workchains to be launched for each atom.