DataHfProvider

class adcc.DataHfProvider(data: Mapping[str, Any])

Bases: HartreeFockProvider

Initialise the DataHfProvider class with the data being a supported data container (e.g. a python dictionary or HDF5 file). Note that the data is loaded lazily from the container. Hence, the container must be valid (e.g. the HDF5 file opened and readable) as long as the provider (or any object constructed from it, e.g. a adcc.ReferenceState) is in use.

Let nf denote the number of Fock spin orbitals (i.e. the sum of both the alpha and the beta orbitals) and nb the number of basis functions. With array we indicate either a np.array or an HDF5 dataset. The following keys are required in the container:

  1. restricted (bool): True for a restricted SCF calculation, False otherwise

  2. conv_tol (float): Tolerance value used for SCF convergence, should be roughly equivalent to l2 norm of the Pulay error.

  3. orbcoeff_fb (array with dtype float, size (nf, nb)): SCF orbital coefficients, i.e. the uniform transform from the basis to the molecular orbitals.

  4. occupation_f (array with dtype float, size (nf, )): Occupation number for each SCF orbitals (i.e. diagonal of the HF density matrix in the SCF orbital basis).

  5. orben_f (array with dtype float, size (nf, )): SCF orbital energies

  6. fock_ff (array with dtype float, size (nf, nf)): Fock matrix in SCF orbital basis. Notice, the full matrix is expected also for restricted calculations.

  7. eri_phys_asym_ffff (array with dtype float, size (nf, nf, nf, nf)): Antisymmetrised electron-repulsion integral tensor in the SCF orbital basis, using the Physicists’ indexing convention, i.e. that the index tuple (i,j,k,l) refers to the integral \langle ij || kl \rangle, i.e.

    \int_\Omega \int_\Omega d r_1 d r_2 \frac{ \phi_i(r_1) \phi_j(r_2) \phi_k(r_1) \phi_l(r_2)}{|r_1 - r_2|} - \int_\Omega \int_\Omega d r_1 d r_2 \frac{ \phi_i(r_1) \phi_j(r_2) \phi_l(r_1) \phi_k(r_2)}{|r_1 - r_2|}

    The full tensor (including zero blocks) is expected.

As an alternative to eri_phys_asym_ffff, the user may provide

  1. eri_ffff (array with dtype float, size (nf, nf, nf, nf)): Electron-repulsion integral tensor in chemists’ notation. The index tuple (i,j,k,l) thus refers to the integral (ij|kl), which is

    \int_\Omega \int_\Omega d r_1 d r_2 \frac{\phi_i(r_1) \phi_j(r_1) \phi_k(r_2) \phi_l(r_2)}{|r_1 - r_2|}

    Notice, that no antisymmetrisation has been applied in this tensor.

The above keys define the least set of quantities to start a calculation in adcc. In order to have access to properties such as dipole moments or to get the correct state energies, further keys are highly recommended to be provided as well.

  1. energy_scf (float): Final total SCF energy of both electronic and nuclear energy terms.

  2. nuclear_repulsion_energy (float): The nuclear repulsion energy.

  3. multipoles: Container with electric and nuclear multipole moments. Can be another dictionary or simply an HDF5 group.

    • elec_1 (array, size (3, nb, nb)): Electric dipole moment integrals in the atomic orbital basis (i.e. the discretisation basis with nb elements). First axis indicates cartesian component (x, y, z).

    • elec_2_{gauge_origin} (array, size (9, nb, nb)): Electric quadrupole moment integrals in the atomic orbital basis for the named gauge origin (e.g. elec_2_origin, elec_2_mass_center or elec_2_charge_center). First axis indicates cartesian component (xx, xy, xz, yx, yy, yz, zx, zy, zz).

    • nuclear_0 (float): Total nuclear charge

    • nuclear_1 (array size (3, )): Nuclear dipole moment

    • nuclear_2_{gauge_origin} (array size (6, )): Nuclear quadrupole moment for the named gauge origin. Components are (xx, xy, xz, yy, yz, zz).

  4. spin_multiplicity (int): The spin multiplicity of the HF ground state described by the data. A value of 0 (for unknown) should be supplied for unrestricted calculations. (default: (nalpha - nbeta + 1) for restricted)

  5. overlap (array, size (nb, nb)): Overlap matrix in the atomic orbital basis.

  6. magnetic_moments: Container with magnetic moment integrals.

    • mag_1_{gauge_origin} (array, size (3, nb, nb)): Imaginary part of the magnetic dipole integrals in the atomic orbital basis for the named gauge origin (e.g. mag_1_origin). First axis indicates cartesian component (x, y, z).

  7. derivatives: Container with derivative integrals.

    • elec_vel_1 (array, size (3, nb, nb)): Imaginary part of the electric dipole integrals in the velocity gauge in the atomic orbital basis. First axis indicates cartesian component (x, y, z).

A descriptive string for the backend can be supplied optionally as well. In case of using a python dict as the data container, this should be done using the key backend. For an HDF5 file, this should be done using the attribute backend. Defaults based on the filename are generated.

Parameters:

data (Mapping[str, Any]) – Data container (e.g. a python dict or h5py.File) containing the HartreeFock data to use. For the required keys see details above.

Methods Summary

fill_eri_ffff(self, slices, out)

Fill the passed numpy array out with a part of the electron-repulsion integral tensor in the molecular orbital basis.

fill_eri_phys_asym_ffff(self, slices, out)

Fill the passed numpy array out with a part of the antisymmetrised electron-repulsion integral tensor in the molecular orbital basis.

fill_fock_ff(self, slices, out)

Fill the passed numpy array out with a part of the Fock matrix in the molecular orbital basis.

fill_occupation_f(self, out)

Fill the passed numpy array of size (2 * nf, ) with the occupation number for each SCF orbital.

fill_orbcoeff_fb(self, out)

Fill the passed numpy array of size (2 * nf, nb) with the SCF orbital coefficients, i.e. the uniform transform from the one-particle basis to the molecular orbitals.

fill_orben_f(self, out)

Fill the passed numpy array of size (2 * nf, ) with the SCF orbital energies.

get_backend(self)

Return the identifier of the SCF backend.

get_conv_tol(self)

Returns the tolerance value used for SCF convergence.

get_energy_scf(self)

Returns the final total SCF energy (sum of electronic and nuclear terms.

get_n_bas(self)

Returns the number of spatial one-electron basis functions.

get_n_orbs_alpha(self)

Returns the number of HF spin orbitals of alpha spin.

get_nuclear_multipole(self, order[, ...])

Returns the nuclear multipole of the requested order.

get_nuclear_repulsion_energy(self)

Returns the nuclear repulsion energy.

get_restricted(self)

Return True for a restricted SCF calculation, False otherwise.

get_spin_multiplicity(self)

Returns the spin multiplicity of the HF ground state.

has_eri_phys_asym_ffff(self)

Returns whether fill_eri_phys_asym_ffff function is implemented and should be used(True) or whether antisymmetrisation should be done inside adcc starting from the fill_eri_ffff function (False)

Methods Documentation

fill_eri_ffff(self: libadcc.HartreeFockProvider, slices: tuple[slice, slice, slice, slice], out: numpy.ndarray[tuple[int, int, int, int], numpy.dtype[numpy.float64]]) → None

Fill the passed numpy array out with a part of the electron-repulsion integral tensor in the molecular orbital basis. The indexing convention is the chemist’s notation, i.e. the index tuple (i,j,k,l) refers to the integral (ij|kl). The block to store is specified by the provided tuple of ranges slices, which gives the range of indices to place into the buffer along each of the axis. The index counting is done in spin orbitals, so the full range in each axis is range(0, 2 * nf).

fill_eri_phys_asym_ffff(self: libadcc.HartreeFockProvider, slices: tuple[slice, slice, slice, slice], out: numpy.ndarray[tuple[int, int, int, int], numpy.dtype[numpy.float64]]) → None

Fill the passed numpy array out with a part of the antisymmetrised electron-repulsion integral tensor in the molecular orbital basis. The indexing convention is the physicist’s notation, i.e. the index tuple (i,j,k,l) refers to the integral \langle ij||kl \rangle. The block to store is specified by the provided tuple of ranges slices, which gives the range of indices to place into the buffer along each of the axis. The index counting is done in spin orbitals, so the full range in each axis is range(0, 2 * nf).

fill_fock_ff(self: libadcc.HartreeFockProvider, slices: tuple[slice, slice], out: numpy.ndarray[tuple[int, int], numpy.dtype[numpy.float64]]) → None

Fill the passed numpy array out with a part of the Fock matrix in the molecular orbital basis. The block to store is specified by the provided tuple of ranges slices, which gives the range of indices to place into the buffer along each of the axis. The index counting is done in spin orbitals, so the full range in each axis is range(0, 2 * nf). The implementation should not assume that the alpha-beta and beta-alpha blocks are not accessed even though they are zero by spin symmetry.

fill_occupation_f(self: libadcc.HartreeFockProvider, out: numpy.ndarray[tuple[int], numpy.dtype[numpy.float64]]) → None

Fill the passed numpy array of size (2 * nf, ) with the occupation number for each SCF orbital.

fill_orbcoeff_fb(self: libadcc.HartreeFockProvider, out: numpy.ndarray[tuple[int, int], numpy.dtype[numpy.float64]]) → None

Fill the passed numpy array of size (2 * nf, nb) with the SCF orbital coefficients, i.e. the uniform transform from the one-particle basis to the molecular orbitals.

fill_orben_f(self: libadcc.HartreeFockProvider, out: numpy.ndarray[tuple[int], numpy.dtype[numpy.float64]]) → None

Fill the passed numpy array of size (2 * nf, ) with the SCF orbital energies.

get_backend(self: libadcc.HartreeFockProvider) → str

Return the identifier of the SCF backend. Must be overridden in Python subclasses.

get_conv_tol(self: libadcc.HartreeFockProvider) → float

Returns the tolerance value used for SCF convergence. Should be roughly equivalent to the l2 norm of the Pulay error.

get_energy_scf(self: libadcc.HartreeFockProvider) → float

Returns the final total SCF energy (sum of electronic and nuclear terms.

get_n_bas(self: libadcc.HartreeFockProvider) → int

Returns the number of spatial one-electron basis functions. This value is abbreviated by nb in the documentation.

get_n_orbs_alpha(self: libadcc.HartreeFockProvider) → int

Returns the number of HF spin orbitals of alpha spin. It is assumed the same number of beta spin orbitals are used. This value is abbreviated by nf in the documentation.

get_nuclear_multipole(self: libadcc.HartreeFockProvider, order: int, gauge_origin: tuple[float, float, float] = (0.0, 0.0, 0.0)) → numpy.ndarray[tuple[int], numpy.dtype[numpy.float64]]

Returns the nuclear multipole of the requested order. For 0 returns the total nuclear charge as an array of size 1, for 1 returns the nuclear dipole moment as an array of size 3.

get_nuclear_repulsion_energy(self: libadcc.HartreeFockProvider) → float

Returns the nuclear repulsion energy.

get_restricted(self: libadcc.HartreeFockProvider) → bool

Return True for a restricted SCF calculation, False otherwise.

get_spin_multiplicity(self: libadcc.HartreeFockProvider) → int

Returns the spin multiplicity of the HF ground state. A value of 0* (for unknown) should be supplied for unrestricted calculations.

has_eri_phys_asym_ffff(self: libadcc.HartreeFockProvider) → bool

Returns whether fill_eri_phys_asym_ffff function is implemented and should be used(True) or whether antisymmetrisation should be done inside adcc starting from the fill_eri_ffff function (False)