Skip to content

Fix ionic inverse-BFGS step lengths and backtracking - #8419

Open
Growl1234 wants to merge 2 commits into
deepmodeling:developfrom
Growl1234:bfgs
Open

Growl1234 wants to merge 2 commits into
deepmodeling:developfrom
Growl1234:bfgs

Conversation

@Growl1234

@Growl1234 Growl1234 commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

The ionic inverse BFGS optimizer stretches short steps to fill the trust radius, which can cause overshoot near convergence. When a trial raises the energy, backtracking uses a unit direction and loses the distance actually traveled. The strong Wolfe curvature check also uses a reversed inequality.

This PR:

  • Treat the trust radius as a step-length cap and preserve shorter BFGS steps.
  • Use the actual Cartesian displacement and a consistently scaled gradient for backtracking and Hessian updates, including across periodic boundaries.
  • Correct the strong Wolfe curvature check, scale the initial inverse Hessian from the first accepted step, and skip updates with insufficient positive curvature.

This issue is found when testing my final implementation for #7970 against various systems, so I submit it as a prerequisite for moving towards it.

@Growl1234 Growl1234 added Bugs Bugs that only solvable with sufficient knowledge of DFT GeometryRelaxation Issues related to geometry relaxation labels Nov 26, 2026
@Growl1234

Copy link
Copy Markdown
Collaborator Author

About the unittest changes:

  • The old ComputeTrustRadius* tests expected a negative radius or a Hessian reset or abort after an accepted step. The replacement tests check that a short accepted step keeps the radius and that an accepted step at the boundary can grow it up to rmax. The rejected-step tests cover the minimum-radius reset and abort.
  • The restart test now checks that the actual displacement is preserved for backtracking. The Wolfe test checks when the inequalities pass or fail, including equality at the boundary.
  • The cell-change test drops the assertion on the removed first_step flag and verifies that the ionic BFGS history is cleared.

The new trajectory tests cover short steps, overshoot recovery, negative curvature, and repeated rejections across a periodic boundary.

@Growl1234

Growl1234 commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator Author

The testing failures of relax tasks are expected; I'll update the reference soon.

@mohanchen
mohanchen requested a review from 19hello November 27, 2026 00:44
@mohanchen mohanchen added the Refactor Refactor ABACUS codes label Nov 27, 2026

@ABACUS-PR-BOT ABACUS-PR-BOT left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found no confirmed correctness defect in the reviewed step-cap, unit-conversion and backtracking paths. The two inline notes concern computed call arguments and the verification record for the regenerated references.

Static review only; no builds or runtime tests were run.

Comment thread source/source_relax/bfgs_basic.cpp Resolved
@Growl1234
Growl1234 force-pushed the bfgs branch 3 times, most recently from 1a5d70c to b479564 Compare December 1, 2026 18:51

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bugs Bugs that only solvable with sufficient knowledge of DFT GeometryRelaxation Issues related to geometry relaxation Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants