qrunch.chemistry.qrackle.scf.builders.fock_builder_protocol

Protocol for builders of Fock or Kohn-Sham matrices.

Classes

FockBuilderFactoryProtocol

Factory that preserves the SCF matrix module's spin-wrapper types.

FockBuilderProtocol

Build an effective one-particle matrix and its density response.

class FockBuilderFactoryProtocol

Bases: Protocol[TMatrix, TVector]

Factory that preserves the SCF matrix module’s spin-wrapper types.

__init__(*args, **kwargs)
class FockBuilderProtocol

Bases: Protocol[TSCFMatrix, TSCFVector_co, TMatrix_co, TVector_co]

Build an effective one-particle matrix and its density response.

Both Hartree-Fock and Kohn-Sham builders satisfy this protocol. The key distinction is between the interaction potential

\[G[D] = F[D] - h\]

and its first-order response at a reference density

\[\delta F = F'[D_0](\delta D).\]

For Hartree-Fock, \(G\) is linear in the density and therefore \(F'[D_0](\delta D) = G[\delta D]\). For Kohn-Sham DFT this identity generally does not hold because \(V_{\mathrm{xc}}[D]\) is nonlinear.

__init__(*args, **kwargs)
compute(core_hamiltonian: TSCFMatrix, density_matrix: TSCFMatrix, molecular_configuration: MolecularConfiguration) → TSCFMatrix

Build the effective one-particle matrix \(F[D] = h + G[D]\) for a given density.

Parameters:
  • core_hamiltonian (TSCFMatrix) – Core Hamiltonian \(h = T + V_{\mathrm{nuc}}\).

  • density_matrix (TSCFMatrix) – Density matrix in the AO basis.

  • molecular_configuration (MolecularConfiguration) – Molecular configuration.

Return type:

TSCFMatrix

compute_density_response(reference_density_matrix: TSCFMatrix, density_matrix_direction: TSCFMatrix, molecular_configuration: MolecularConfiguration) → TSCFMatrix

Apply \(F'[D_0]\) to one density-matrix direction.

Parameters:
  • reference_density_matrix (TSCFMatrix) – Reference density \(D_0\) in the AO basis.

  • density_matrix_direction (TSCFMatrix) – Density perturbation \(\delta D\) in the AO basis.

  • molecular_configuration (MolecularConfiguration) – Molecular configuration.

Return type:

TSCFMatrix

compute_density_response_many(reference_density_matrix: TSCFMatrix, density_matrix_directions: list[TSCFMatrix], molecular_configuration: MolecularConfiguration) → list[TSCFMatrix]

Apply \(F'[D_0]\) to several density-matrix directions.

All directions share the same reference density. Implementations should reuse response intermediates associated with \(D_0\).

Parameters:
  • reference_density_matrix (TSCFMatrix) – Reference density \(D_0\) in the AO basis.

  • density_matrix_directions (list[TSCFMatrix]) – Density perturbations in the AO basis.

  • molecular_configuration (MolecularConfiguration) – Molecular configuration.

Return type:

list[TSCFMatrix]

compute_many(core_hamiltonian: TSCFMatrix, density_matrices: list[TSCFMatrix], molecular_configuration: MolecularConfiguration) → list[TSCFMatrix]

Build effective one-particle matrices for several densities.

Implementations should reuse shared intermediates across the density batch when the underlying backend supports it.

Parameters:
  • core_hamiltonian (TSCFMatrix) – Core Hamiltonian in the AO basis.

  • density_matrices (list[TSCFMatrix]) – Density matrices in the AO basis.

  • molecular_configuration (MolecularConfiguration) – Molecular configuration.

Return type:

list[TSCFMatrix]

electronic_energy(core_hamiltonian: TSCFMatrix, density_matrix: TSCFMatrix, effective_matrix: TSCFMatrix, molecular_configuration: MolecularConfiguration) → float

Compute the electronic energy for a density and effective matrix.

Parameters:
  • core_hamiltonian (TSCFMatrix) – Core Hamiltonian in the AO basis.

  • density_matrix (TSCFMatrix) – Density matrix in the AO basis.

  • effective_matrix (TSCFMatrix) – Effective matrix returned by compute().

  • molecular_configuration (MolecularConfiguration) – Molecular configuration.

Return type:

float

property is_linear_in_density: bool

Whether \(G[D] = F[D] - h\) is linear in the density.

Hartree-Fock builders assembled from Coulomb and exact exchange return True. Kohn-Sham builders with a nonlinear XC potential return False.