Open drobnyjt opened 1 year ago
Potential cause: if the CPR rootfinder truncation threshold is too high, there may be an infinite loop caused by truncated terms leading to identical Chebyshev polynomials each iteration and the error not decreasing as n increases, leading to infinite subdivision - although it should hit either nmax or the subdivision interval limit first. To test this, reducing those two parameters should be tried to see if it's not actually an infinite loop, just a very, very long loop caused by many large matrix inversions.
Interestingly, I cannot reproduce this on a different machine. More investigation is needed.
On the original machine with this issue, it appears to be limited to high energy, low nmax, and very small interval limits.
There seems to be a rare event at high energies (>10 keV) for the Kr-C-Morse combined potential that causes an infinite loop. I suspect a value is going to +/-INF and is not being caught by a NaN check, but more investigation is required.
The occurrence rate is somewhere between 1/250000 ions and 1/10000 ions, but any numerical situation that causes an infinite loop should instead panic. The question is: 1) where is the issue occurring? 2) can it be ameliorated with changes to the CPR rootfinder parameters? 3) what changes should be made to the code?
Example input file that exhibits this issue: