qrunch.chemistry.qrackle.scf.utils
Shared SCF occupation and density-validation utilities.
Functions
|
Check symmetry, determinant occupations, and, optionally, the requested electron counts. |
|
Require a valid determinant density before accepting a small-gradient AO density as converged. |
|
Return the number of occupied orbitals in each spin channel, in restricted or alpha/beta order. |
|
Return the occupation of an occupied orbital: 2 for a restricted density and 1 per spin otherwise. |
- is_valid_determinant_density(module: SCFMatrixModuleProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector], orthonormal_density: TSCFMatrix, *, tolerance: float = 1e-08, orbital_occupation: OrbitalOccupation | None = None) bool
Check symmetry, determinant occupations, and, optionally, the requested electron counts.
A valid single-determinant density in the Lowdin orthonormal basis is a scaled projector, \(D_{o}^{2} = c\,D_{o}\), with \(c = 2\) for a restricted (spin-summed) density and \(c = 1\) per spin otherwise. The idempotency residual \(\| D_{o}^{2} - c\,D_{o} \|_{F}\) and the symmetry residual \(\| D_{o} - D_{o}^{T} \|_{F}\) are compared against
tolerance.- Parameters:
module (SCFMatrixModuleProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector]) – SCF matrix module.
orthonormal_density (TSCFMatrix) – Density matrix \(D_{o}\) in the orthonormal basis.
tolerance (float) – Threshold on the symmetry and idempotency residual norms and electron-count errors.
orbital_occupation (OrbitalOccupation | None) – If supplied, also require the correct electron count in each spin channel.
- Return type:
bool
- is_valid_scf_density(module: SCFMatrixModuleProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector], density: TSCFMatrix, overlap_matrix: TSCFMatrix, lowdin_orthogonalizer: TSCFMatrix, orbital_occupation: OrbitalOccupation, *, tolerance: float = 1e-08) bool
Require a valid determinant density before accepting a small-gradient AO density as converged.
- Parameters:
module (SCFMatrixModuleProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector]) – SCF matrix module.
density (TSCFMatrix) – Evaluated AO density.
overlap_matrix (TSCFMatrix) – AO overlap matrix.
lowdin_orthogonalizer (TSCFMatrix) – Lowdin orthogonalizer.
orbital_occupation (OrbitalOccupation) – Required electron counts.
tolerance (float) – Threshold on the orthonormal-basis symmetry and idempotency residual norms and the per-spin electron-count errors.
- Return type:
bool
- occupied_orbital_counts(module: SCFMatrixModuleProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector], orbital_occupation: OrbitalOccupation) list[int]
Return the number of occupied orbitals in each spin channel, in restricted or alpha/beta order.
- Parameters:
module (SCFMatrixModuleProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector]) – SCF matrix module.
orbital_occupation (OrbitalOccupation) – Electron occupation.
- Return type:
list[int]
- orbital_occupation_number(module: SCFMatrixModuleProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector]) float
Return the occupation of an occupied orbital: 2 for a restricted density and 1 per spin otherwise.
- Parameters:
module (SCFMatrixModuleProtocol[TSCFMatrix, TSCFVector, TMatrix, TVector]) – SCF matrix module.
- Return type:
float