pymatgen
pymatgen copied to clipboard
Outcar parsing for vasp 6.2.0 is broken
Describe the bug
I recently used VASP version 6.2.0 (newest official release afaik) and found that the Outcar parser of pymatgen (class Outcar
, __init__
method, in pymatgen.io.vasp.outputs.py) is not compatible with it.
The problem is a tiny change in the OUTCAR format concerning memory, especially the line where the average memory consumption is detailed. (I think VASP often actually does not know the average memory used…) In 5.4.* and 6.1.* I get:
Average memory used (kb): 0.
In version 6.2.0 I get:
Average memory used (kb): N/A
To Reproduce Steps to reproduce the behavior:
- Run a small vasp calculation with version 6.2.0 and wait till it is completed (or use the OUTCAR from below that I created)
- in the execution directory open ipython
- from pymatgen.io.vasp.output import Outcar
- outcar_parsed = Outcar('OUTCAR')
- See
ValueError: could not convert string to float: 'N/A'
Provide any example files that are needed to reproduce the error, especially if the bug pertains to parsing of a file:
Expected behavior No parsing error
Additional context
The problematic line is 1715 in pymatgen.io.vasp.outputs.py:
run_stats[tok[0].strip()] = float(tok[1].strip())
I would simply replace this with the following try/except block:
try:
run_stats[tok[0].strip()] = float(tok[1].strip())
except:
run_stats[tok[0].strip()] = 0.0
I can create a pull request that does exactly that if needed.
I can create a pull request that does exactly that if needed.
That would be great, thank you!
I would modify it slightly:
try:
run_stats[tok[0].strip()] = float(tok[1].strip())
except ValueError:
run_stats[tok[0].strip()] = None
Pull request was made and all checks have passed.
@mkhorton -- looks like this one can be closed.
@janosh: This can be closed.