Closed RyanNKHall closed 2 years ago
@RyanNKHall: Just a head's up, the line you want is probably
self.encut = np.fromfile(f, dtype=np.float64, count=1)[0]
Without the [0]
indexing, self.encut
is returned as a length-one array instead of a float.
Thanks @arosen93. I actually spotted this the other day too. It doesn't seem to cause any issues without it because I think most functions that use encut would be able to unpack the value from a size 1 array but I guess it could cause issues and it's more correct to reference the value.
I noticed there's a variable that's unpacked a few lines down that indexes the array in this way and it's obvious now that a numpy function would create an array by default.
This is now addressed via #2410. @RyanNKHall or @mkhorton, looks like you can close this one.
Addressed via #2410 Thanks @arosen93 for completing the PR and @mkhorton for the support.
Describe the bug Within the
pymatgen.io.vasp.outputs
module'sWavecar
class is a function called_generate_G_points
(line 5012) that generates the G vectors for the plane wave expansion of the wavefunction using the cutoff energy from the Wavecar file and the kpoints. This function fails to generate the correct number of Gpoints when tested against a range of VASP version 5 Wavecar files. I found the issue arises due to the _encut attribute, which represents the cutoff energy for the plane wave expansion being cast to an integer type in the Wavecar class init function (line 4833). I was able to fix the bug by leaving encut as a float.To Reproduce Steps to reproduce the behavior:
print("\n# Gpoints:", len(self.Gpoints[ink]), "# plane waves:", nplane, "# extra Gpts:", len(extra_gpoints), "\n")
before the value error is raises will display to the terminal the number of Gpoints generated versus the required number nplane. In this example, 244 Gpoints are generated instead of the expected 253.to:
The error/issue is resolved. I have not tested this with earlier VASP WAVECAR outputs
Provide any example files that are needed to reproduce the error, especially if the bug pertains to parsing of a file.
Expected behavior The
_generate_G_points
should generate the correct number of Gpoints for the specified VASP WAVECAR type e.g. std, gam, or nclFiles required to reproduce error bug_report.zip
Desktop (please complete the following information):
Additional context Feel free to contact me via email: ryan.n.hall@unsw.edu.au