SD/CG Optimization

Overview

The SD/CG optimizer is a hybrid steepest-descent / conjugate-gradient method with optional DIIS (Direct Inversion in the Iterative Subspace) acceleration. It begins with a steepest descent phase to rapidly reduce large forces, then automatically switches to the conjugate gradient algorithm for more efficient convergence near a minimum. DIIS extrapolation can be applied periodically to further accelerate convergence.

This method is invoked with the keyword sdcg. The individual phases (SD, CG, DIIS) can be independently enabled or disabled via parameters, allowing the user to run pure steepest descent (cg_enabled=false, diis_enabled=false), pure conjugate gradient (sd_enabled=false), or any combination.

Parameters

Parameter Type Default Description
max_step float 0.2 Maximum step length in Angstrom.
max_iter int 256 Maximum number of optimization cycles.
write_traj bool False Write intermediate geometries to a trajectory file.
traj_every int 1 Write trajectory frame every N steps.
verbose int 1 Output verbosity level.
sd_enabled bool True Enable steepest descent phase.
cg_enabled bool True Enable conjugate gradient phase.
sd_max_iter int 50 Max iterations for the initial SD phase.
cg_switch_fmax float 0.0 Switch from SD to CG when max force drops below this value.
cg_restart_threshold float 0.2 Restart CG directions when gradient change exceeds this ratio.
cg_beta_method str "prp+" Conjugate gradient beta formula.
diis_enabled bool True Enable DIIS extrapolation acceleration.
diis_store_every int 5 Store DIIS snapshot every N steps.
diis_min_snapshots int 3 Minimum snapshots before DIIS extrapolation is attempted.
diis_memory int 6 Maximum number of DIIS snapshots stored.

Input Example

A complete input file using the SD/CG optimizer with default parameters:

#model=ani2x
#opt(method=sdcg)
#device=gpu0

O    0.000000    0.000000    0.117300
H    0.000000    0.757200   -0.469200
H    0.000000   -0.757200   -0.469200

When to Use SD/CG

  • Initial rough optimization: When the starting geometry is far from any minimum and contains large steric clashes or unreasonable bond lengths, the SD phase can quickly reduce the worst forces before the CG phase takes over for efficient convergence.
  • Very far from the minimum: In the early stages of optimization where the energy surface is steep and nearly linear, the SD phase is just as efficient as higher-order methods and considerably cheaper per step.
  • When L-BFGS oscillates: If L-BFGS enters a cycle of large oscillating steps, SD/CG can provide a more stable convergence path by combining gradient-only steps with conjugate gradient refinement.
  • Pure SD or pure CG: Disable one phase to run a single method. Set cg_enabled=false and diis_enabled=false for pure steepest descent, or sd_enabled=false for pure conjugate gradient.
Note

For production-quality geometry optimizations, L-BFGS (the default) is generally preferred due to its superior convergence near minima. SD/CG is most useful as a pre-optimizer for severely distorted structures or when L-BFGS has difficulty converging.