lcpp-org / RustBCA

A free, open-source Binary Collision Approximation (BCA) code for ion-material interactions including sputtering, implantation, and reflection
https://github.com/lcpp-org/RustBCA/wiki
GNU General Public License v3.0
40 stars 13 forks source link

Setting Z=0 (technically bad input) produces untracked NaNs #50

Closed drobnyjt closed 3 years ago

drobnyjt commented 3 years ago

Some calculations that may produce NaNs are not checked appropriately - in the above example, the surface refraction code is the first time the NaNs are caught from bad input. I believe the NaNs are produced in the nonlocal electronic stopping section. More robust NaN handling should be added on calculations that, depending on user input, could fail in this way.

drobnyjt commented 3 years ago

Assertions that panic when the particle energy becomes NaN following the two most likely culprits of any failing calculation (nuclear and electronic stopping) have been added. Until NaNs are detected again somewhere else, this issue will be closed.