Breaking: Default user_potcar_settings to {"W": "W_sv"} in all input sets if user_potcar_functional == "PBE_54"#3022
Conversation
…_potcar_functional: str = None instead
…er_potcar_functional == "PBE_54"
|
Pinging @JaGeo and @arosen93 for review. |
user_potcar_settings to {"W": "W_sv"} in all input sets if user_potcar_functional == "PBE_54"user_potcar_settings to {"W": "W_sv"} in all input sets if user_potcar_functional == "PBE_54"
|
Actually, the PR title is inaccurate. There are input sets that don't have any restrictions on |
in kwargs["user_potcar_settings"] = {"W": "W_sv"}.update(kwargs.get("user_potcar_settings", {}))
pymatgen/io/vasp/sets.py:2352
also address #3022 (comment) by moving {"W": "W_sv"} logic into DictSet
for DRY ValueError on invalid user_potcar_functional
|
@janosh Currently, this code here, does not work: from pymatgen.io.vasp.sets import MPRelaxSet
from pymatgen.core.structure import Structure
structure = Structure.from_dict({'@module': 'pymatgen.core.structure', '@class': 'Structure', 'charge': 0.0,
'lattice': {'matrix': [[2.6794492400614325, 0.0, -1.7723083848423267],
[7.778511770202987e-16, 4.837013999999999,
2.9618168562654676e-16], [0.0, 0.0, 5.76034817]],
'pbc': (True, True, True), 'a': 3.21255743, 'b': 4.837013999999999,
'c': 5.76034817, 'alpha': 90.0, 'beta': 123.48244503999997, 'gamma': 90.0,
'volume': 74.65718535099107}, 'sites': [
{'species': [{'element': 'W', 'oxidation_state': 4.0, 'occu': 1.0}], 'abc': [0.0, 0.5, 0.0],
'xyz': [3.8892558851014935e-16, 2.4185069999999995, 1.4809084281327338e-16], 'label': 'W4+', 'properties': {}},
{'species': [{'element': 'W', 'oxidation_state': 4.0, 'occu': 1.0}], 'abc': [0.0, 0.0, 0.5],
'xyz': [0.0, 0.0, 2.880174085], 'label': 'W4+', 'properties': {}},
{'species': [{'element': 'O', 'oxidation_state': -2.0, 'occu': 1.0}], 'abc': [0.292339, 0.302264, 0.7959505],
'xyz': [0.7833075113903194, 1.4620551996959996, 4.066837145169164], 'label': 'O2-', 'properties': {}},
{'species': [{'element': 'O', 'oxidation_state': -2.0, 'occu': 1.0}], 'abc': [0.707661, 0.802264, 0.7040495],
'xyz': [1.896141728671114, 3.880562199695999, 2.8013767249885095], 'label': 'O2-', 'properties': {}},
{'species': [{'element': 'O', 'oxidation_state': -2.0, 'occu': 1.0}], 'abc': [0.707661, 0.697736, 0.2040495],
'xyz': [1.8961417286711137, 3.3749588003039994, -0.0787973600114904], 'label': 'O2-', 'properties': {}},
{'species': [{'element': 'O', 'oxidation_state': -2.0, 'occu': 1.0}], 'abc': [0.292339, 0.197736, 0.2959505],
'xyz': [0.7833075113903193, 0.9564518003039998, 1.1866630601691643], 'label': 'O2-', 'properties': {}}]})
mprelax = MPRelaxSet(structure=structure, user_potcar_functional="PBE_54")
mprelax.write_input("input")The current change does not seem to correctly fix the issue. |
|
Maybe |
|
Hey @JaGeo, thanks for taking a look! 🙏 Good catch! Didn't want to write tests until initial feedback but I probably should have noticed this without tests. 😅 {"W": "W_sv"}.update(user_potcar_settings)returns user_potcar_settings = {"W": "W_sv", **(user_potcar_settings or {})}Fix and test incoming. |
|
@JaGeo I removed |
…put sets if `user_potcar_functional == "PBE_54"` (#3022)
* DictSet drop deprecated kwarg potcar_functional: str = None, use user_potcar_functional: str = None instead
* default user_potcar_settings to {"W": "W_sv"} in all input sets if user_potcar_functional == "PBE_54"
* fix typos
* fix TypeError: 'NoneType' object is not iterable
in kwargs["user_potcar_settings"] = {"W": "W_sv"}.update(kwargs.get("user_potcar_settings", {}))
pymatgen/io/vasp/sets.py:2352
also address materialsproject/pymatgen#3022 (comment) by moving {"W": "W_sv"} logic into DictSet
* remove test_potcar_functional_warning()
* VaspInputSet add static attr _valid_potcars: Sequence[str] | None = None
for DRY ValueError on invalid user_potcar_functional
* only default user_potcar_settings to {"W": "W_sv"} if structure contains tungsten
also fix materialsproject/pymatgen#3022 (comment)
* pymatgen/io/vasp/tests/test_sets.py add test_potcar_special_defaults()
…put sets if `user_potcar_functional == "PBE_54"` (#3022)
* DictSet drop deprecated kwarg potcar_functional: str = None, use user_potcar_functional: str = None instead
* default user_potcar_settings to {"W": "W_sv"} in all input sets if user_potcar_functional == "PBE_54"
* fix typos
* fix TypeError: 'NoneType' object is not iterable
in kwargs["user_potcar_settings"] = {"W": "W_sv"}.update(kwargs.get("user_potcar_settings", {}))
pymatgen/io/vasp/sets.py:2352
also address materialsproject/pymatgen#3022 (comment) by moving {"W": "W_sv"} logic into DictSet
* remove test_potcar_functional_warning()
* VaspInputSet add static attr _valid_potcars: Sequence[str] | None = None
for DRY ValueError on invalid user_potcar_functional
* only default user_potcar_settings to {"W": "W_sv"} if structure contains tungsten
also fix materialsproject/pymatgen#3022 (comment)
* pymatgen/io/vasp/tests/test_sets.py add test_potcar_special_defaults()
Closes #3016, closes #1707.
Breaking:
DictSetdrop deprecated kwargpotcar_functional: str = None, useuser_potcar_functional: str = Noneinstead (in ac51e26)