Skip to main content
← OpenMECP Documentation

GediisOptimizer

Struct GediisOptimizer 

Source
pub struct GediisOptimizer {
    pub config: GediisConfig,
    pub rise_tracker: EnergyRiseTracker,
}
Expand description

Main GEDIIS optimizer.

Fields§

§config: GediisConfig

Configuration

§rise_tracker: EnergyRiseTracker

Energy rise tracker

Implementations§

Source§

impl GediisOptimizer

Source

pub fn new() -> Self

Creates a new GEDIIS optimizer with default configuration.

Source

pub fn with_config(config: GediisConfig) -> Self

Creates a new GEDIIS optimizer with specified configuration.

Source

pub fn select_variant( &self, rms_error: f64, energy_rises: bool, n_points: usize, energies: Option<&VecDeque<f64>>, ) -> GediisVariant

Selects the appropriate GEDIIS variant based on optimization state.

Implements the decision logic from Old Code GeoDIS:

  • OKEnD requires NGDIIS >= 4 for TS search, >= 2 for minimum
  • OKEnD also requires |DC| >= SmlDif where DC = E(1) - E(2)
  • EnDIS used when RMSErr > SimSw or energy rises
Source

pub fn compute_step( &mut self, coords: &VecDeque<DVector<f64>>, grads: &VecDeque<DVector<f64>>, energies: &VecDeque<f64>, quad_steps: Option<&VecDeque<DVector<f64>>>, ) -> Option<(DVector<f64>, Vec<f64>)>

Computes a GEDIIS step.

§Arguments
  • coords - History of coordinate vectors (Angstrom)
  • grads - History of gradient vectors (Ha/Å)
  • energies - History of energies (Ha)
  • quad_steps - History of quadratic steps (optional, for RFO-DIIS)
§Returns

Tuple of (new_coords, coefficients) or None if failed.

Source

fn build_rfo_diis_matrix( &self, steps: &VecDeque<DVector<f64>>, n: usize, ) -> DMatrix<f64>

Builds RFO-DIIS matrix from quadratic steps.

A[i,j] = <q_i, q_j> For TS search, first coordinate is weighted by ts_scale.

Source

fn build_energy_diis_matrix( &self, grads: &VecDeque<DVector<f64>>, coords: &VecDeque<DVector<f64>>, n: usize, ) -> DMatrix<f64>

Builds Energy-DIIS matrix.

Trace: AMTrc[i,j] = -<g_i, x_j> A[i,j] = AMTrc[i,i] + AMTrc[j,j] - AMTrc[i,j] - AMTrc[j,i]

For TS search (n_neg > 0), the first coordinate is weighted by ts_scale to emphasize the reaction coordinate, matching Old Code: AMTrc(I+1,J+1) = -SclDIS*ANFF(1,I)*ANCC(1,J) - SProd(NVarT-1,ANFF(2,I),ANCC(2,J))

Source

fn build_sim_diis_matrix( &self, grads: &VecDeque<DVector<f64>>, coords: &VecDeque<DVector<f64>>, _energies: &VecDeque<f64>, n: usize, quad_steps: Option<&VecDeque<DVector<f64>>>, ) -> DMatrix<f64>

Builds Simultaneous-DIIS matrix.

Combines Energy-DIIS with quadratic energy approximation. Formula: A[i,j] = EnDIS[i,j] + 0.5*(q_i·f_i + q_j·f_j) where q = quadratic step and f = forces (negative gradient).

This matches the Old Code GeoDIS implementation: Half*(SProd(NVarT,AQuad(1,I),ANFF(1,I)) + SProd(NVarT,AQuad(1,J),ANFF(1,J)))

Trait Implementations§

Source§

impl Default for GediisOptimizer

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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.