Manopt for Hartree-Fock #500
Replies: 3 comments 5 replies
-
Thanks, this looks very interesting – and cool that you give Manopt a try! But to be honest, I am a very mere beginner on the physics behind that. My knowledge starts, when you have formulated the energy (and its gradient) as some Here is a few things I noticed from that PR linked above and discussions with both Michael from DFTK.jl and my student:
This might maybe answer your first question, though these are super hard to impossible to answer in the phrased generality For your second question, I have no clue about your metric tensor, where that is used, how it is used – did you write a new metric on Grassmann in Manifolds.jl? And how a problem scales with time does neither depend on Manifolds.jl nor Manopt.jl but purely on your problem at hand. So I am not sure I can provide any inside here. For your third question – I think I do not even understand the question, sorry. If you have a specific metric that is not the default one on Grassmann (cf https://juliamanifolds.github.io/Manifolds.jl/stable/manifolds/grassmann/#ManifoldsBase.inner-Tuple{Grassmann,%20Any,%20Any,%20Any}), the embedding can still be the same, but you will simply not “inherit” a metric from the embedding, but have to This might be a ramble into the completely wrong direction, since – again sorry – I do not understand the question, but maybe that at least gives a bit of an insight into the right direction. |
Beta Was this translation helpful? Give feedback.
-
Hi!
Yes, definitely.
As Ronny wrote, it might be worthwhile to implement a new metric here. We can help with that.
This strongly depends on the retraction and vector transport methods that are used.
As far as I know we don't have that implemented. |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot, I’ll try tweaking the settings a bit! I put my minimal working example at https://github.com/lukas-weber/hf-optim-test (energy and gradient evaluations are intentionally not very optimized in order to keep the example minimal and self-contained). I would also be very happy to read the master thesis (my e-mail is on my website, reachable from my profile). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
Inspired by the effort that is going into combining DFTK with Manopt and a conversation at Juliacon, I am running some comparisons to see if Manopt can speed up my Hartree-Fock calculations.
Some Background for Hartree-Fock
Here is a reformulation that may or may not be enjoyable for non-Physicists. In Hartree-Fock, we want to minimize the Rayleigh quotient
for a given operator$H$ under the constraint that $Ψ$ is a Slater determinant. $H$ and $Ψ$ live on the many-body Hilbert space $\mathcal{H}$ . The Slater determinants $\mathrm{Slater}(\mathcal{H})$ are a subset of $\mathcal{H}$ (but not a subspace).
The dimension$\dim(\mathcal{H})=d^N$ is exponentially large in the number of electrons $N$ , making it intractable to work with $\mathcal{H}$ directly. Instead, we can use a parameterization $ψ: ℝ^{n_\uparrow × d} × ℝ^{n_\downarrow × d} \to \mathrm{Slater}(\mathcal{H})$ . Here $n_\uparrow$ , $n_\downarrow=N-n_\uparrow$ are the numbers of electrons with spin up and down, respectively.
This parameterization is very nice, because there are simple analytic expressions for$E(ψ(x)) = f(G_\uparrow(x_\uparrow), G_\downarrow(x_\downarrow))$ , where $G_i = x_i (x_i^\dagger x_i)^{-1} x_i^\dagger$ and the inner product $ψ(x)^\dagger ψ(y) = \det(x_\uparrow^\dagger y_\uparrow) \det(x_\downarrow^\dagger y_\downarrow)$ .
These expressions show that the parameterization is actually overcomplete, because$G$ is invariant under row permutations and rescalings. I think ψ can be made bijective by considering the Grassmannian as the domain: $ψ': Gr_{n_\uparrow}(ℝ^{d}) × Gr_{n_\downarrow}(ℝ^{d}) \to \mathrm{Slater}(\mathcal{H})$ .
Optimization
All in all, this seems like the perfect setting for Riemannian optimization, with a single catch: If I use the standard embedding of the Grassmannian in$ℝ^{n×d}$ , will it not inherit the inner product $Tr x^\dagger y$ ? But the natural metric (coming from Physics) for the Slater determinants is the Fubini-Study metric based on the determinant inner product above.
For this reason what I have done so far is the following (and here my knowledge about manifolds is very limited, so it may be entirely wrong):
This is very slow (inversion of the geometric tensor scales O((nd)^3) or something), but it is more reliable at finding the global minimum, which saves some time in the long run. It would be nice to replace it by Manopt, if I can get similar reliability.
So to test this, I did Hartree-Fock on the N₂ molecule with a bond separation of 2Å, in the cc-pvdz Gaussian basis set, starting from 10 fixed random points on the Grassmannian, using the following three methods:
Optim.LBFGS(P=geometric_tensor(x0), precondprep=(g,x)->copy!(g, geometric_tensor(x)))
Optim.LBFGS()
The results are below

Next to the method is the fraction of solutions that converged to the global minimum. While standard
LBFGS()
is quick, it only found the correct minimum once. The “preconditioned” version is better at finding the minimum but when it doesn’t, it gets completely stuck, I wonder if it runs into some ill-conditioned corner or if my “preconditioning” confuses the line search somehow.Manopt quasi_Newton with standard settings is as reliable as the preconditioning method, but when it reaches the global minimum, it does so slower than the other methods, both in iterations and in time.
I have the following questions
Beta Was this translation helpful? Give feedback.
All reactions