MAINT: Make all the arguments specific to individual Optimizer subclasses keyword-only

This MR suggests to make all the arguments specific to individual Optimizer subclasses keyword-only.

Most of the optimizer subclasses take atoms, restart, logfile, trajectory, and append_trajectory as first arguments in this order. They are now catched collectively as *args if given as positional arguments. Consequently, all following subclass-specific arguments are now keyword-only arguments. I think this makes sense and also improves the mantainability.

Other consequences of this MR are:

  • Improvement of the API consistency among the Optimizer subclasses, particularly those not fully following the above argument order, such as BFGSLineSearch, ODE12r, SciPyOptimizer, SciPyGradientlessOptimizer
  • For the subclasses which did not explicitly have append_trajectory (BFGSLineSearch, BFGSClimbFixInternals, FIRE, FIRE2, LBFGS, MDMin, GoodOldQuasiNewton, PreconFIRE, PreconLBFGS), now this argument can be given not only as a keyword argument but also as the fifth positional argument, as specified in Optimizer parent class (although not recommended, but in case someone wants to do so)

This MR can break a code in rare cases when it specifies subclass-specific arguments as positional, but the fix is easy and backward-compatible after the fix.

closes #852 (closed), related to !1458 (merged), !1590 (closed), !2744 (closed), !3041 (merged), !3397 (merged), !3403 (merged), !3424 (merged), etc. [EDIT: 2026-09-24]

Checklist: x (done) or ~ (irrelevant)

Edited by Yuji Ikeda

Merge request reports

Loading
Loading