qrunch.chemistry.qrackle.scf.creators
Creator for mean-field (Hartree-Fock) calculators.
Functions
Create a builder for mean-field (Hartree-Fock, DFT) calculations. |
Classes
Creator that assembles a Kohn-Sham DFT ground-state calculator. |
|
Sub-creator for fallback SCF stepper builder. |
|
Sub-creator for Global SCF stepper builder. |
|
Creator that assembles a Hartree-Fock mean-field calculator. |
|
Sub-creator for initial density guess. |
|
Sub-creator for Local SCF stepper builder. |
|
Sub-creator for matrix module. |
|
Top-level creator for mean-field calculations. |
|
Sub-creator for approximate-Fock SCF acceleration. |
|
Sub-creator for the post-convergence orbital stability checker builder. |
- class DFTMeanFieldCreator
Bases:
_MeanFieldCreatorMixinCreator that assembles a Kohn-Sham DFT ground-state calculator.
- __init__() None
Initialise the DFT creator.
- Return type:
None
- choose_acceleration() SCFAccelerationSubCreator[Self]
Choose SCF acceleration. Density-fitted acceleration is enabled by default.
- Return type:
- choose_fallback_scf_stepper() FallbackSCFStepperBuilderSubCreator[Self]
Choose the fallback SCF stepper.
- Return type:
- choose_global_scf_stepper() GlobalSCFStepperBuilderSubCreator[Self]
Choose the SCF stepper used outside the local convergence region.
Configure the robust stepper used when the SCF iteration is far from a self-consistent solution or when a local acceleration method is no longer making reliable progress.
Global steppers are intended to prioritize robustness over rapid local convergence. Methods such as Trust-Region Augmented-Hessian (TRAH) or Augmented Roothaan-Hall (ARH) use additional curvature or step-control information to obtain reliable progress in regions where methods such as DIIS may extrapolate poorly, oscillate, stall, or diverge.
The SCF controller may use this stepper initially and switch to the local stepper once the iteration has entered a well-behaved local convergence region. It may also return to this stepper if the local method loses convergence.
Here, “global” refers to a method designed to operate over a broader SCF convergence region and does not imply that global convergence to the desired SCF solution is mathematically guaranteed.
- Return type:
- choose_initial_guess_density() InitialGuessDensitySubCreator[Self]
Choose the initial density guess.
- Return type:
- choose_local_scf_stepper() LocalSCFStepperBuilderSubCreator[Self]
Choose the SCF stepper used in the local convergence region.
Configure the stepper used when the SCF iteration is sufficiently close to a self-consistent solution that a local acceleration method is expected to converge rapidly.
Local steppers are intended to exploit the approximately linear behavior near a stationary point. Methods such as DIIS are typically very efficient in this regime, but can become unreliable when the current density is far from the solution or when the SCF iterations stall, oscillate, or diverge.
The SCF controller may switch from the global stepper to this stepper once the convergence criteria indicate that the iteration has entered the local convergence region. It may switch back to the global stepper if local convergence deteriorates.
Here, “local” refers to the local convergence region around an SCF stationary point and does not refer to spatial locality.
The local SCF stepper may be deactivated in which case the Global SCF stepper will be used to convergence.
- Return type:
- choose_matrix_module() MatrixModuleSubCreator[Self]
Choose the matrix module.
- Return type:
MatrixModuleSubCreator[Self]
- choose_stability_checker() StabilityCheckerBuilderSubCreator[Self]
Choose the post-convergence orbital stability checker.
A converged SCF solution is a stationary point of the energy, but not necessarily a minimum. A stability checker searches the converged solution for negative orbital-Hessian curvature and, if found, continues the SCF from a displaced density. This can improve the energetic quality of a solution trapped at a saddle point, but adds potentially expensive Hessian analyses and SCF iterations, and does not guarantee the lowest-energy solution.
No stability check is performed by default.
- Return type:
- create() MeanFieldGroundStateCalculator[NumpyMatrix, NumpyVector] | MeanFieldGroundStateCalculator[CuPyMatrix, CuPyVector]
Create a Kohn-Sham DFT mean-field calculator.
- with_functional(functional: str) Self
Set the PySCF LibXC functional expression. Default is ωB97M-V.
- Parameters:
functional (str) – Functional expression, for example
"B3LYP".- Return type:
Self
- with_options(options: SelfConsistentFieldSolverOptions) Self
Set the options for the self-consistent field solver.
- Parameters:
options (SelfConsistentFieldSolverOptions) – The options to use.
- Return type:
Self
- with_xc_grid_options(options: ExchangeCorrelationGridOptions) Self
Set options for the PySCF exchange-correlation integration grid.
- Parameters:
options (ExchangeCorrelationGridOptions) – Exchange-correlation grid options.
- Return type:
Self
- class FallbackSCFStepperBuilderSubCreator
Bases:
Generic[T]Sub-creator for fallback SCF stepper builder.
- __init__(parent: T, attr_name: str) None
Initialize the fallback SCF stepper builder sub-creator.
- Parameters:
parent (T) – The parent object to attach the matrix module to.
attr_name (str) – The attribute name to use for the matrix module.
- Return type:
None
- damped(options: DampedSCFOptions | None = None) T
Use Damped Roothaan Hall algorithm as the fallback SCF stepper.
- Parameters:
options (DampedSCFOptions | None)
- Return type:
T
- oda(options: ODAOptions | None = None) T
Use ODA - Optimal Damping Algorithm as the fallback SCF stepper.
- Parameters:
options (ODAOptions | None)
- Return type:
T
- class GlobalSCFStepperBuilderSubCreator
Bases:
Generic[T]Sub-creator for Global SCF stepper builder.
- __init__(parent: T, attr_name: str) None
Initialize the Global SCF stepper builder sub-creator.
- Parameters:
parent (T) – The parent object to attach the Global SCF stepper builder to.
attr_name (str) – The attribute name to use for the Global SCF stepper builder.
- Return type:
None
- arh(options: AugmentedRoothaanHallOptions | None = None) T
Use ARH - Augmented Roothaan-Hall orbital optimization as the Global SCF stepper.
- Parameters:
options (AugmentedRoothaanHallOptions | None)
- Return type:
T
- damped(options: DampedSCFOptions | None = None) T
Use Damped Roothaan Hall algorithm as the Global SCF stepper.
- Parameters:
options (DampedSCFOptions | None)
- Return type:
T
- diis(options: DIISOptions | None = None) T
Use DIIS - Direct Inversion in the Iterative Subspace algorithm as the Global SCF stepper.
- Parameters:
options (DIISOptions | None)
- Return type:
T
- oda(options: ODAOptions | None = None) T
Use ODA - Optimal Damping Algorithm as the Global SCF stepper.
- Parameters:
options (ODAOptions | None)
- Return type:
T
- trah(options: TrustRegionAugmentedHessianOptions | None = None) T
Use TRAH - Trust-Region Augmented-Hessian orbital optimization as the Global SCF stepper.
- Parameters:
options (TrustRegionAugmentedHessianOptions | None)
- Return type:
T
- class HartreeFockCreator
Bases:
_MeanFieldCreatorMixinCreator that assembles a Hartree-Fock mean-field calculator.
- __init__() None
Initialise the Hartree-Fock creator.
- Return type:
None
- choose_acceleration() SCFAccelerationSubCreator[Self]
Choose SCF acceleration. Density-fitted acceleration is enabled by default.
- Return type:
- choose_fallback_scf_stepper() FallbackSCFStepperBuilderSubCreator[Self]
Choose the fallback SCF stepper.
- Return type:
- choose_global_scf_stepper() GlobalSCFStepperBuilderSubCreator[Self]
Choose the SCF stepper used outside the local convergence region.
Configure the robust stepper used when the SCF iteration is far from a self-consistent solution or when a local acceleration method is no longer making reliable progress.
Global steppers are intended to prioritize robustness over rapid local convergence. Methods such as Trust-Region Augmented-Hessian (TRAH) or Augmented Roothaan-Hall (ARH) use additional curvature or step-control information to obtain reliable progress in regions where methods such as DIIS may extrapolate poorly, oscillate, stall, or diverge.
The SCF controller may use this stepper initially and switch to the local stepper once the iteration has entered a well-behaved local convergence region. It may also return to this stepper if the local method loses convergence.
Here, “global” refers to a method designed to operate over a broader SCF convergence region and does not imply that global convergence to the desired SCF solution is mathematically guaranteed.
- Return type:
- choose_initial_guess_density() InitialGuessDensitySubCreator[Self]
Choose the initial density guess.
- Return type:
- choose_local_scf_stepper() LocalSCFStepperBuilderSubCreator[Self]
Choose the SCF stepper used in the local convergence region.
Configure the stepper used when the SCF iteration is sufficiently close to a self-consistent solution that a local acceleration method is expected to converge rapidly.
Local steppers are intended to exploit the approximately linear behavior near a stationary point. Methods such as DIIS are typically very efficient in this regime, but can become unreliable when the current density is far from the solution or when the SCF iterations stall, oscillate, or diverge.
The SCF controller may switch from the global stepper to this stepper once the convergence criteria indicate that the iteration has entered the local convergence region. It may switch back to the global stepper if local convergence deteriorates.
Here, “local” refers to the local convergence region around an SCF stationary point and does not refer to spatial locality.
The local SCF stepper may be deactivated in which case the Global SCF stepper will be used to convergence.
- Return type:
- choose_matrix_module() MatrixModuleSubCreator[Self]
Choose the matrix module.
- Return type:
MatrixModuleSubCreator[Self]
- choose_stability_checker() StabilityCheckerBuilderSubCreator[Self]
Choose the post-convergence orbital stability checker.
A converged SCF solution is a stationary point of the energy, but not necessarily a minimum. A stability checker searches the converged solution for negative orbital-Hessian curvature and, if found, continues the SCF from a displaced density. This can improve the energetic quality of a solution trapped at a saddle point, but adds potentially expensive Hessian analyses and SCF iterations, and does not guarantee the lowest-energy solution.
No stability check is performed by default.
- Return type:
- create() MeanFieldGroundStateCalculator[NumpyMatrix, NumpyVector] | MeanFieldGroundStateCalculator[CuPyMatrix, CuPyVector]
Create a Hartree-Fock mean-field calculator.
- with_options(options: SelfConsistentFieldSolverOptions) Self
Set the options for the self-consistent field solver.
- Parameters:
options (SelfConsistentFieldSolverOptions) – The options to use.
- Return type:
Self
- class InitialGuessDensitySubCreator
Bases:
Generic[T]Sub-creator for initial density guess.
- __init__(parent: T, attr_name: str) None
Initialize the initial guess density sub-creator.
- Parameters:
parent (T) – The parent object to attach the initial density guess builder to.
attr_name (str) – The attribute name to use for the initial density guess builder.
- Return type:
None
- core() T
Use Core Hamiltonian initial density guess.
- Return type:
T
- sad() T
Use Superposition of Atomic Densities (SAD) initial density guess.
- Return type:
T
- sap(basis_name: Literal['sap_grasp_large', 'sap_helfem_large'] | str = 'sap_helfem_large') T
Use Superposition of Atomic Potentials (SAP) initial density guess.
- Parameters:
basis_name (Literal['sap_grasp_large', 'sap_helfem_large'] | str) – Name of the SAP basis set (
"sap_grasp_large"or"sap_helfem_large").- Return type:
T
- class LocalSCFStepperBuilderSubCreator
Bases:
Generic[T]Sub-creator for Local SCF stepper builder.
- __init__(parent: T, attr_name: str) None
Initialize the Local SCF stepper builder sub-creator.
- Parameters:
parent (T) – The parent object to attach the Local SCF stepper builder to.
attr_name (str) – The attribute name to use for the Local SCF stepper builder.
- Return type:
None
- crop(options: CROPOptions | None = None) T
Use CROP as the local SCF stepper instead of DIIS.
CROP retains optimized Fock/commutator-error pairs and combines them with the raw trial pairs and transformed commutators that DIIS uses. Unlike DIIS, its retained history preserves information from raw pairs that have left the SCF queue.
- Parameters:
options (CROPOptions | None) – CROP history, raw-pair bounds and numerical stability settings.
- Return type:
T
- damped(options: DampedSCFOptions | None = None) T
Use Damped Roothaan Hall algorithm as the Local SCF stepper.
- Parameters:
options (DampedSCFOptions | None)
- Return type:
T
- deactivated() T
Deactivate the Local SCF stepper.
- Return type:
T
- diis(options: DIISOptions | None = None) T
Use DIIS - Direct Inversion in the Iterative Subspace algorithm as the Local SCF stepper.
- Parameters:
options (DIISOptions | None)
- Return type:
T
- oda(options: ODAOptions | None = None) T
Use ODA - Optimal Damping Algorithm as the Local SCF stepper.
- Parameters:
options (ODAOptions | None)
- Return type:
T
- trah(options: TrustRegionAugmentedHessianOptions | None = None) T
Use TRAH - Trust-Region Augmented-Hessian orbital optimization as the Local SCF stepper.
- Parameters:
options (TrustRegionAugmentedHessianOptions | None)
- Return type:
T
- class MatrixModuleSubCreator
Bases:
Generic[T]Sub-creator for matrix module.
- __init__(parent: T, attr_name: str) None
Initialize the matrix module sub-creator.
- Parameters:
parent (T) – The parent object to attach the matrix module to.
attr_name (str) – The attribute name to use for the matrix module.
- Return type:
None
- cpu_dense() T
Use dense cpu based matrix algebra.
- Return type:
T
- cuda_dense() T
Use dense cuda gpu based matrix algebra.
- Return type:
T
- class MeanFieldCreator
Bases:
objectTop-level creator for mean-field calculations.
- static dft() DFTMeanFieldCreator
Configure a DFT mean-field calculation.
- Return type:
- static hartree_fock() HartreeFockCreator
Configure a Hartree-Fock mean-field calculation.
- Return type:
- class SCFAccelerationSubCreator
Bases:
Generic[T]Sub-creator for approximate-Fock SCF acceleration.
- __init__(parent: T, density_fitting_attr_name: str, accelerator_attr_name: str) None
Initialize the acceleration sub-creator.
- Parameters:
parent (T) – The parent creator to configure.
density_fitting_attr_name (str) – The attribute holding density-fitting options.
accelerator_attr_name (str) – The attribute holding approximate-Fock accelerator options.
- Return type:
None
- deactivated() T
Use only the unfitted physical SCF solver, without approximate-Fock acceleration.
- Return type:
T
- density_fitting(density_fitting_options: DensityFittingOptions | None = None, accelerator_options: ApproximateFockAcceleratorOptions | None = None) T
Accelerate HF or DFT with a corrected density-fitted Fock (the default).
Bounded fitted solves use a fixed physical-minus-model Fock correction: unfitted-minus-fitted for the Coulomb and exchange contributions. Candidates are checked with the unfitted physical builder, and the physical solver determines the final energy, convergence and orbital stability. Slow or unconverged model solves return control to non-accelerated SCF. The molecular configuration supplies the auxiliary basis. Restricted and unrestricted calculations share one packed factor cache. Fitted contractions run on the CPU even when a GPU matrix module is selected.
For DFT, pure, global-hybrid and range-separated functionals are supported. The model uses the physical XC functional and grid unless
accelerator_options.approximate_grid_optionsselects a separate grid. By default it omits VV10-style nonlocal correlation from the model; seeApproximateFockAcceleratorOptions. The fixed correction includes any physical-minus-model XC potential at the reference density.- Parameters:
density_fitting_options (DensityFittingOptions | None) – Packed-factor memory options. None uses the defaults.
accelerator_options (ApproximateFockAcceleratorOptions | None) – Options and iteration budget for approximate-Fock solves. None uses the defaults.
- Return type:
T
- class StabilityCheckerBuilderSubCreator
Bases:
Generic[T]Sub-creator for the post-convergence orbital stability checker builder.
- __init__(parent: T, attr_name: str) None
Initialize the stability checker builder sub-creator.
- Parameters:
parent (T) – The parent object to attach the stability checker builder to.
attr_name (str) – The attribute name to use for the stability checker builder.
- Return type:
None
- deactivated() T
Do not check the converged SCF solution for orbital instabilities (the default).
- Return type:
T
- exact_hessian(options: ExactHessianStabilityCheckerOptions | None = None) T
Follow real orbital instabilities found with the exact orbital Hessian after SCF convergence.
- Parameters:
options (ExactHessianStabilityCheckerOptions | None) – Options for the stability checker. If None, default options are used.
- Return type:
T
- mean_field_creator() MeanFieldCreator
Create a builder for mean-field (Hartree-Fock, DFT) calculations.
This is the intended starting point for creating any type of native Hartree-Fock or DFT calculator. See https://qrunch.docs.kvantify.net/docs/explanations/builder_pattern.html for more information on using the builder pattern.
- Return type: