iodata.basis module¶
Utility functions for working with basis sets.

class
MolecularBasis
(shells, conventions, primitive_normalization)[source]¶ Bases:
object
A complete molecular orbital or density basis set.

shells
¶ A list of objects of type Shell which can support generalized contractions.

conventions
¶ A dictionary specifying the ordered basis functions for a given angular momentum and kind. The key is a tuple of angular momentum integer and kind character (‘c’ for Cartesian and ‘p’ for pure/spherical) and the value is a list of basis function strings. For example,
{ ### Conventions for Cartesian functions # E.g., alphabetically ordered Cartesian functions. (0, 'c'): ['1'], (1, 'c'): ['x', 'y', 'z'], (2, 'c'): ['xx', 'xy', 'xz', 'yy', 'yz', 'zz'], ### Conventions for pure functions. # The notation is referring to real solid spherical harmonics. # See https://en.wikipedia.org/wiki/Solid_harmonics#Real_form # 'c{m}' = solid harmonic containing cos(m phi) # 's{m}' = solid harmonic containing sin(m phi) # where m is the magnetic quantum number and phi is the # azimuthal angle. # For example, wikipediaordered real spherical harmonics, # see https://en.wikipedia.org/wiki/Spherical_harmonics#Real_form (2, 'p'): ['s2', 's1', 'c0', 'c1', 'c2'], # Different quantumchemistry codes may use incompatible # orderings and sign conventions. E.g. Molden files written # by ORCA use the following convention for pure f functions: (3, 'p'): ['c0', 'c1', 's1', 'c2', 's2', 'c3', 's3'], # Note that the minus sign in the last two basis functions # denotes that the signs of these harmonics have been changed. }
The basis function strings in the conventions dictionary are documented in Basis set conventions.

primitive_normalization
¶ The normalization convention of primitives, which can be ‘L2’ (orbitals) or ‘L1’ (densities) normalized.

__init__
(shells, conventions, primitive_normalization)¶ Method generated by attrs for class MolecularBasis.
 Return type
None

shells
: List[iodata.basis.Shell]¶


class
Shell
(icenter, angmoms, kinds, exponents, coeffs)[source]¶ Bases:
object
A shell in a molecular basis representing (generalized) contractions with the same exponents.

icenter
¶ An integer index specifying the row in the atcoords array of IOData object.

angmoms
¶ An integer array of angular momentum quantum numbers, nonnegative, with shape (ncon,).

kinds
¶ List of strings describing the kind of contractions: ‘c’ for Cartesian and ‘p’ for pure. Pure functions are only allowed for angmom>1. The length equals the number of contractions: len(angmoms)=ncon.

exponents
¶ The array containing the exponents of the primitives, with shape (nprim,).

coeffs
¶ The array containing the coefficients of the normalized primitives in each contraction; shape = (nprim, ncon). These coefficients assume that the primitives are L2 (orbitals) or L1 (densities) normalized, but contractions are not necessarily normalized. (This depends on the code which generated the contractions.)

__init__
(icenter, angmoms, kinds, exponents, coeffs)¶ Method generated by attrs for class Shell.
 Return type
None

coeffs
: numpy.ndarray¶

exponents
: numpy.ndarray¶

property
nbasis
¶ Number of basis functions (e.g. 3 for a P shell and 4 for an SP shell).
 Return type

property
ncon
¶ Number of contractions. This is usually 1; e.g., it would be 2 for an SP shell.
 Return type


convert_convention_shell
(conv1, conv2, reverse=False)[source]¶ Return a permutation vector and sign changes to convert from 1 to 2.
The transformation from convention 1 to convention 2 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
conv1 (
List
[str
]) – Two lists, with the same strings (in different order), where each string may be prefixed with a ‘‘.conv2 (
List
[str
]) – Two lists, with the same strings (in different order), where each string may be prefixed with a ‘‘.reverse – When, true the conversion from 2 to 1 is returned.
 Return type
Tuple
[ndarray
,ndarray
] 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_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
,ndarray
] 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

get_default_conventions
()[source]¶ Produce a conventions dictionary compatible with HORTON2.
Do not change this!!! This is also used by several file formats from other QC codes who happen to follow the same conventions.

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