atomec-project / atoMEC

Python-based average-atom code for simulations of high energy density phenomena such as in warm dense matter.
https://atomec-project.github.io/atoMEC/
BSD 3-Clause "New" or "Revised" License
17 stars 12 forks source link

Fix issue with eigenvalue guess #199

Closed timcallow closed 1 year ago

timcallow commented 1 year ago

scipy.linalg.eigvals seems to have a problem solving the generalized eigenvalue problem Ax = Blambda*x when B is ill-conditioned (which is typically the case in atoMEC). This causes the guess eigenvalues to have errors. This usually doesn't affect the final results but it can do.

In this PR, we invert B and then solve B^-1Ax = lambda*x, which seems numerically stable.

codecov[bot] commented 1 year ago

Codecov Report

Merging #199 (a751ad5) into develop (46b31ac) will decrease coverage by 5.54%. The diff coverage is 77.77%.

@@             Coverage Diff             @@
##           develop     #199      +/-   ##
===========================================
- Coverage    97.17%   91.64%   -5.54%     
===========================================
  Files           14       14              
  Lines         2411     2419       +8     
===========================================
- Hits          2343     2217     -126     
- Misses          68      202     +134     
Files Changed Coverage Δ
atoMEC/numerov.py 88.50% <77.77%> (-7.15%) :arrow_down:

... and 5 files with indirect coverage changes