Skip to content

Accelerate energy minimization using Optim.Manifold feature#453

Merged
kbarros merged 9 commits intomainfrom
optim-manifold
Nov 19, 2025
Merged

Accelerate energy minimization using Optim.Manifold feature#453
kbarros merged 9 commits intomainfrom
optim-manifold

Conversation

@kbarros
Copy link
Member

@kbarros kbarros commented Nov 14, 2025

Energy minimization operates on spins subject to a normalization constraint. Originally, we imposed this constraint using stereographic projection. That strategy requires occasional restarts of the optimizer to allow for an update of the stereographic projection axis.

This PR removes the stereographic projection logic and instead uses the Optim.Manifold feature to "retract" the optimization variables onto the spheres (or complex hyper-spheres, in the case of SU(N)). With this approach, "restarts" of the optimizer are rarely necessary, and energy minimization becomes much more efficient as a result. This new implementation also seems to achieve better precision.

This PR will work robustly once JuliaNLSolvers/LineSearches.jl#185 is merged and released. That bug fix will allow the optimizer to "recover" from a line search that travels very far away from the allowed sphere. A related feature request is JuliaNLSolvers/LineSearches.jl#186, which would impose a maximum distance on the line search.

Copy link
Member

@ddahlbom ddahlbom left a comment

Choose a reason for hiding this comment

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

This is really nice.

I tried it locally on a few simple examples. I'll try it later today on a few more complicated cases just to put it through its paces, but this looks great to me.

u = (2v + (1-v²)*n) / (1+v²) # stereographic projection
return u
# Manifold where the first nspins are normalized spheres of dimension
# (nelems-1). Any remaining data is interpreted in the Euclidean metric.
Copy link
Member

Choose a reason for hiding this comment

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

What is the reason for the "tail" being interpreted in the Euclidean metric? Is this condition ever met in normal usage?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's needed to support minimize_spiral_energy!, where the Euclidean "tail" is the spiral propagation wavevector k. Eventually we might also include the axis of rotation as an optimization variable.

@kbarros kbarros merged commit a483824 into main Nov 19, 2025
4 checks passed
@kbarros kbarros deleted the optim-manifold branch November 19, 2025 15:47
kbarros added a commit that referenced this pull request Nov 19, 2025
This implementation avoids the need for "CG restarts" that would reset the stereographic projection axis. As a consequence, energy minimization can sometimes converge much faster (speedups ranging from 30% and 1000%, depending on problem).
kbarros added a commit to Sagar-Ramchandani/Sunny.jl that referenced this pull request Nov 19, 2025
…uite#453)

This implementation avoids the need for "CG restarts" that would reset the stereographic projection axis. As a consequence, energy minimization can sometimes converge much faster (speedups ranging from 30% and 1000%, depending on problem).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants