qrunch.chemistry.qrackle.scf.steppers.optimal_damping_algorithm
An Optimal Damping Algorithm (ODA) SCF stepper.
The Optimal Damping Algorithm (ODA) of Cances and Le Bris replaces the fixed
damping parameter of DampedSCFStepper with a parameter that is chosen
to minimize the electronic energy along the SCF direction at every iteration.
Given the current AO density matrix \(D_k\), the current Fock matrix \(F_k = F[D_k]\), and the Roothaan-Hall density \(D_{\mathrm{SCF}}\) obtained by diagonalizing \(F_k\), ODA moves along the line
with \(0 \le \lambda \le 1\). For Hartree-Fock the energy along this line is exactly quadratic,
with slope and curvature
where \(G[D] = F[D] - h\) is the (linear) two-electron part of the Fock matrix. The optimal step is
for a convex quadratic (\(c > 0\)); otherwise the minimum on the interval is taken at the full step \(\lambda = 1\).
Note
The step behaviour depends on whether the supplied builder reports
is_linear_in_density.
Linear operator (Hartree-Fock or Coulomb/exact-exchange hybrids): the two-electron part is linear, so \(F[D_{\mathrm{SCF}}] = F_k + G[\Delta D]\) is available cheaply, the line energy is exactly quadratic with \(c = \tfrac{1}{2}\mathrm{Tr}(G[\Delta D]\,\Delta D)\), and \(\lambda_{\mathrm{opt}}\) is the exact minimizer.
Nonlinear operator (Kohn-Sham DFT with an exchange-correlation functional): the additive shortcut is invalid, so \(F[D_{\mathrm{SCF}}]\) is obtained from a real build. The exact slope \(s = \mathrm{Tr}(F_k\,\Delta D)\) is combined with the approximate curvature \(c = \tfrac{1}{2}\mathrm{Tr}((F[D_{\mathrm{SCF}}] - F_k)\,\Delta D)\) to form a quadratic model of the line energy; the resulting step is a robust approximation rather than the exact minimizer.
As the ODA calculate a new Fock/Kohn-Sham matrix at the Roothaan-Hall density, it can optionally push the idempotent-density pair \((F[D_{\mathrm{SCF}}], D_{\mathrm{SCF}})\) into the SCF queue so that a later DIIS phase can exploit it.
References: [CancesLB00, YM14].
Classes
Options for the ODA SCF stepper. |
|
Create a new density matrix using the Optimal Damping Algorithm (ODA). |
|
Wrapper for the OptimalDampingAlgorithmSCFStepper. |
- class ODAOptions
Bases:
DataclassPublicAPIOptions for the ODA SCF stepper.
- Parameters:
update_scf_queue – Save the Roothaan-Hall Fock/density pair into the SCF queue.
- __init__(*, update_scf_queue: bool = False) None
- Parameters:
update_scf_queue (bool)
- Return type:
None
- update_scf_queue: bool = False
- class OptimalDampingAlgorithmSCFStepper
Bases:
Generic[TSCFMatrix,TSCFVector,TMatrix,TVector]Create a new density matrix using the Optimal Damping Algorithm (ODA).
- __init__(scf_matrix_module: SCFMatrixModuleProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector], fock_builder: FockBuilderProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector], *, options: ODAOptions | None = None) None
Initialise the Optimal Damping Algorithm (ODA) SCF stepper.
The stepper performs a Roothaan-Hall step to obtain the SCF density \(D_{\mathrm{SCF}}\) and then moves along \(D_k + \lambda (D_{\mathrm{SCF}} - D_k)\) by the step \(\lambda\) that minimizes the (exactly quadratic) Hartree-Fock energy on the interval \([0, 1]\).
While evaluating the curvature the Fock matrix at the Roothaan-Hall density, \(F[D_{\mathrm{SCF}}]\), is formed. For a Fock matrix builder (that depend linear on the density matrix) it reuses \(G[\Delta D]\) via \(F[D_{\mathrm{SCF}}] = F_k + G[\Delta D]\) and needs no extra full build; for a nonlinear builder it is obtained from a real build.
- Parameters:
scf_matrix_module (SCFMatrixModuleProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector]) – SCF matrix module (restricted or unrestricted).
fock_builder (FockBuilderProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector]) – Builder used to evaluate the Fock matrix. It selects the exact (linear) or approximate (nonlinear) ODA step.
options (ODAOptions | None) – Options for the ODA stepper. If None, default options are used.
- Return type:
None
- property can_update_scf_queue: bool
Whether the stepper can update the SCF queue.
- create_new_density(scf_queue: SCFQueueProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector], current_density: TSCFMatrix, current_fock: TSCFMatrix, core_hamiltonian: TSCFMatrix, overlap_matrix: TSCFMatrix, lowdin_orthogonalizer: TSCFMatrix, molecular_configuration: MolecularConfiguration, roothaan_hall_solver: RoothaanHallSolver[TSCFMatrix, TSCFVector, TMatrix, TVector], orbital_occupation: OrbitalOccupation) TSCFMatrix
Produce a new AO density by taking the optimal step along the SCF direction.
- Parameters:
scf_queue (SCFQueueProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector]) – The SCF queue containing Fock matrices and their associated error matrices.
current_density (TSCFMatrix) – The current density matrix \(D_k\).
current_fock (TSCFMatrix) – The current Fock (or Kohn-Sham) matrix \(F_k = F[D_k]\).
core_hamiltonian (TSCFMatrix) – The core Hamiltonian \(h = T + V_{\mathrm{nuc}}\).
overlap_matrix (TSCFMatrix) – The overlap matrix \(S\).
lowdin_orthogonalizer (TSCFMatrix) – The Lowdin orthogonalizer \(S^{-1/2}\).
molecular_configuration (MolecularConfiguration) – The molecular configuration.
roothaan_hall_solver (RoothaanHallSolver[TSCFMatrix, TSCFVector, TMatrix, TVector]) – A Roothaan-Hall solver to solve the Roothaan-Hall equation.
orbital_occupation (OrbitalOccupation) – Electron occupation specifying how many orbitals are occupied.
- Return type:
TSCFMatrix
- free() None
Free any retained matrices.
- Return type:
None
- init_scf_queue(max_length: int) SCFQueueProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector]
Create a SCF queue.
- Parameters:
max_length (int)
- Return type:
SCFQueueProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector]
- property is_local_region_indicated: bool
Indicate the local region when the SCF gradient is sufficiently small.
- property options: ODAOptions
Options used by the ODA stepper.
- reset() None
Reset the internal state of the SCF stepper.
- Return type:
None
- class OptimalDampingAlgorithmSCFStepperBuilder
Bases:
SCFStepperBuilderProtocolWrapper for the OptimalDampingAlgorithmSCFStepper.
- __init__(options: ODAOptions | None = None) None
Initialise the ODA SCF stepper wrapper.
- Parameters:
options (ODAOptions | None) – Options for the ODA stepper. If None, default options are used.
- Return type:
None
- create_stepper(scf_matrix_module: SCFMatrixModuleProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector], fock_builder: FockBuilderProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector], fallback_scf_stepper_builder: SCFStepperBuilderProtocol | None = None) OptimalDampingAlgorithmSCFStepper[TSCFMatrix, TSCFVector, TMatrix, TVector]
Create a new DampedSCFStepper with the specified damping factor.
- Parameters:
scf_matrix_module (SCFMatrixModuleProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector]) – SCF matrix module (restricted or unrestricted).
fock_builder (FockBuilderProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector]) – Builder the construct Fock matrix.
fallback_scf_stepper_builder (SCFStepperBuilderProtocol | None) – Optional fallback SCF stepper builder. Not used in this implementation.
- Return type:
OptimalDampingAlgorithmSCFStepper[TSCFMatrix, TSCFVector, TMatrix, TVector]