Commit ebfc7a0 1 parent 60464fd commit ebfc7a0 Copy full SHA for ebfc7a0
File tree 2 files changed +12
-4
lines changed
2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -2277,9 +2277,7 @@ def from_symbol_and_functional(
2277
2277
functional_subdir = SETTINGS .get ("PMG_VASP_PSP_SUB_DIRS" , {}).get (functional , cls .functional_dir [functional ])
2278
2278
PMG_VASP_PSP_DIR = SETTINGS .get ("PMG_VASP_PSP_DIR" )
2279
2279
if PMG_VASP_PSP_DIR is None :
2280
- raise PmgVaspPspDirError (
2281
- f"No POTCAR for { symbol } with { functional = } found. Please set the PMG_VASP_PSP_DIR in .pmgrc.yaml."
2282
- )
2280
+ raise PmgVaspPspDirError ("Set PMG_VASP_PSP_DIR=<directory-path> in .pmgrc.yaml (needed to find POTCARs)" )
2283
2281
if not os .path .isdir (PMG_VASP_PSP_DIR ):
2284
2282
raise FileNotFoundError (f"{ PMG_VASP_PSP_DIR = } does not exist." )
2285
2283
Original file line number Diff line number Diff line change 28
28
Incar ,
29
29
Kpoints ,
30
30
KpointsSupportedModes ,
31
+ PmgVaspPspDirError ,
31
32
Poscar ,
32
33
Potcar ,
33
34
PotcarSingle ,
@@ -1211,7 +1212,16 @@ def test_from_symbol_and_functional_raises(self):
1211
1212
# test FileNotFoundError on non-existent PMG_VASP_PSP_DIR in SETTINGS
1212
1213
PMG_VASP_PSP_DIR = "missing-dir"
1213
1214
symbol , functional = "Fe" , "PBE_64"
1214
- with (
1215
+ with ( # test PMG_VASP_PSP_DIR not set in SETTINGS
1216
+ patch .dict (SETTINGS , PMG_VASP_PSP_DIR = None ),
1217
+ pytest .raises (
1218
+ PmgVaspPspDirError ,
1219
+ match = re .escape ("Set PMG_VASP_PSP_DIR=<directory-path> in .pmgrc.yaml (needed to find POTCARs)" ),
1220
+ ),
1221
+ ):
1222
+ PotcarSingle .from_symbol_and_functional (symbol , functional )
1223
+
1224
+ with ( # test FileNotFoundError on non-existent PMG_VASP_PSP_DIR in SETTINGS
1215
1225
patch .dict (SETTINGS , PMG_VASP_PSP_DIR = PMG_VASP_PSP_DIR ),
1216
1226
pytest .raises (FileNotFoundError , match = f"{ PMG_VASP_PSP_DIR = } does not exist." ),
1217
1227
):
You can’t perform that action at this time.
0 commit comments