Open msiron-entalpic opened 4 days ago
Hi @msiron-entalpic thanks for reporting this, I could confirm this issue.
The reason being we added strict=True
to ensure the two iterators (mols
and lattices
) to unpack are of the same length: https://github.com/materialsproject/pymatgen/blob/e9ea813107ea223d5ce693bdf5e4f74fe29f76db/src/pymatgen/io/cp2k/outputs.py#L300
I'm not a CP2K
user, so I would need your help to confirm this (also ping the original author @nwinner ):
mols
(CP2K-pos-1.xyz
) is longer than lattices
by 1 (CP2K-1.cell
), can I know the reason for this? Is it because the initial structure is recorded while lattice only starts after the run begins? zip(mols[1:], lattices, strict=True)
) to make the structure and lattice match? Also the total_energy
entry is longer than structures
by 1 (SCF run at the start I assume?):
https://github.com/materialsproject/pymatgen/blob/e9ea813107ea223d5ce693bdf5e4f74fe29f76db/src/pymatgen/io/cp2k/outputs.py#L523
If so, should we skip the first energy to make the energy-structure match each other (zip(self.structures, self.data.get("total_energy")[1:], strict=True)
)?
Is it possible for you to provide a unsuccessful run such that we could enhance the unit test for unsuccessful runs as well?
Python version
3.12.5
Pymatgen version
v2024.9.17.1
Operating system version
MacOSX
Current behavior
When parsing cp2k output using
With any version of Pymatgen after v2024.8.9 stacktrace:
After testing the lattices variable has one less entry than the mols variable. Adding one more entry to lat or removing first entry from mols leads to errors downstream.
Expected Behavior
Expect to be able to parse output without errors with auto_load as in v2024.8.9
Minimal example
Relevant files to reproduce this bug
Archive 2.zip