iodata.convert module

Functions to convert IOData-related objects.

This module includes the lower-level implementations to the functions in the prepare module. The functions in this module can be used without writing data to files. Most of them are used by the prepare module.

convert_conventions(molbasis, new_conventions, reverse=False)[source]

Return a permutation vector and sign changes to convert from 1 to 2.

The transformation from molbasis.convention to the new convention can be done applying the results of this function as follows:

vector2 = vector1[permutation]*signs

When using the option reverse=True, one can use the results to convert in the opposite sense:

vector1 = vector2[permutation]*signs
Parameters:
  • molbasis (MolecularBasis) – The description of a molecular basis set.

  • new_conventions (dict[str, list[str]]) – The new conventions for ordering and signs, to which data for the orbital basis needs to be converted.

  • reverse – When, true the conversion from 2 to 1 is returned.

Return type:

tuple[ndarray[Any, dtype[int]], ndarray[Any, dtype[int]]]

Returns:

  • permutation – An integer array that permutes basis function from 1 to 2.

  • signs – Sign changes when going from 1 to 2, must be applied after permutation

convert_to_segmented(obasis, keep_sp=False)[source]

Convert basis with generalized contractions to one with only single contractions.

Parameters:
  • obasis (MolecularBasis) – The basis set to convert.

  • keep_sp (bool) – If True, SP shells are not split up. This can be useful for file formats only support SP-generalized contractions and no other ones.

Return type:

MolecularBasis

Returns:

A new MolecularBasis instance with separate single contractions.

convert_to_unrestricted(mo)[source]

Convert orbitals to kind="unrestricted".

Parameters:

mo (MolecularOrbitals) – Restricted molecular orbitals to be converted.

Return type:

MolecularOrbitals

Returns:

new_mo – The given object if the orbitals were already unrestricted or a new unrestricted copy.

Raises:

ValueError – When the given orbitals are generalized.

iter_cart_alphabet(n)[source]

Loop over powers of Cartesian basis functions in alphabetical order.

See https://theochem.github.io/horton/2.1.1/tech_ref_gaussian_basis.html for details.

Parameters:

n (int) – The angular momentum, i.e. sum of Cartesian powers in this case.

Return type:

ndarray[Any, dtype[int]]