Closed jagot closed 5 years ago
I discovered that my matrices are, in fact, not symmetric, which they should be. I need to investigate why this is the case. Maybe this issue can be closed.
If they are not symmetric up to some minor error, try wrapping it with the Symmetric
wrapper. Check norm(A - A')
.
I figured out (had forgotten) why the matrices are not symmetric; to maintain orthogonality between the different vectors, every time I apply the operator to a vector, I project out the component parallel to the other vectors (this is equivalent to Lagrange multipliers). This forces e.g. 2s₀α
to be different from 1s₀α
, however, this ruins the symmetry of the matrix.
Indeed, applying the projection operators symmetrically on each side of the linear operator makes the overall operator symmetric again, and LOBPCG does not crash anymore. However, when the self-consistent iteration approaches the correct eigenpair, LOBPCG takes a big jump elsewhere and the self-consistent iteration either starts converging again or diverges.
You can also use the constraint functionality in LOBPCG designed for this purpose. Use the C
keyword argument, where C
is a matrix whose columns are going to be B
-orthogonal to the solution eigenvector.
In your case B
is the identity.
May be related to #223.
Some background info: I'm trying the solve the Hartree–Fock equations, which constitute a system of coupled integro-differential eigenproblems, which are solved iteratively:
where
P
is the eigenvector to be optimized to minimize an overall energy,ε
its associated eigenvalue,Υ
is a potential (diagonal matrix) formed by the other coupled vectors, andX
is an integral operator (full matrix), also formed by the other coupled vectors. The algorithm is toY
andX
,So far, I have been using ArnoldiMethod.jl which mostly works, but has problems with condition numbers when decreasing the grid step size.
Using the following script
and the attached file lobpcg-data.zip, which contains the operators formed in the first step above, for the first iteration, I get the following matrix:
Here we can see that Arnoldi gives reasonable eigenvalues for all elements/equations, whereas LOBPCG struggles for anything but helium.
Am I using LOBPCG wrongly, or is it simply not suited for this problem?