qrunch.chemistry.qrackle.scf.approximate_fock_accelerator

Approximate-Fock SCF acceleration with an inexpensive approximate Fock builder.

Classes

ApproximateFockAccelerator

Accelerate SCF with bounded solves of an inexpensive approximate Fock corrected towards the physical Fock.

ApproximateFockAcceleratorBuilder

Build approximate-Fock accelerators for restricted and unrestricted SCF.

ApproximateFockAcceleratorOptions

Options for approximate-Fock SCF acceleration.

class ApproximateFockAccelerator

Bases: MetadataFromFields, Generic[TSCFMatrix, TSCFVector, TMatrix, TVector]

Accelerate SCF with bounded solves of an inexpensive approximate Fock corrected towards the physical Fock.

Each approximate-Fock solve uses a fixed physical-minus-approximate Fock correction evaluated at the best physical state so far. The initial density and candidates are checked with the physical Fock builder, and only the best physical state is handed to the SCF solver. An already stationary initial density bypasses approximate solves; the physical solver still checks determinant validity and stability.

__init__(scf_matrix_module: SCFMatrixModuleProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector], fock_builder: FockBuilderProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector], approximate_fock_builder: FockBuilderProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector], solver_builder: SelfConsistentFieldSolverBuilderProtocol[TMatrix, TVector], options: ApproximateFockAcceleratorOptions | None = None) → None

Initialise the accelerator.

Parameters:
  • scf_matrix_module (SCFMatrixModuleProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector]) – SCF matrix module for algebraic operations.

  • fock_builder (FockBuilderProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector]) – Physical Fock builder used to check candidates.

  • approximate_fock_builder (FockBuilderProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector]) – Inexpensive approximate Fock builder used for the bounded solves.

  • solver_builder (SelfConsistentFieldSolverBuilderProtocol[TMatrix, TVector]) – Builder for the solver that runs the approximate-Fock solves.

  • options (ApproximateFockAcceleratorOptions | None) – Approximate-Fock accelerator options. If None, default options are used.

Return type:

None

prepare(*, density: TSCFMatrix, core_hamiltonian: TSCFMatrix, overlap_matrix: TSCFMatrix, lowdin_orthogonalizer: TSCFMatrix, molecular_configuration: MolecularConfiguration, additional_potential_matrix: TSCFMatrix | None, gradient_scale: float, convergence_tolerance: float, max_physical_iterations: int) → SCFAcceleration[TSCFMatrix]

Find an improved physical state using bounded, fixed-correction approximate-Fock solves.

Parameters:
  • density (TSCFMatrix) – Initial density, consumed by this method.

  • core_hamiltonian (TSCFMatrix) – Physical core Hamiltonian including the supplied potential.

  • overlap_matrix (TSCFMatrix) – AO overlap matrix.

  • lowdin_orthogonalizer (TSCFMatrix) – Lowdin orthogonalizer.

  • molecular_configuration (MolecularConfiguration) – Molecular configuration.

  • additional_potential_matrix (TSCFMatrix | None) – Original additional one-electron potential.

  • gradient_scale (float) – Production size-consistent gradient normalization.

  • convergence_tolerance (float) – Gradient tolerance of the SCF solver.

  • max_physical_iterations (int) – Positive physical-evaluation budget, including the handed-off state.

Return type:

SCFAcceleration[TSCFMatrix]

class ApproximateFockAcceleratorBuilder

Bases: Generic[TMatrix, TVector]

Build approximate-Fock accelerators for restricted and unrestricted SCF.

__init__(approximate_fock_builder_factory: FockBuilderFactoryProtocol[TMatrix, TVector], options: ApproximateFockAcceleratorOptions | None = None) → None

Initialise the builder.

Parameters:
Return type:

None

create_accelerator(scf_matrix_module: SCFMatrixModuleProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector], fock_builder: FockBuilderProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector], solver_builder: SelfConsistentFieldSolverBuilderProtocol[TMatrix, TVector]) → ApproximateFockAccelerator[TSCFMatrix, TSCFVector, TMatrix, TVector]

Create an approximate-Fock accelerator for the supplied matrix module.

Parameters:
  • scf_matrix_module (SCFMatrixModuleProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector]) – SCF matrix module (restricted or unrestricted).

  • fock_builder (FockBuilderProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector]) – Physical Fock builder used to check candidates.

  • solver_builder (SelfConsistentFieldSolverBuilderProtocol[TMatrix, TVector]) – Builder for the solver that runs the approximate-Fock solves.

Return type:

ApproximateFockAccelerator[TSCFMatrix, TSCFVector, TMatrix, TVector]

class ApproximateFockAcceleratorOptions

Bases: DataclassPublicAPI

Options for approximate-Fock SCF acceleration.

Bounded approximate-Fock solves use a fixed physical-minus-approximate Fock correction, and every candidate is checked with the physical Fock builder. Approximate-Fock iterations are budgeted separately from the SCF solver’s max_iterations. The initial density is checked before any approximate solve and retained if no candidate improves its physical gradient.

Parameters:
  • max_iterations – Maximum total number of approximate-Fock iterations.

  • max_correction_rounds – Maximum number of fixed physical-minus-approximate correction rounds after the initial approximate-Fock solve.

  • max_iterations_per_solve – Maximum number of iterations in a single approximate-Fock solve.

  • initial_tolerance – Gradient tolerance of the initial approximate-Fock solve; the SCF convergence tolerance is used if it is larger.

  • corrected_tolerance_fraction – Fraction of the SCF convergence tolerance used as the absolute gradient tolerance of corrected approximate-Fock solves.

  • corrected_relative_tolerance – Gradient tolerance of corrected approximate-Fock solves relative to the best physical gradient. The larger of the absolute and relative tolerances is used.

  • required_gradient_reduction – Factor by which each correction round must reduce the best physical gradient for further rounds to run.

  • approximate_nonlocal_correlation – Whether the approximate Kohn-Sham builder evaluates VV10-style nonlocal correlation. When off, the fixed correction keeps it at each reference density, which avoids its unbatched grid cost in every approximate iteration. Ignored for Hartree-Fock, functionals without nonlocal correlation and caller-supplied XC calculators.

  • approximate_grid_options – XC grid for the approximate Kohn-Sham builder’s energy, potential and responses. The fixed correction includes the physical-minus-approximate XC potential at each reference density; physical checks, final energy and stability keep the physical grid. None uses the physical grid. Ignored for Hartree-Fock and caller-supplied XC calculators.

__init__(*, max_iterations: int = 50, max_correction_rounds: int = 4, max_iterations_per_solve: int = 32, initial_tolerance: float = 1e-06, corrected_tolerance_fraction: float = 0.1, corrected_relative_tolerance: float = 0.0001, required_gradient_reduction: float = 0.1, approximate_nonlocal_correlation: bool = False, approximate_grid_options: ExchangeCorrelationGridOptions | None = None) → None
Parameters:
  • max_iterations (int)

  • max_correction_rounds (int)

  • max_iterations_per_solve (int)

  • initial_tolerance (float)

  • corrected_tolerance_fraction (float)

  • corrected_relative_tolerance (float)

  • required_gradient_reduction (float)

  • approximate_nonlocal_correlation (bool)

  • approximate_grid_options (ExchangeCorrelationGridOptions | None)

Return type:

None

approximate_grid_options: ExchangeCorrelationGridOptions | None = None
approximate_nonlocal_correlation: bool = False
corrected_relative_tolerance: float = 0.0001
corrected_tolerance_fraction: float = 0.1
initial_tolerance: float = 1e-06
max_correction_rounds: int = 4
max_iterations: int = 50
max_iterations_per_solve: int = 32
required_gradient_reduction: float = 0.1