Skip to main content
← OpenMECP Documentation

GdiisOptimizer

Struct GdiisOptimizer 

Source
pub struct GdiisOptimizer {
    pub max_vectors: usize,
    pub cosine_check: CosineCheckMode,
    pub coeff_check: CoeffCheckMode,
    a_matrix: TriangularMatrix,
    a_inv: TriangularMatrix,
    scale: f64,
    el2_min: f64,
    solver: DiisCoeffSolver,
}
Expand description

Main GDIIS optimizer.

Implements the full GDIIS algorithm with validation checks.

Fields§

§max_vectors: usize

Maximum number of vectors to store

§cosine_check: CosineCheckMode

Cosine check mode

§coeff_check: CoeffCheckMode

Coefficient check mode

§a_matrix: TriangularMatrix

Overlap matrix A

§a_inv: TriangularMatrix

Inverse of A

§scale: f64

Current scale factor

§el2_min: f64

Minimum error norm squared

§solver: DiisCoeffSolver

DIIS coefficient solver

Implementations§

Source§

impl GdiisOptimizer

Source

pub fn new(max_vectors: usize) -> Self

Creates a new GDIIS optimizer.

Source

pub fn reset(&mut self)

Resets the optimizer state.

Source

pub fn compute_step( &mut self, coords: &VecDeque<DVector<f64>>, errors: &VecDeque<DVector<f64>>, _hessians: &VecDeque<DMatrix<f64>>, ) -> Result<(DVector<f64>, Vec<f64>, usize), GdiisError>

Computes a GDIIS step.

§Arguments
  • coords - History of coordinate vectors
  • errors - History of error vectors (gradients or Newton steps)
  • hessians - History of Hessian matrices (for error vector computation)
§Returns

Tuple of (new_coords, coefficients, n_used) or error.

Source

fn initialize_matrices( &mut self, errors: &VecDeque<DVector<f64>>, n: usize, ) -> Result<(), GdiisError>

Initializes overlap matrices from error vectors.

Source

fn extend_matrices( &mut self, errors: &VecDeque<DVector<f64>>, n: usize, ) -> Result<(), GdiisError>

Extends matrices with new error vector.

Source

fn validate_coefficients( &self, coeffs: &[f64], n_used: usize, ) -> Result<(), GdiisError>

Validates DIIS coefficients.

GDIIS coefficient check logic:

  • CMax = 15.0
  • CMin = 1 - CMax = -14 for IChkC != 1
  • CMin = 4 * (1 - CMax) = -56 for IChkC == 1 (Regular mode)
Source

fn validate_cosine( &self, residuum: &DVector<f64>, last_error: &DVector<f64>, n_used: usize, ) -> Result<(), GdiisError>

Validates GDIIS step using cosine check.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.