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
41 stars 14 forks source link

[bug] [dev] simple_bca_py panics on E1 = 0.0 #125

Closed drobnyjt closed 3 years ago

drobnyjt commented 3 years ago

Description When simple_bca_py is given E1 = 0.0, it doesn't filter or verify inputs, so it proceeds directly to the DOCA calculation which immediately returns a NaN (because the potential is singular at the origin).

To Reproduce simple_bca_py(..., E1=0.0, ...)

Expected behavior Even the library functions should probably panic immediately on bad input instead of panicking on the eventual numerical consequences.