pymatgen icon indicating copy to clipboard operation
pymatgen copied to clipboard

`UnknownPotcarWarning` occurs for valid POTCARs due to mismatched line endings

Open Andrew-S-Rosen opened this issue 5 months ago • 4 comments

Python version

3.11

Pymatgen version

2025.6.14

Operating system version

No response

Current behavior

Pymatgen is returning UnknownPotcarWarning for a valid POTCAR, which may cause some unnecessary concern for users. Here, I am using the La pseudopotential from the PAW_PBE.64 pseudopotential set. The POTCAR has a SHA256 hash of b7aad99517e50aeb53363b20a29bb0dfa896544080812fb23322f071df953199. A similar warning is raised for Yb. Doing the same analysis on, for instance, H or W has no warning.

from pymatgen.io.vasp.inputs import Potcar

Potcar(['La'],functional="PBE_64")
/home/asrosen/.conda/envs/cms/lib/python3.12/site-packages/pymatgen/io/vasp/inputs.py:2508: UnknownPotcarWarning: POTCAR data with symbol La is not known to pymatgen. Your POTCAR may be corrupted or pymatgen's POTCAR database is incomplete.
  return cls(file.read(), symbol=symbol or None)  # type:ignore[arg-type]

It's not just the PBE_64 sets. For instance, the following also raises a warning:

from pymatgen.io.vasp.inputs import Potcar

Potcar(['Yb'],functional="PBE_52")

Note to self: I ran into this warning in practice when running Custodian because the VaspJob and handlers call VaspInput.from_directory() which itself does a POTCAR check automatically. See here.

Andrew-S-Rosen avatar Jul 31 '25 15:07 Andrew-S-Rosen

Just noting we're going to look at this outside GH so that I can investigate how MP's POTCARs differ from those mentioned in the issue

esoteric-ephemera avatar Aug 13 '25 17:08 esoteric-ephemera

Documenting here that this is likely a Windows vs. Linux line-ending issue. On Linux, it gives me the warning, while on Windows it does not.

Andrew-S-Rosen avatar Aug 13 '25 20:08 Andrew-S-Rosen

I think this is really an unnecessary level of complexity and we should just kill off the hash check

shyuep avatar Aug 13 '25 20:08 shyuep

Just had a user asking about this as well. I'd lean towards disabling by default at the very least.

(Sorry, don't have time to implement this --- but hopefully one day I or someone else can take care of it.)

Andrew-S-Rosen avatar Sep 12 '25 00:09 Andrew-S-Rosen