|
20 | 20 |
|
21 | 21 |
|
22 | 22 | DEFAULT_CHECKS = [CheckStructureProperties, CheckPotcar, CheckCommonErrors, CheckKpointsKspacing, CheckIncar]
|
| 23 | +REQUIRED_VASP_FILES: set[str] = {"INCAR", "KPOINTS", "POSCAR", "POTCAR", "OUTCAR", "vasprun.xml"} |
23 | 24 |
|
24 | 25 | # TODO: check for surface/slab calculations. Especially necessary for external calcs.
|
25 | 26 | # TODO: implement check to make sure calcs are within some amount (e.g. 250 meV) of the convex hull in the MPDB
|
@@ -128,6 +129,8 @@ def from_vasp_input(
|
128 | 129 | vf: VaspFiles = vasp_files
|
129 | 130 | elif vasp_file_paths:
|
130 | 131 | vf = VaspFiles.from_paths(**vasp_file_paths)
|
| 132 | + else: |
| 133 | + raise ValueError("You must specify either a VaspFiles object or a dict of paths.") |
131 | 134 |
|
132 | 135 | config: dict[str, list[str]] = {
|
133 | 136 | "reasons": [],
|
@@ -167,7 +170,9 @@ def from_directory(cls, dir_name: str | Path, **kwargs) -> Self:
|
167 | 170 | """
|
168 | 171 | dir_name = Path(dir_name)
|
169 | 172 | vasp_file_paths = {}
|
170 |
| - for file_name in ("INCAR", "KPOINTS", "POSCAR", "POTCAR", "OUTCAR", "vasprun.xml"): |
| 173 | + for file_name in REQUIRED_VASP_FILES: |
171 | 174 | if (file_path := Path(zpath(str(dir_name / file_name)))).exists():
|
172 | 175 | vasp_file_paths[file_name.lower().split(".")[0]] = file_path
|
| 176 | + if not vasp_file_paths: |
| 177 | + raise ValueError("No valid VASP files were found.") |
173 | 178 | return cls.from_vasp_input(vasp_file_paths=vasp_file_paths, **kwargs)
|
0 commit comments