Skip to content

Commit

Permalink
Fix LobsterSet (#3771)
Browse files Browse the repository at this point in the history
* fix potcar_symbols variable value

* add tests to check potcar PBE_54 consistency

* remove commented code block
  • Loading branch information
naik-aakash authored Apr 23, 2024
1 parent 267963e commit 7e2f16c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pymatgen/io/vasp/sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2694,7 +2694,7 @@ def incar_updates(self) -> dict:
"""Get updates to the INCAR config for this calculation type."""
from pymatgen.io.lobster import Lobsterin

potcar_symbols = self.poscar.site_symbols
potcar_symbols = self.potcar_symbols

# predefined basis! Check if the basis is okay! (charge spilling and bandoverlaps!)
if self.user_supplied_basis is None and self.address_basis_file is None:
Expand Down
13 changes: 13 additions & 0 deletions tests/io/vasp/test_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1893,7 +1893,10 @@ class TestLobsterSet(PymatgenTest):
def setUp(self):
self.set = LobsterSet
file_path = f"{VASP_IN_DIR}/POSCAR"
file_path2 = f"{VASP_IN_DIR}/POSCAR.lobster.spin_DOS"
self.struct = Structure.from_file(file_path)
self.struct2 = Structure.from_file(file_path2)

# test for different parameters!
self.lobsterset1 = self.set(self.struct, isym=-1, ismear=-5)
self.lobsterset2 = self.set(self.struct, isym=0, ismear=0)
Expand Down Expand Up @@ -1923,6 +1926,9 @@ def setUp(self):
# test W_sw
self.lobsterset8 = self.set(Structure.from_file(f"{TEST_FILES_DIR}/electronic_structure/cohp/POSCAR.W"))

# test if potcar selection is consistent with PBE_54
self.lobsterset9 = self.set(self.struct2)

def test_incar(self):
incar1 = self.lobsterset1.incar
assert "NBANDS" in incar1
Expand Down Expand Up @@ -1950,6 +1956,13 @@ def test_kpoints(self):
def test_potcar(self):
# PBE_54 is preferred at the moment
assert self.lobsterset1.user_potcar_functional == "PBE_54"
# test if potcars selected are consistent with PBE_54
assert self.lobsterset2.potcar.symbols == ["Fe_pv", "P", "O"]
# test if error raised contains correct potcar symbol for K element as PBE_54 set
with pytest.raises(
OSError, match="You do not have the right POTCAR with functional='PBE_54' and symbol='K_sv'"
):
_ = self.lobsterset9.potcar.symbols

def test_as_from_dict(self):
dict_here = self.lobsterset1.as_dict()
Expand Down

0 comments on commit 7e2f16c

Please sign in to comment.