Skip to main content
← OpenMECP Documentation

Module optimizer

Module optimizer 

Source
Expand description

Optimization algorithms for MECP calculations.

This module implements various optimization algorithms used in Minimum Energy Crossing Point (MECP) calculations, including:

  • BFGS: Broyden-Fletcher-Goldfarb-Shanno quasi-Newton method
  • GDIIS: Geometry-based Direct Inversion in Iterative Subspace
  • GEDIIS: Energy-Informed DIIS with improved convergence
  • Hessian Updates: PSB (Powell-Symmetric-Broyden) formula
  • Convergence Checking: Multiple criteria for optimization termination

The module also provides functions to compute MECP effective gradients that combine the energy difference minimization and energy perpendicular components according to the Harvey et al. algorithm.

§Optimization Strategy

OpenMECP uses a hybrid optimization strategy:

  1. Initialization: BFGS for the first 3 steps to build curvature information
  2. Convergence Acceleration: Switch to GDIIS or GEDIIS for faster convergence
  3. Adaptive Step Control: Automatic step size limiting prevents overshooting
  4. Checkpointing: Save optimization state for restart capability

§Implementation Improvements (v2.0)

Recent enhancements ensure mathematical rigor and numerical stability:

  • Adaptive GEDIIS Parameters: α scales with 1/|g| for better stability
  • PSB Curvature Check: Validates s^T y > 0 before Hessian update
  • Improved MECP Gradient: Uses minimum norm vector to prevent premature convergence
  • Better Fallback Handling: Steepest descent properly scaled in BFGS
  • High-Precision Thresholds: Tighter convergence criteria for research use

§MECP Gradient Calculation

The MECP effective gradient combines two components:

G_MECP = (E1 - E2) * x_norm + (f1 - (x_norm · f1) * x_norm)

Where:

  • E1, E2: Energies of the two electronic states
  • f1, f2: Gradients (forces) of the two states
  • x_norm = (f1 - f2) / |f1 - f2|: Normalized gradient difference

The first term drives the energy difference to zero (f-vector). The second term minimizes energy perpendicular to the gradient difference (g-vector).

Re-exports§

pub use crate::gdiis::CosineCheckMode;
pub use crate::gdiis::CoeffCheckMode;
pub use crate::gdiis::GdiisError;
pub use crate::gdiis::GdiisOptimizer;
pub use crate::gediis::compute_dynamic_gediis_weight as gediis_dynamic_weight;
pub use crate::gediis::EnergyRiseTracker;
pub use crate::gediis::GediisConfig;
pub use crate::gediis::GediisOptimizer;
pub use crate::gediis::GediisVariant;
pub use crate::hessian_update::HessianUpdateMethod;

Structs§

ConvergenceStatus
Tracks convergence status for each optimization criterion.
MecpGradient
Holds the decomposed MECP effective gradient.
OptimizationState
Tracks optimization state and history for adaptive optimization algorithms.
OptimizationState_blend
Holds optimization state for the GDIIS_blend and GEDIIS_blend implementations.

Functions§

adjust_trust_radius
Adjusts the trust radius based on the actual energy change from QM.
bfgs_step
Performs a BFGS optimization step.
bfgs_step_direct
Performs a BFGS step using a direct Hessian (matching exactly).
build_b_matrix 🔒
Builds the B matrix for GDIIS optimization.
build_gediis_b_matrix 🔒
Computes enhanced error vectors for GEDIIS optimization.
build_gediis_b_matrix_taylor 🔒
Builds the GEDIIS B-matrix using the Taylor expansion formula.
check_convergence
Checks convergence criteria for MECP optimization.
compute_adaptive_scale
Computes adaptive step scaling based on optimization progress.
compute_error_vectors 🔒
Computes error vectors for GDIIS optimization.
compute_mecp_gradient
Computes the MECP effective gradient for optimization.
fixed_blend_step
Hybrid GEDIIS/GDIIS step.
fixed_sequential_blend_step
Fixed-then-GDIIS sequential blend step.
gdiis_blend_step
GDIIS_blend step: interpolate geometry, apply Newton correction via INVERTED mean true Hessian, with step control.
gdiis_step
Performs a GDIIS (Geometry-based Direct Inversion in Iterative Subspace) optimization step.
gdiis_step_direct
Performs a simplified GDIIS step matching exactly.
gediis_blend_step
GEDIIS_blend step: pure interpolation using Taylor expansion B-matrix.
gediis_step
Performs a GEDIIS (Energy-Informed Direct Inversion in Iterative Subspace) optimization step.
gradient_blend_step
Gradient-weighted hybrid GEDIIS/GDIIS blend step.
initialize_direct_hessian
Initializes the direct Hessian matrix for direct Hessian BFGS optimization.
initialize_inverse_hessian
Updates the Hessian matrix using the PSB (Powell-Symmetric-Broyden) formula.
initialize_true_hessian
Creates an identity matrix as the initial true Hessian approximation.
parse_coeff_mode
Converts config string to CoeffCheckMode.
parse_cosine_mode
Performs a hybrid GEDIIS optimization step (50% GDIIS + 50% GEDIIS).
parse_gediis_variant
Converts config string to GediisVariant.
parse_hessian_update_method
Converts config string to HessianUpdateMethod.
robust_gdiis_step
Performs a robust GDIIS step using the new GdiisOptimizer.
robust_gediis_step
Performs a robust GEDIIS step using the new GediisOptimizer.
select_blend_step
Dispatcher for the blend experiment methods.
select_diis_step
Selects and runs the appropriate DIIS/GEDIIS step based on configuration.
sequential_blend_step
Smart sequential hybrid GEDIIS/GDIIS blend step.
sequential_hybrid_gediis_step
Computes dynamic GEDIIS weight based on energy trend and oscillation detection.
solve_constrained_step
Solves the augmented Hessian system for a constrained optimization step.
stepsize_blend
Applies step size reduction and capping.
update_hessian
Updates the inverse Hessian matrix using the BFGS formula.
update_hessian_advanced
Updates the Hessian matrix using the specified method from the hessian_update module.
update_hessian_by_method
Updates the Hessian matrix using the specified method.
update_hessian_psb
Updates the Hessian matrix using the PSB (Powell-Symmetric-Broyden) formula.
update_inverse_hessian_advanced
Updates the inverse Hessian using the BFGS formula from the hessian_update module.