qrunch.chemistry.qrackle.scf.beam_search_self_consistent_field_solver
Beam-search self-consistent field solver.
Classes
Resources allocated for one beam-search SCF calculation. |
|
Run several SCF trajectories, batching Fock builds for shared densities. |
|
Options specific to beam-search SCF duplicate resolution. |
|
The initial guess and steppers used by one beam-search trajectory. |
- class BeamSCFData
Bases:
Generic[TSCFMatrix,TSCFVector,TMatrix,TVector]Resources allocated for one beam-search SCF calculation.
- __init__(overlap_matrix: TSCFMatrix, lowdin_orthogonalizer: TSCFMatrix, core_hamiltonian: TSCFMatrix) None
- Parameters:
overlap_matrix (TSCFMatrix)
lowdin_orthogonalizer (TSCFMatrix)
core_hamiltonian (TSCFMatrix)
- Return type:
None
- core_hamiltonian: TSCFMatrix
- free(scf_module: SCFMatrixModuleProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector]) None
Free all allocated resources for this beam.
- Parameters:
scf_module (SCFMatrixModuleProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector])
- Return type:
None
- lowdin_orthogonalizer: TSCFMatrix
- overlap_matrix: TSCFMatrix
- class BeamSearchSelfConsistentFieldSolver
Bases:
SelfConsistentFieldSolverProtocol[TSCFMatrix],Generic[TSCFMatrix,TSCFVector,TMatrix,TVector]Run several SCF trajectories, batching Fock builds for shared densities.
SCF have many local minima, and this solver uses several beams to explore the nonlinear landscape. Distinct initial guesses can collapse into the same stationary solution, in which case the beam is considered redundant and retired.
Active trajectories whose global, local or fallback steppers differ in type or options remain independent; sharing early global steps does not establish that their later strategies are equivalent.
A density distance criterion is used to determine whether two beams are effectively representing the same electronic state. That density distance criterion is taken from the approach of [THG08]
- __init__(scf_matrix_module: SCFMatrixModuleProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector], kinetic_calculator: KineticCalculatorProtocol[TMatrix, TVector], nuclear_attraction_calculator: NuclearAttractionCalculatorProtocol[TMatrix, TVector], overlap_calculator: OverlapCalculatorProtocol[TMatrix, TVector], fock_builder: FockBuilderProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector], beams: list[SCFBeam[TSCFMatrix, TSCFVector, TMatrix, TVector]], scf_options: SelfConsistentFieldSolverOptions | None = None, options: BeamSearchSelfConsistentFieldSolverOptions | None = None) None
Initialise the beam-search SCF solver.
- Parameters:
scf_matrix_module (SCFMatrixModuleProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector]) – Matrix operations for the spin treatment.
kinetic_calculator (KineticCalculatorProtocol[TMatrix, TVector]) – Kinetic-energy integral calculator.
nuclear_attraction_calculator (NuclearAttractionCalculatorProtocol[TMatrix, TVector]) – Nuclear-attraction integral calculator.
overlap_calculator (OverlapCalculatorProtocol[TMatrix, TVector]) – Overlap integral calculator.
fock_builder (FockBuilderProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector]) – Effective one-particle matrix builder.
beams (list[SCFBeam[TSCFMatrix, TSCFVector, TMatrix, TVector]]) – Beam configurations to run.
scf_options (SelfConsistentFieldSolverOptions | None) – SCF convergence options.
options (BeamSearchSelfConsistentFieldSolverOptions | None) – Beam-search SCF solver options.
- Return type:
None
- setup_beam_data(molecular_configuration: MolecularConfiguration, additional_potential_matrix: TSCFMatrix | None = None) BeamSCFData[TSCFMatrix, TSCFVector, TMatrix, TVector]
Set up the beam data for the SCF calculation.
- Parameters:
molecular_configuration (MolecularConfiguration) – Molecular geometry and basis configuration.
additional_potential_matrix (TSCFMatrix | None) – Optional one-electron potential added to the core Hamiltonian.
- Return type:
BeamSCFData[TSCFMatrix, TSCFVector, TMatrix, TVector]
- solve(molecular_configuration: MolecularConfiguration, initial_density: TSCFMatrix | None = None, additional_potential_matrix: TSCFMatrix | None = None) RestrictedMolecularOrbitalCalculatorResult | UnrestrictedMolecularOrbitalCalculatorResult
Run the configured SCF beams and return the lowest-energy solution.
- Parameters:
molecular_configuration (MolecularConfiguration) – Molecular geometry and basis configuration.
initial_density (TSCFMatrix | None) – Optional density shared by every configured beam.
additional_potential_matrix (TSCFMatrix | None) – Optional one-electron potential added to the core Hamiltonian.
- Return type:
RestrictedMolecularOrbitalCalculatorResult | UnrestrictedMolecularOrbitalCalculatorResult
- solve_all(molecular_configuration: MolecularConfiguration, initial_density: TSCFMatrix | None = None, additional_potential_matrix: TSCFMatrix | None = None) list[RestrictedMolecularOrbitalCalculatorResult | UnrestrictedMolecularOrbitalCalculatorResult]
Run configured SCF beams and return distinct converged results in ascending energy order.
- Parameters:
molecular_configuration (MolecularConfiguration) – Molecular geometry and basis configuration.
initial_density (TSCFMatrix | None) – Optional density shared by every configured beam.
additional_potential_matrix (TSCFMatrix | None) – Optional one-electron potential added to the core Hamiltonian.
- Return type:
list[RestrictedMolecularOrbitalCalculatorResult | UnrestrictedMolecularOrbitalCalculatorResult]
- with_updated_options(**updates: Unpack[SelfConsistentFieldSolverOptionUpdates]) Self
Return a copy of the solver with updated SCF solver options.
The copy shares calculators, beams and builders with this solver.
- Parameters:
updates (Unpack[SelfConsistentFieldSolverOptionUpdates]) – Option values to change; omitted options keep their current values.
- Return type:
Self
- class BeamSearchSelfConsistentFieldSolverOptions
Bases:
DataclassPublicAPIOptions specific to beam-search SCF duplicate resolution.
- Parameters:
create_additional_beams_when_initial_density_is_provided – Whether to also use each beam’s initial-density builder when a density is supplied to
solve.duplicate_density_distance_tolerance – Maximum squared orthonormal density difference for duplicates. This equals the Thom-Head-Gordon distance for determinant densities.
duplicate_energy_tolerance – Maximum energy difference for beams to be considered duplicates.
duplicate_iterations_required – Number of consecutive duplicate observations required to retire a beam.
- __init__(*, create_additional_beams_when_initial_density_is_provided: bool = True, duplicate_density_distance_tolerance: float = 0.001, duplicate_energy_tolerance: float = 0.0001, duplicate_iterations_required: int = 2) None
- Parameters:
create_additional_beams_when_initial_density_is_provided (bool)
duplicate_density_distance_tolerance (float)
duplicate_energy_tolerance (float)
duplicate_iterations_required (int)
- Return type:
None
- create_additional_beams_when_initial_density_is_provided: bool = True
- duplicate_density_distance_tolerance: float = 0.001
- duplicate_energy_tolerance: float = 0.0001
- duplicate_iterations_required: int = 2
- class SCFBeam
Bases:
Generic[TSCFMatrix,TSCFVector,TMatrix,TVector]The initial guess and steppers used by one beam-search trajectory.
The stepper builders create distinct stateful steppers for each beam.
- Parameters:
initial_density_builder – Builder used when
solvereceives no density.global_scf_stepper_builder – Builder for the global-region stepper.
local_scf_stepper_builder – Builder for the local-region stepper.
label – Optional beam name used in logging.
- __init__(initial_density_builder: InitialDensityProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector], global_scf_stepper_builder: SCFStepperBuilderProtocol, local_scf_stepper_builder: SCFStepperBuilderProtocol, label: str | None = None) None
- Parameters:
initial_density_builder (InitialDensityProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector])
global_scf_stepper_builder (SCFStepperBuilderProtocol)
local_scf_stepper_builder (SCFStepperBuilderProtocol)
label (str | None)
- Return type:
None
- global_scf_stepper_builder: SCFStepperBuilderProtocol
- initial_density_builder: InitialDensityProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector]
- label: str | None = None
- local_scf_stepper_builder: SCFStepperBuilderProtocol