Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve sparse diagonalization routine #100

Merged

Conversation

timcallow
Copy link
Contributor

This PR is a fix for issue #98. scipy's sparse eigenvalue solver works better (both faster and more reliable) when fewer eigenvalues are requested, so this PR gives a better estimate for the lowest eigenvalue (for a given spin and quantum number l), when previously it was just 0 (creating problems for very low lying core states).

The routines to find the eigenvalues now include a "guess" option which performs a full diagonalization of the Hamiltonian (finding all eigenvalues), on a much smaller number of grid points to obtain an initial estimate for the eigenvalues. The lowest eigenvalues are then fed into the sparse matrix diagonalization routine, making we can reduce significantly the number of eigenvalues requested (since before we were finding lots of eigenvalues with energies >0 which were mostly discarded). The full diagonalization is only performed for the first 3 SCF iterations, since after that the estimates should be accurate enough for the rest of the cycle.

Attached are some output files to demonstrate examples of when the old code failed compared to now when it works, and an example of a speed increase.

Al_new_no_error.txt
Al_new_faster.txt
Al_old_error.txt
Al_old_slow.txt

@timcallow timcallow changed the title Improve output from sparse diagonalization routine Improve sparse diagonalization routine Nov 15, 2021
@timcallow timcallow merged commit 8b57c66 into atomec-project:develop Nov 22, 2021
@timcallow timcallow deleted the optimize_sparse_diagonalization branch November 22, 2021 15:42
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.

Sparse eigenvalue solver from scipy struggles when many eigenvalues are needed
2 participants