pymatgen icon indicating copy to clipboard operation
pymatgen copied to clipboard

Outcar parsing for vasp 6.2.0 is broken

Open MichaelWolloch opened this issue 3 years ago • 3 comments

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:

  1. 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)
  2. in the execution directory open ipython
  3. from pymatgen.io.vasp.output import Outcar
  4. outcar_parsed = Outcar('OUTCAR')
  5. 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:

OUTCAR.gz

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.

MichaelWolloch avatar Feb 18 '21 12:02 MichaelWolloch

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

mkhorton avatar Feb 18 '21 21:02 mkhorton

Pull request was made and all checks have passed.

MichaelWolloch avatar Feb 19 '21 10:02 MichaelWolloch

@mkhorton -- looks like this one can be closed.

Andrew-S-Rosen avatar Apr 20 '22 02:04 Andrew-S-Rosen

@janosh: This can be closed.

Andrew-S-Rosen avatar Jun 03 '23 01:06 Andrew-S-Rosen