-
Notifications
You must be signed in to change notification settings - Fork 924
Closed
Labels
Description
Python version
3.10.16
Pymatgen version
2025.1.24
Operating system version
No response
Current behavior
It seems pymatgen returns incorrect valence configuration while parsing VASP POTCAR. Consider following code, where the POTCAR file corresponds to Hg (VASP-5.4, GGA, PBE, PAW, default):
from pymatgen.io.vasp.inputs import PotcarSingle
with open("POTCAR", "r", encoding="utf-8") as file:
data = file.read()
print(PotcarSingle(data).electron_configuration)It prints:
[(5, 'd', 10), (4, 'f', 14)]
Expected Behavior
Previously, I tested pymatgen==2023.8.10, it used to return:
[(6, 's', 2), (5, 'd', 10)]
The second line (valence) in POTCAR file is:
12.0000000000000
Also, there is this line:
POMASS = XXX.XXX; ZVAL = 12.000 mass and valenz
So, I suppose the previous behavior (i.e, [(6, 's', 2), (5, 'd', 10)], 12 valence electrons) was correct.
Atomic configuration block:
Atomic configuration
15 entries
n l j E occ.
1 0 0.50 XXX 2.0000
...
4 3 3.50 XXX 14.0000
5 0 0.50 XXX 2.0000
5 1 1.50 XXX 6.0000
5 2 2.50 XXX 10.0000
6 0 0.50 XXX 2.0000
6 1 1.50 XXX 0.0000
Minimal example
We can create a temporary directory and create virtualenv for testing:
mkdir test
cd test
python -m venv .venv
source .venv/bin/activate
pip install pymatgen
Then please use POTCAR of Hg and run the above python code.
To test older version of pymatgen, do the same instead install:
pip install pymatgen==2023.8.10 numpy==1.*Relevant files to reproduce this bug
Sorry, but you need access to VASP POTCAR files, which cannot be shared due to copyright issues.
timurbazhirovDanielYang59