|
votca 2026-dev
|
#include <uks_convergenceacc.h>

Classes | |
| struct | SpinDensity |
| struct | SpinFock |
Public Types | |
| using | options = ConvergenceAcc::options |
| using | KSmode = ConvergenceAcc::KSmode |
| using | CoupledFockBuilder |
Public Member Functions | |
| void | Configure (const options &opt_alpha, const options &opt_beta) |
| void | setLogger (Logger *log) |
| void | setOverlap (AOOverlap &S, double etol) |
| void | setCoupledFockBuilder (const CoupledFockBuilder &builder) |
| SpinDensity | DensityMatrix (const tools::EigenSystem &MOs_alpha, const tools::EigenSystem &MOs_beta) const |
| SpinDensity | Iterate (const SpinDensity &dmat, SpinFock &H, tools::EigenSystem &MOs_alpha, tools::EigenSystem &MOs_beta, double totE) |
| tools::EigenSystem | SolveFockmatrix (const Eigen::MatrixXd &H) const |
| Eigen::MatrixXd | UnflattenRotation (const Eigen::VectorXd &v_ov, Index nao, Index nocclevels) const |
| std::pair< Eigen::MatrixXd, Eigen::MatrixXd > | UnflattenCoupledRotation (const Eigen::VectorXd &v, Index nao_alpha, Index nocclevels_alpha, Index nao_beta, Index nocclevels_beta) const |
| Eigen::VectorXd | BuildCoupledSigmaVector (const Eigen::VectorXd &v, const Eigen::MatrixXd &C_alpha, Index nocclevels_alpha, const Eigen::MatrixXd &C_beta, Index nocclevels_beta, const CoupledFockBuilder &coupled_fock_builder, double finite_diff_step=1e-3) const |
| std::pair< Eigen::MatrixXd, Eigen::MatrixXd > | CoupledAugmentedHessianStep (const Eigen::MatrixXd &H_AO_alpha, const tools::EigenSystem &MOs_alpha, Index nocclevels_alpha, const Eigen::MatrixXd &H_AO_beta, const tools::EigenSystem &MOs_beta, Index nocclevels_beta, const CoupledFockBuilder &coupled_fock_builder, double trust_radius, double &predicted_energy_change) const |
| bool | isConverged () const |
| double | getDIIsError () const |
| double | getDeltaE () const |
| bool | getUseMixing () const |
Private Member Functions | |
| Eigen::MatrixXd | DensityMatrixGroundState_unres (const Eigen::MatrixXd &MOs, Index nocclevels) const |
| void | Levelshift (Eigen::MatrixXd &H, const Eigen::MatrixXd &MOs_old, const options &opt, Index nocclevels) const |
| Eigen::MatrixXd | BuildErrorMatrix (const Eigen::MatrixXd &dmat, const Eigen::MatrixXd &H) const |
| double | CombinedError (const Eigen::MatrixXd &err_alpha, const Eigen::MatrixXd &err_beta) const |
| Eigen::MatrixXd | DirectMinimizationRotation (const Eigen::MatrixXd &H_AO, const tools::EigenSystem &MOs, Index nocclevels, double &predicted_energy_change) const |
Static Private Attributes | |
| static constexpr Index | kMaxConsecutiveADIISFailures = 5 |
| static constexpr Index | kTrailingWindowSize = 10 |
| static constexpr Index | kAutoStartIteration = 50 |
| static constexpr double | kMeanRatioTolerance = 1.125 |
| static constexpr double | kMinTrustRadius = 3e-3 |
Definition at line 42 of file uks_convergenceacc.h.
Given BOTH new spin densities together, returns BOTH new AO Fock matrices together (H0 + Coulomb + exchange + XC, for each channel). Closer to VOTCA's own native Fock-build structure: Vxc_Potential::IntegrateVXCSpin already computes vxc_alpha and vxc_beta together from both densities in one call. Used by CoupledAugmentedHessianStep/BuildCoupledSigmaVector to capture the genuine alpha-beta coupling (through the shared Coulomb potential and the XC kernel's cross-spin terms) that treating the two channels independently would discard – see the conversation this grew out of: a direct, controlled comparison against ORCA on an identical geometry showed ORCA's own, fully-coupled TRAH converging where an earlier, decoupled implementation here did not. Injected from DFTEngine (setCoupledFockBuilder below) since the actual integral/XC machinery (CalcERIs/CalcERIs_EXX, Vxc_Potential::IntegrateVXCSpin) lives there, not in this class – matching the same pointer-injection pattern already used for S_/log_.
Definition at line 76 of file uks_convergenceacc.h.
Definition at line 45 of file uks_convergenceacc.h.
Definition at line 44 of file uks_convergenceacc.h.
| Eigen::VectorXd votca::xtp::UKSConvergenceAcc::BuildCoupledSigmaVector | ( | const Eigen::VectorXd & | v, |
| const Eigen::MatrixXd & | C_alpha, | ||
| Index | nocclevels_alpha, | ||
| const Eigen::MatrixXd & | C_beta, | ||
| Index | nocclevels_beta, | ||
| const CoupledFockBuilder & | coupled_fock_builder, | ||
| double | finite_diff_step = 1e-3 ) const |
Coupled analogue of BuildSigmaVector: rotates BOTH spin channels SIMULTANEOUSLY by +-a small step (unlike BuildSigmaVector, which rotates one channel while holding the other fixed), builds BOTH new densities together, and calls coupled_fock_builder ONCE per perturbation to get BOTH new Fock matrices together – capturing the genuine alpha-beta coupling (through the shared Coulomb potential and the XC kernel's cross-spin terms) that BuildSigmaVector's own, deliberately decoupled treatment discards. Returns the combined sigma vector (alpha's own block first, beta's immediately after, matching v's own layout). Central difference, for the identical reason BuildSigmaVector itself uses one (see that function's own header comment).
Definition at line 100 of file uks_convergenceacc.cc.
|
private |
Definition at line 521 of file uks_convergenceacc.cc.
|
private |
Definition at line 527 of file uks_convergenceacc.cc.
| void votca::xtp::UKSConvergenceAcc::Configure | ( | const options & | opt_alpha, |
| const options & | opt_beta ) |
Definition at line 28 of file uks_convergenceacc.cc.
| std::pair< Eigen::MatrixXd, Eigen::MatrixXd > votca::xtp::UKSConvergenceAcc::CoupledAugmentedHessianStep | ( | const Eigen::MatrixXd & | H_AO_alpha, |
| const tools::EigenSystem & | MOs_alpha, | ||
| Index | nocclevels_alpha, | ||
| const Eigen::MatrixXd & | H_AO_beta, | ||
| const tools::EigenSystem & | MOs_beta, | ||
| Index | nocclevels_beta, | ||
| const CoupledFockBuilder & | coupled_fock_builder, | ||
| double | trust_radius, | ||
| double & | predicted_energy_change ) const |
Solves ONE augmented-Hessian eigenvalue problem over the COMBINED (alpha+beta) rotation space, rather than treating the two spin channels independently – see this class's own CoupledFockBuilder comment for the full motivation. Returns BOTH new MO coefficient matrices together, since a single, coupled step inherently produces both simultaneously. predicted_energy_change (output): the ONE, combined quadratic model's own predicted energy change for this step – Iterate's own Fletcher accept/reject logic uses this directly.
Definition at line 324 of file uks_convergenceacc.cc.
| UKSConvergenceAcc::SpinDensity votca::xtp::UKSConvergenceAcc::DensityMatrix | ( | const tools::EigenSystem & | MOs_alpha, |
| const tools::EigenSystem & | MOs_beta ) const |
Definition at line 490 of file uks_convergenceacc.cc.
|
private |
Definition at line 481 of file uks_convergenceacc.cc.
|
private |
Approximate ARH-style direct energy minimization step: builds new MO coefficients directly via an orbital rotation (occ-virt block only, since occ-occ/virt-virt rotations leave the density matrix unchanged), using the orbital gradient (the occ-virt block of the MO-basis Fock matrix, which vanishes exactly at self-consistency) and an approximate, diagonal Hessian (orbital energy differences – the same cheap approximation used as the starting point for most quasi-Newton SCF methods, e.g. SOSCF's own initial Hessian guess). The step is trust-radius bounded, and the resulting (only approximately unitary) rotation is re-orthonormalized via the same Lowdin approach as OrthogonalizeGuess. See the design discussion this grew out of for the full reasoning: this is a deliberately simplified relative of the ARH/TRAH family of direct-minimization SCF methods (confirmed directly, on this exact system, to resolve an ADIIS/DIIS convergence failure that ORCA's own auto-TRAH fallback also had to invoke), not a full implementation of either. predicted_energy_change (output): the quadratic model's own predicted E_new - E_old, Sum_ia[g_ia*kappa_ia + 0.5*h_ia*kappa_ia^2] using the SAME (possibly per-element- and trust-radius-clamped) kappa actually applied – needed by Iterate's own Fletcher-style accept/reject logic (see its own header comment) to compute the ratio r = E_actual_change / E_predicted_change once the actual, post-step energy becomes available (on the NEXT Iterate() call, once the caller has built a new Fock matrix from this step's own density and passed its energy back in).
STATUS: superseded by CoupledAugmentedHessianStep below whenever a coupled Fock-builder callback has been injected (i.e. DFTEngine has wired up setCoupledFockBuilder) – kept as the fallback for any caller that has not done so (e.g. DFTEngine::RunAtomicDFT_unrestricted), and because CoupledAugmentedHessianStep itself still uses this same diagonal approximation as the Davidson preconditioner, exactly as the TRAH paper's own Sec. II B describes doing.
Definition at line 182 of file uks_convergenceacc.cc.
| double votca::xtp::UKSConvergenceAcc::getDeltaE | ( | ) | const |
Definition at line 967 of file uks_convergenceacc.cc.
|
inline |
Definition at line 154 of file uks_convergenceacc.h.
|
inline |
Definition at line 156 of file uks_convergenceacc.h.
| bool votca::xtp::UKSConvergenceAcc::isConverged | ( | ) | const |
Definition at line 974 of file uks_convergenceacc.cc.
| UKSConvergenceAcc::SpinDensity votca::xtp::UKSConvergenceAcc::Iterate | ( | const SpinDensity & | dmat, |
| SpinFock & | H, | ||
| tools::EigenSystem & | MOs_alpha, | ||
| tools::EigenSystem & | MOs_beta, | ||
| double | totE ) |
Definition at line 533 of file uks_convergenceacc.cc.
|
private |
Definition at line 501 of file uks_convergenceacc.cc.
|
inline |
Definition at line 83 of file uks_convergenceacc.h.
| void votca::xtp::UKSConvergenceAcc::setLogger | ( | Logger * | log | ) |
Definition at line 41 of file uks_convergenceacc.cc.
| void votca::xtp::UKSConvergenceAcc::setOverlap | ( | AOOverlap & | S, |
| double | etol ) |
Definition at line 43 of file uks_convergenceacc.cc.
| tools::EigenSystem votca::xtp::UKSConvergenceAcc::SolveFockmatrix | ( | const Eigen::MatrixXd & | H | ) | const |
Definition at line 54 of file uks_convergenceacc.cc.
| std::pair< Eigen::MatrixXd, Eigen::MatrixXd > votca::xtp::UKSConvergenceAcc::UnflattenCoupledRotation | ( | const Eigen::VectorXd & | v, |
| Index | nao_alpha, | ||
| Index | nocclevels_alpha, | ||
| Index | nao_beta, | ||
| Index | nocclevels_beta ) const |
Coupled analogue of UnflattenRotation: splits ONE combined vector v (size n_ov_alpha + n_ov_beta – alpha's own occ-virt block first, beta's own immediately after) into TWO separate antisymmetric rotation matrices, kappa_alpha (nao_alpha x nao_alpha) and kappa_beta (nao_beta x nao_beta). Public for the same reason as UnflattenRotation itself.
Definition at line 85 of file uks_convergenceacc.cc.
| Eigen::MatrixXd votca::xtp::UKSConvergenceAcc::UnflattenRotation | ( | const Eigen::VectorXd & | v_ov, |
| Index | nao, | ||
| Index | nocclevels ) const |
One column of the Davidson trial-vector matrix V, containing [v0; v_ov] (the scalar augmented component and the flattened occ-virt rotation-space vector), mapped back to a full nao x nao antisymmetric matrix (occ-virt/virt-occ blocks only, matching DirectMinimizationRotation's own convention) – needed to actually apply a trial rotation direction when building the finite-difference sigma vector. Public so it can be exercised directly by unit tests (see test_uks_convergenceacc.cc), given how cheaply this pure, self-contained math can be checked in isolation compared to the SCF machinery that otherwise relies on it.
Definition at line 70 of file uks_convergenceacc.cc.
|
private |
Definition at line 228 of file uks_convergenceacc.h.
|
private |
Definition at line 242 of file uks_convergenceacc.h.
|
private |
Definition at line 216 of file uks_convergenceacc.h.
|
private |
Definition at line 227 of file uks_convergenceacc.h.
|
private |
Definition at line 230 of file uks_convergenceacc.h.
|
private |
Definition at line 261 of file uks_convergenceacc.h.
|
private |
Definition at line 305 of file uks_convergenceacc.h.
|
private |
Definition at line 278 of file uks_convergenceacc.h.
|
private |
Definition at line 279 of file uks_convergenceacc.h.
|
private |
Definition at line 281 of file uks_convergenceacc.h.
|
private |
Definition at line 283 of file uks_convergenceacc.h.
|
private |
Definition at line 282 of file uks_convergenceacc.h.
|
private |
Definition at line 284 of file uks_convergenceacc.h.
|
private |
Definition at line 280 of file uks_convergenceacc.h.
|
private |
Definition at line 223 of file uks_convergenceacc.h.
|
private |
Definition at line 224 of file uks_convergenceacc.h.
|
staticconstexprprivate |
Definition at line 264 of file uks_convergenceacc.h.
|
staticconstexprprivate |
Definition at line 243 of file uks_convergenceacc.h.
|
staticconstexprprivate |
Definition at line 265 of file uks_convergenceacc.h.
|
staticconstexprprivate |
Definition at line 316 of file uks_convergenceacc.h.
|
staticconstexprprivate |
Definition at line 263 of file uks_convergenceacc.h.
|
private |
Definition at line 213 of file uks_convergenceacc.h.
|
private |
Definition at line 221 of file uks_convergenceacc.h.
|
private |
Definition at line 222 of file uks_convergenceacc.h.
|
private |
Definition at line 231 of file uks_convergenceacc.h.
|
private |
Definition at line 232 of file uks_convergenceacc.h.
|
private |
Definition at line 218 of file uks_convergenceacc.h.
|
private |
Definition at line 219 of file uks_convergenceacc.h.
|
private |
Definition at line 209 of file uks_convergenceacc.h.
|
private |
Definition at line 210 of file uks_convergenceacc.h.
|
private |
Definition at line 212 of file uks_convergenceacc.h.
|
private |
Definition at line 214 of file uks_convergenceacc.h.
|
private |
Definition at line 262 of file uks_convergenceacc.h.
|
private |
Definition at line 225 of file uks_convergenceacc.h.
|
private |
Definition at line 285 of file uks_convergenceacc.h.
|
private |
Definition at line 233 of file uks_convergenceacc.h.