iodata.orbitals module

Data structure for molecular orbitals.

class MolecularOrbitals(kind, norba, norbb, occs=None, coeffs=None, energies=None, irreps=None, occs_aminusb=None)[source]

Bases: object

Class of Orthonormal Molecular Orbitals.

Notes

For restricted wavefunctions, the occupation numbers are spin-summed values and several rules are used to deduce the alpha and beta occupation numbers:

  • When occs_aminusb is set, alpha and beta occupation numbers are derived trivially as (occs + occs_aminusb) / 2 and (occs - occs_aminusb) / 2, respectively.

  • When occs_aminusb is not set, there are two possibilities. When the occupation numbers are integers, it is assumed that the orbitals represent a restricted open-shell HF or KS wavefunction. An occupation number of 1 is then interpreted as an occupied alpha orbital and a virtual beta orbital. When the occupation numbers are fractional, it is assumed that the orbitals are closed-shell natural orbitals.

One can always describe all cases by setting occs_aminusb. While this seems appealing, keep in mind that most wavefunction file formats (FCHK, Molden, Molekel, WFN and WFX) do not support it.

__init__(kind, norba, norbb, occs=None, coeffs=None, energies=None, irreps=None, occs_aminusb=None)

Method generated by attrs for class MolecularOrbitals.

coeffs: Optional[ndarray[Any, dtype[float]]]

Molecular orbital coefficients. In case of restricted: shape = (nbasis, norba) = (nbasis, norbb). In case of unrestricted: shape = (nbasis, norba + norbb). In case of generalized: shape = (2 * nbasis, norb), where norb is the total number of orbitals. (optional)

property coeffsa

Return alpha orbital coefficients.

property coeffsb

Return beta orbital coefficients.

energies: Optional[ndarray[Any, dtype[float]]]

Molecular orbital energies. The length equals the number of columns of coeffs. (optional)

property energiesa

Return alpha orbital energies.

property energiesb

Return beta orbital energies.

irreps: Optional[ndarray[Any, dtype[TypeVar(_ScalarType_co, bound= generic, covariant=True)]]]

Irreducible representation. The length equals the number of columns of coeffs. (optional)

property irrepsa

Return alpha irreps.

property irrepsb

Return beta irreps.

kind: str

Type of molecular orbitals, which can be ‘restricted’, ‘unrestricted’, or ‘generalized’.

property nbasis

Return the number of spatial basis functions.

property nelec: float

Return the total number of electrons.

property norb

Return the number of spatially distinct orbitals.

Notes

In case of restricted wavefunctions, this may be less than just the sum of norba and norbb, because alpha and beta orbitals share the same spatical dependence.

norba: int

Number of (occupied and virtual) alpha molecular orbitals. Set to None in case oftype==’generalized’.

norbb: int

Number of (occupied and virtual) beta molecular orbitals. Set to None in case of type==’generalized’. This is expected to be equal to norba for the restricted kind.

occs: Optional[ndarray[Any, dtype[float]]]

Molecular orbital occupation numbers. The length equals the number of columns of coeffs. (optional)

occs_aminusb: Optional[ndarray[Any, dtype[float]]]

The difference between alpha and beta occupation numbers. The length equals the number of columns of coeffs. (optional and only allowed to be not None for restricted wavefunctions)

property occsa

Return alpha occupation numbers.

Notes

For restricted wavefunctions, in-place assignment to occsa will not work. In this case, the array is derived from mo.occs and optionally mo.occs_aminusb. To avoid that in-place assignment of occsa is silently ignored, it is returned as a non-writeable array. To change occsa, one can assign a whole new array, e.g. mo.occsa = new_occsa will work, while mo.occsa[1] = 0.3 will not.

property occsb

Return beta occupation numbers.

Notes

For restricted wavefunctions, in-place assignment to occsb will not work. In this case, the array is derived from mo.occs and optionally mo.occs_aminusb. To avoid that in-place assignment of occsb is silently ignored, it is returned as a non-writeable array. To change occsb, one can assign a whole new array, e.g. mo.occsb = new_occsb will work, while mo.occsb[1] = 0.3 will not.

property spinpol: float

Return the spin polarization of the Slater determinant.

validate_norbab(mo, attribute, value)[source]

Validate the norba or norbb value assigned to a MolecularOrbitals object.

Parameters:
  • mo – The MolecularOrbitals instance.

  • attribute – Attribute instancce being changed.

  • value – The new value.

validate_occs_aminusb(mo, _attribtue, value)[source]

Validate the occs_aminusb attribute.