Skip to content

Commit

Permalink
fix reciprocal_density in MPHSEBSSet and tests (#3499)
Browse files Browse the repository at this point in the history
* fix reciprocal_density in MPHSEBSSet and tests

* pre-commit auto-fixes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
fraricci and pre-commit-ci[bot] authored Dec 6, 2023
1 parent 65f4a61 commit 2439dea
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
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

0 comments on commit 2439dea

Please sign in to comment.