Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix reciprocal_density in MPHSEBSSet and tests #3499

Merged
merged 2 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pymatgen/io/vasp/sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1457,10 +1457,10 @@ def __init__(
self.added_kpoints = added_kpoints if added_kpoints is not None else []
self.mode = mode

if not reciprocal_density or "reciprocal_density" not in self.user_kpoints_settings:
self.reciprocal_density = 50
else:
if reciprocal_density or "reciprocal_density" in self.user_kpoints_settings:
self.reciprocal_density = reciprocal_density or self.user_kpoints_settings["reciprocal_density"]
else:
self.reciprocal_density = 50

self.kpoints_line_density = kpoints_line_density
self.copy_chgcar = copy_chgcar
Expand Down
10 changes: 10 additions & 0 deletions tests/io/vasp/test_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,16 @@ def test_init(self):
assert vis.incar["ISYM"] == 3
assert len(vis.kpoints.kpts) == 180

vis = self.set.from_prev_calc(prev_calc_dir=prev_run, mode="uniform", reciprocal_density=50)
assert vis.reciprocal_density == 50

vis = self.set.from_prev_calc(prev_calc_dir=prev_run, mode="uniform", reciprocal_density=100)
assert vis.reciprocal_density == 100

uks = {"reciprocal_density": 100}
vis = self.set.from_prev_calc(prev_calc_dir=prev_run, mode="uniform", user_kpoints_settings=uks)
assert vis.reciprocal_density == 100

with pytest.warns(BadInputSetWarning, match=r"Hybrid functionals"):
vis = self.set(PymatgenTest.get_structure("Li2O"), user_incar_settings={"ALGO": "Fast"})
vis.incar.items()
Expand Down