Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too large energies printed in siesta made sisl crash #482

Merged
merged 1 commit into from
Aug 17, 2022

Conversation

pfebrer
Copy link
Contributor

@pfebrer pfebrer commented Aug 17, 2022

When SIESTA has to print an energy value that it is too large to be formatted, it prints **********************. This was making outSileSiesta.read_energy() fail in those cases, since it was trying to convert the string to a float. In my case the very large energy was the ion-electron energy, and although I only cared about the total energy it reads all of them and crashes because it can not read a particular one.

With this commit when the energy can not be parsed to float np.nan is asigned. We could check for asterisks in the string, but I think that would be a waste of time. Also, I didn't know whether to choose np.inf over np.nan. The problem is that the sign of the "infinite" value is unknown and it is not really infinite, so I think np.nan is better.

@codecov
Copy link

codecov bot commented Aug 17, 2022

Codecov Report

Merging #482 (9bf7a5c) into main (0545e6e) will decrease coverage by 0.00%.
The diff coverage is 62.50%.

❗ Current head 9bf7a5c differs from pull request most recent head d24f877. Consider uploading reports for the commit d24f877 to get more accurate results

@@            Coverage Diff             @@
##             main     #482      +/-   ##
==========================================
- Coverage   86.91%   86.91%   -0.01%     
==========================================
  Files         346      346              
  Lines       44311    44317       +6     
==========================================
+ Hits        38513    38517       +4     
- Misses       5798     5800       +2     
Impacted Files Coverage Δ
sisl/io/siesta/out.py 74.77% <62.50%> (-0.23%) ⬇️
sisl/geom/nanotube.py 95.83% <0.00%> (+1.04%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@zerothi
Copy link
Owner

zerothi commented Aug 17, 2022

Great addition!

One thing, I would like a warning to be raised (so users are aware of possible output-problems). We already have the key, so it would be specific! Could you please add this in the catch clause?

@pfebrer
Copy link
Contributor Author

pfebrer commented Aug 17, 2022

Done! You can change the message to whatever you prefer 😅

@zerothi zerothi merged commit 5dee6df into zerothi:main Aug 17, 2022
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants