Skip to content

Commit 0c5ead0

Browse files
authored
Avoid dict mutation in VaspInputSet.structure setter (#4520)
`_config_dict["POTCAR"]` was being modified in-place during Yb PSP warning check this caused `user_potcar_settings` to be permanently merged into `_config_dict["POTCAR"]`, might lead to incorrect POTCAR settings in subsequent operations
1 parent 9c2fdf7 commit 0c5ead0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/pymatgen/io/vasp/sets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ def structure(self, structure: Structure | None) -> None:
427427
get_valid_magmom_struct(structure, spin_mode="auto")
428428

429429
struct_has_Yb = any(specie.symbol == "Yb" for site in structure for specie in site.species)
430-
potcar_settings = self._config_dict.get("POTCAR", {})
430+
potcar_settings = self._config_dict.get("POTCAR", {}).copy()
431431
if self.user_potcar_settings:
432432
potcar_settings.update(self.user_potcar_settings)
433433
uses_Yb_2_psp = potcar_settings.get("Yb", None) == "Yb_2"

0 commit comments

Comments
 (0)