Skip to content

Commit

Permalink
breaking: pascal case PMG_VASP_PSP_DIR_Error (#4048)
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh authored Sep 6, 2024
1 parent 51ea7de commit 15dc137
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/pymatgen/io/vasp/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1728,7 +1728,7 @@ class OrbitalDescription(NamedTuple):
POTCAR_STATS_PATH: str = os.path.join(MODULE_DIR, "potcar-summary-stats.json.bz2")


class PMG_VASP_PSP_DIR_Error(ValueError):
class PmgVaspPspDirError(ValueError):
"""Error thrown when PMG_VASP_PSP_DIR is not configured, but POTCAR is requested."""


Expand Down Expand Up @@ -2277,7 +2277,7 @@ def from_symbol_and_functional(
functional_subdir = SETTINGS.get("PMG_VASP_PSP_SUB_DIRS", {}).get(functional, cls.functional_dir[functional])
PMG_VASP_PSP_DIR = SETTINGS.get("PMG_VASP_PSP_DIR")
if PMG_VASP_PSP_DIR is None:
raise PMG_VASP_PSP_DIR_Error(
raise PmgVaspPspDirError(
f"No POTCAR for {symbol} with {functional=} found. Please set the PMG_VASP_PSP_DIR in .pmgrc.yaml."
)
if not os.path.isdir(PMG_VASP_PSP_DIR):
Expand Down
13 changes: 6 additions & 7 deletions src/pymatgen/io/vasp/sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
from pymatgen.analysis.structure_matcher import StructureMatcher
from pymatgen.core import Element, PeriodicSite, SiteCollection, Species, Structure
from pymatgen.io.core import InputGenerator
from pymatgen.io.vasp.inputs import Incar, Kpoints, PMG_VASP_PSP_DIR_Error, Poscar, Potcar, VaspInput
from pymatgen.io.vasp.inputs import Incar, Kpoints, PmgVaspPspDirError, Poscar, Potcar, VaspInput
from pymatgen.io.vasp.outputs import Outcar, Vasprun
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
from pymatgen.symmetry.bandstructure import HighSymmKpath
Expand Down Expand Up @@ -345,13 +345,12 @@ def write_input(
vasp_input = None
try:
vasp_input = self.get_input_set(potcar_spec=potcar_spec)
except PMG_VASP_PSP_DIR_Error as exc:
except PmgVaspPspDirError:
if not potcar_spec:
raise ValueError(
"PMG_VASP_PSP_DIR is not set."
" Please set the PMG_VASP_PSP_DIR in .pmgrc.yaml"
" or use potcar_spec=True argument."
) from exc
raise PmgVaspPspDirError(
"PMG_VASP_PSP_DIR is not set. Please set PMG_VASP_PSP_DIR"
" in .pmgrc.yaml or use potcar_spec=True argument."
) from None

if vasp_input is None:
raise ValueError("vasp_input is None")
Expand Down

0 comments on commit 15dc137

Please sign in to comment.