qrunch.chemistry.integral_builders.resolution_of_the_identity_integral_builder

Resolution of the identity integral builders.

Classes

ResolutionOfTheIdentityIntegralBuilder

Build integrals using Resolution of the Identity (RI) integrals.

RestrictedResolutionOfTheIdentityIntegralBuilder

Build restricted integrals using Resolution of the Identity (RI).

UnrestrictedResolutionOfTheIdentityIntegralBuilder

Build unrestricted integrals using Resolution of the Identity (RI) integrals.

class ResolutionOfTheIdentityIntegralBuilder

Bases: TwoBodyElectronRepulsionIntegralBuilderProtocol

Build integrals using Resolution of the Identity (RI) integrals.

__init__(*, aux_basis: BasisSet | None = None) None

Initialize the Resolution of the Identity (RI) integral builder.

Parameters:

aux_basis (BasisSet | None) – The auxiliary density-fitting RI basis set. Defaults to the Weigend-Coulomb-fit basis.

Return type:

None

calculate_integrals(molecular_orbitals: UnrestrictedMolecularOrbitals, molecular_configuration: MolecularConfiguration) UnrestrictedResolutionOfTheIdentityIntegrals
calculate_integrals(molecular_orbitals: RestrictedMolecularOrbitals, molecular_configuration: MolecularConfiguration) RestrictedResolutionOfTheIdentityIntegrals

Calculate the Resolution of the Identity (RI) two-electron repulsion integrals (ERI) in the MO basis.

Parameters:
Return type:

RestrictedResolutionOfTheIdentityIntegrals | UnrestrictedResolutionOfTheIdentityIntegrals

classmethod decode(data: dict[str, Any]) ResolutionOfTheIdentityIntegralBuilder

Decode a dictionary to an instance.

Parameters:

data (dict[str, Any]) – The dictionary representation.

Return type:

ResolutionOfTheIdentityIntegralBuilder

encode() dict[str, Any]

Encode the instance into a dictionary.

Return type:

dict[str, Any]

class RestrictedResolutionOfTheIdentityIntegralBuilder

Bases: object

Build restricted integrals using Resolution of the Identity (RI).

__init__(*, aux_basis: BasisSet | None = None) None

Initialize the restricted Resolution of the Identity (RI) integral builder.

Parameters:

aux_basis (BasisSet | None) – The auxiliary density-fitting RI basis set. Defaults to a tailored basis based on orbital basis set or auto generated basis.

Return type:

None

calculate_integrals(molecular_orbitals: RestrictedMolecularOrbitals, molecular_configuration: MolecularConfiguration) RestrictedResolutionOfTheIdentityIntegrals

Calculate the restricted Resolution of the Identity (RI) two-electron repulsion integrals (ERI) in the MO basis.

Parameters:
Return type:

RestrictedResolutionOfTheIdentityIntegrals

internal_contracted_left(component: Literal['aa', 'bb', 'mixed'], molecular_orbitals: RestrictedMolecularOrbitals, molecular_configuration: MolecularConfiguration, active_range: slice, inactive_range: slice) ndarray[tuple[Any, ...], dtype[float64]]

Contract over the two leftmost indices: \(g_{iipq} \to g_{pq}\).

Parameters:
  • component (Literal['aa', 'bb', 'mixed']) – Which integral component to use (ignored for restricted; always alpha).

  • molecular_orbitals (RestrictedMolecularOrbitals) – The restricted Molecular Orbitals.

  • molecular_configuration (MolecularConfiguration) – The molecular configuration.

  • active_range (slice) – Slice selecting active MO columns for the free pair (p, q).

  • inactive_range (slice) – Slice selecting inactive MO columns for the contracted pair (i).

Return type:

ndarray[tuple[Any, …], dtype[float64]]

internal_contracted_middle(component: Literal['aa', 'bb', 'mixed'], molecular_orbitals: RestrictedMolecularOrbitals, molecular_configuration: MolecularConfiguration, active_range: slice, inactive_range: slice) ndarray[tuple[Any, ...], dtype[float64]]

Contract over the two middle indices: \(g_{piiq} \to g_{pq}\).

Parameters:
  • component (Literal['aa', 'bb', 'mixed']) – Which integral component to use (ignored for restricted; always alpha).

  • molecular_orbitals (RestrictedMolecularOrbitals) – The restricted Molecular Orbitals.

  • molecular_configuration (MolecularConfiguration) – The molecular configuration.

  • active_range (slice) – Slice selecting active MO columns for the free pair (p, q).

  • inactive_range (slice) – Slice selecting inactive MO columns for the contracted pair (i).

Return type:

ndarray[tuple[Any, …], dtype[float64]]

internal_contracted_right(component: Literal['aa', 'bb', 'mixed'], molecular_orbitals: RestrictedMolecularOrbitals, molecular_configuration: MolecularConfiguration, active_range: slice, inactive_range: slice) ndarray[tuple[Any, ...], dtype[float64]]

Contract over the two rightmost indices: \(g_{pqii} \to g_{pq}\).

Parameters:
  • component (Literal['aa', 'bb', 'mixed']) – Which integral component to use (ignored for restricted; always alpha).

  • molecular_orbitals (RestrictedMolecularOrbitals) – The restricted Molecular Orbitals.

  • molecular_configuration (MolecularConfiguration) – The molecular configuration.

  • active_range (slice) – Slice selecting active MO columns for the free pair (p, q).

  • inactive_range (slice) – Slice selecting inactive MO columns for the contracted pair (i).

Return type:

ndarray[tuple[Any, …], dtype[float64]]

internal_trace_contracted_middle(component: Literal['aa', 'bb', 'mixed'], molecular_orbitals: RestrictedMolecularOrbitals, molecular_configuration: MolecularConfiguration, orbital_range: slice) float

Compute \(\sum_{p,i} g_{piip}\) for the given orbital range.

Parameters:
  • component (Literal['aa', 'bb', 'mixed']) – Which integral component to use (ignored for restricted; always alpha).

  • molecular_orbitals (RestrictedMolecularOrbitals) – The restricted Molecular Orbitals.

  • molecular_configuration (MolecularConfiguration) – The molecular configuration.

  • orbital_range (slice) – Slice selecting orbital indices for both the free and contracted pairs.

Return type:

float

internal_trace_contracted_right(component: Literal['aa', 'bb', 'mixed'], molecular_orbitals: RestrictedMolecularOrbitals, molecular_configuration: MolecularConfiguration, orbital_range: slice) float

Compute \(\sum_{p,i} g_{ppii}\) for the given orbital range.

Parameters:
  • component (Literal['aa', 'bb', 'mixed']) – Which integral component to use (ignored for restricted; always alpha).

  • molecular_orbitals (RestrictedMolecularOrbitals) – The restricted Molecular Orbitals.

  • molecular_configuration (MolecularConfiguration) – The molecular configuration.

  • orbital_range (slice) – Slice selecting orbital indices for both the free and contracted pairs.

Return type:

float

class UnrestrictedResolutionOfTheIdentityIntegralBuilder

Bases: object

Build unrestricted integrals using Resolution of the Identity (RI) integrals.

__init__(*, aux_basis: BasisSet | None = None) None

Initialize the Unrestricted Resolution of the Identity (RI) integral builder.

Parameters:

aux_basis (BasisSet | None) – The auxiliary density-fitting RI basis set. Defaults to a tailored basis based on orbital basis set or auto generated basis.

Return type:

None

calculate_integrals(molecular_orbitals: UnrestrictedMolecularOrbitals, molecular_configuration: MolecularConfiguration) UnrestrictedResolutionOfTheIdentityIntegrals

Calculate the unrestricted Resolution of the Identity (RI) two-electron repulsion integrals (ERI).

Parameters:
Return type:

UnrestrictedResolutionOfTheIdentityIntegrals

internal_contracted_left(component: Literal['aa', 'bb', 'mixed'], molecular_orbitals: UnrestrictedMolecularOrbitals, molecular_configuration: MolecularConfiguration, active_range: slice, inactive_range: slice) ndarray[tuple[Any, ...], dtype[float64]]

Contract over the two leftmost indices: \(g_{iipq} \to g_{pq}\).

Computes result[p,q] = sum_A sum_i L_left[A,i,i] * L_right[A,p,q] directly from the packed AO Cholesky factors in a single chunked pass.

Parameters:
  • component (Literal['aa', 'bb', 'mixed']) – Which integral component to use “aa”, “bb”, or “mixed”.

  • molecular_orbitals (UnrestrictedMolecularOrbitals) – The unrestricted Molecular Orbitals.

  • molecular_configuration (MolecularConfiguration) – The molecular configuration.

  • active_range (slice) – Slice selecting active MO columns for the free pair (p, q).

  • inactive_range (slice) – Slice selecting inactive MO columns for the contracted pair (i).

Return type:

ndarray[tuple[Any, …], dtype[float64]]

internal_contracted_middle(component: Literal['aa', 'bb', 'mixed'], molecular_orbitals: UnrestrictedMolecularOrbitals, molecular_configuration: MolecularConfiguration, active_range: slice, inactive_range: slice) ndarray[tuple[Any, ...], dtype[float64]]

Contract over the two middle indices: \(g_{piiq} \to g_{pq}\).

Computes result[p,q] = sum_A sum_i L_left[A,p,i] * L_right[A,i,q] directly from the packed AO Cholesky factors in a single chunked pass.

Parameters:
  • component (Literal['aa', 'bb', 'mixed']) – Which integral component to use “aa”, “bb”, or “mixed”.

  • molecular_orbitals (UnrestrictedMolecularOrbitals) – The unrestricted Molecular Orbitals.

  • molecular_configuration (MolecularConfiguration) – The molecular configuration.

  • active_range (slice) – Slice selecting active MO columns for the free pair (p, q).

  • inactive_range (slice) – Slice selecting inactive MO columns for the contracted pair (i).

Return type:

ndarray[tuple[Any, …], dtype[float64]]

internal_contracted_right(component: Literal['aa', 'bb', 'mixed'], molecular_orbitals: UnrestrictedMolecularOrbitals, molecular_configuration: MolecularConfiguration, active_range: slice, inactive_range: slice) ndarray[tuple[Any, ...], dtype[float64]]

Contract over the two rightmost indices: \(g_{pqii} \to g_{pq}\).

Computes result[p,q] = sum_A L_left[A,p,q] * sum_i L_right[A,i,i] directly from the packed AO Cholesky factors in a single chunked pass, never materialising the full MO-basis Cholesky tensor.

Parameters:
  • component (Literal['aa', 'bb', 'mixed']) – Which integral component to use “aa”, “bb”, or “mixed”.

  • molecular_orbitals (UnrestrictedMolecularOrbitals) – The unrestricted Molecular Orbitals.

  • molecular_configuration (MolecularConfiguration) – The molecular configuration.

  • active_range (slice) – Slice selecting active MO columns for the free pair (p, q).

  • inactive_range (slice) – Slice selecting inactive MO columns for the contracted pair (i).

Return type:

ndarray[tuple[Any, …], dtype[float64]]

internal_trace_contracted_middle(component: Literal['aa', 'bb', 'mixed'], molecular_orbitals: UnrestrictedMolecularOrbitals, molecular_configuration: MolecularConfiguration, orbital_range: slice) float

Compute \(\sum_{p,i} g_{piip}\) for the given orbital range and component.

This is trace(internal_contracted_middle(component, orbital_range, orbital_range)), but computed in a single efficient chunked pass over the AO Cholesky factors.

Parameters:
  • component (Literal['aa', 'bb', 'mixed']) – Which integral component to use “aa”, “bb”, or “mixed”.

  • molecular_orbitals (UnrestrictedMolecularOrbitals) – The unrestricted Molecular Orbitals.

  • molecular_configuration (MolecularConfiguration) – The molecular configuration.

  • orbital_range (slice) – Slice selecting orbital indices for both the free and contracted pairs.

Return type:

float

internal_trace_contracted_right(component: Literal['aa', 'bb', 'mixed'], molecular_orbitals: UnrestrictedMolecularOrbitals, molecular_configuration: MolecularConfiguration, orbital_range: slice) float

Compute \(\sum_{p,i} g_{ppii}\) for the given orbital range and component.

This is trace(internal_contracted_right(component, orbital_range, orbital_range)), but computed in a single efficient chunked pass over the AO Cholesky factors.

Parameters:
  • component (Literal['aa', 'bb', 'mixed']) – Which integral component to use “aa”, “bb”, or “mixed”.

  • molecular_orbitals (UnrestrictedMolecularOrbitals) – The unrestricted Molecular Orbitals.

  • molecular_configuration (MolecularConfiguration) – The molecular configuration.

  • orbital_range (slice) – Slice selecting orbital indices for both the free and contracted pairs.

Return type:

float