brucefan1983 / NEP_CPU

CPU version of NEP
GNU General Public License v3.0
49 stars 15 forks source link

Throw an error for invalid `l_max` #41

Open elindgren opened 1 week ago

elindgren commented 1 week ago

NEP_CPU should throw an error when an invalid value for l_max is presented. For example, here in find_q:

https://github.com/brucefan1983/NEP_CPU/blob/8ec05eb87b5bed0ff3473595adef0232e489b861/src/nep.cpp#L852

Recently had an issue where by mistake an old version of NEP_CPU (only support l_max up to 4) was used with a new model with lmax>4. A check like this would have made it easier to catch the mistake earlier.

brucefan1983 commented 1 week ago

We can do it for the current version, but cannot do it for older versions.

elindgren commented 1 week ago

...but cannot do it for older versions.

Yes of course 😅 My point was just that it could be helpful to have more sanity checks like this in the code.