Error reading a VASP CHGCAR file
Checklist
-
The issue remains in the development version of ASE. -
An minimal example is provided to reproduce the issue.
Summary
I'm getting this error reading some CHGCAR files from a public dataset:
Traceback (most recent call last):
File "/home/work/Desktop/test_read_vasp.py", line 4, in <module>
density = VaspChargeDensity("000001.CHGCAR")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/work/miniconda3/envs/ase-test/lib/python3.11/site-packages/ase/calculators/vasp/vasp_auxiliary.py", line 39, in __init__
self.read(filename)
File "/home/work/miniconda3/envs/ase-test/lib/python3.11/site-packages/ase/calculators/vasp/vasp_auxiliary.py", line 90, in read
atoms = aiv.read_vasp(fd)
^^^^^^^^^^^^^^^^^
File "/home/work/miniconda3/envs/ase-test/lib/python3.11/site-packages/ase/utils/__init__.py", line 577, in iofunc
obj = func(fd, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/work/miniconda3/envs/ase-test/lib/python3.11/site-packages/ase/io/vasp.py", line 147, in read_vasp
raise RuntimeError('The number of scaling factors must be 1 or 3.')
RuntimeError: The number of scaling factors must be 1 or 3.
This issue is present in the latest commit (2c0ea125) as well as release version 3.23.0
but not in the previous version 3.22.1
.
Minimal example
Try reading this CHGCAR file (taken from this dataset) like so:
from ase.calculators.vasp import VaspChargeDensity
density = VaspChargeDensity("000001.CHGCAR")