[Possible bug] Latest versions of LAMMPS refuse to read very small floating point numbers that used to work in the past

Dear Developers,

I was going to post an issue on the github, but I’m not sure if it’s actually a bug or expected behavior.

I used git bisect to determine that commit d5e57ac02d17d9b0794127c01245214b3a708f2c is what broke this, which makes sense. Here is the issue I was going to post:

Summary
LAMMPS-29Aug2024 refuses to read floating point numbers that LAMMPS-15Jun2023 was able to read

LAMMPS Version and Platform

See versions above. Tested on Ubuntu 22 running through WSL

Expected Behavior

Expected to be able to run simulations with no complaint

Actual Behavior

Gives a “Not a valid floating-point number” error

Steps to Reproduce

Run the following basic script with LAMMPS-29Aug2024 using the potential:
https://www.ctcms.nist.gov/potentials/Download/2016--Beland-L-K-Lu-C-Osetskiy-Y-N-et-al--Ni-Co/1/NiCo-lammps-2014.alloy

It gives

ERROR on proc 0: Not a valid floating-point number: '1.439870326823783e-309' (src/MANYBODY/pair_eam_alloy.cpp:174)

On LAMMPS-15Jun2023, the script runs without complaint

units metal
boundary         p p p
# Create simulation box
lattice          fcc 3.5
region           simbox block 0 1 0 1 0 1 units lattice
create_box       1 simbox
create_atoms     1 box
mass             1 1

# Define interactions
pair_style eam/alloy
pair_coeff * * NiCo-lammps-2014.alloy Ni

# Compute energy
run 0

This is the expected and correct behavior. We switched from using atof() or equivalent for converting floating point numbers, which silently returns 0.0 for illegal numbers to std::stod() which throws an exception for numbers that are outside the valid range.

1 Like