m3g / packmol

Packmol - Initial configurations for molecular dynamics simulations
http://m3g.github.io/packmol
MIT License
222 stars 51 forks source link

Capture of floating point exception #46

Closed SSchott closed 1 year ago

SSchott commented 1 year ago

With warnings enabled, Fortran gives an error if the argument of an exp is below ~-500, when getting close to 0. This is triggered in h exp(−(x-a₁)²/(2a₂²)−(y-b₁)²/(2b₂²))-(z-c)=0

Captured the exception by setting h exp(−(x-a₁)²/(2a₂²)−(y-b₁)²/(2b₂²)) = 0 if −(x-a₁)²/(2a₂²)−(y-b₁)²/(2b₂²) <= -50