Skip to content

Commit 9304346

Browse files
Add better explanation of test/check order to improve performance in fast mode
1 parent b84e83c commit 9304346

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

pymatgen/io/validation/validation.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def from_dict(
190190
).check()
191191

192192
if len(cls_kwargs["reasons"]) > 0 and fast:
193-
return cls(valid=False, **cls_kwargs)
193+
return cls(**cls_kwargs)
194194

195195
if allow_explicit_kpoint_mesh == "auto":
196196
allow_explicit_kpoint_mesh = True if "NSCF" in cls_kwargs["calc_type"].name else False
@@ -215,6 +215,13 @@ def from_dict(
215215
if valid_input_set:
216216

217217
# Tests ordered by expected computational burden - help optimize `fast` check
218+
# Intuitively, more important checks (INCAR, KPOINTS, and POTCAR settings) would come first
219+
# But to optimize speed in fast mode (relevant for validating a large batch of calculations)
220+
# the faster checks have to come first:
221+
# 1. VASP version
222+
# 2. Common errors (known bugs in VASP, erratic SCF convergence, etc.)
223+
# 3. KPOINTS or KSPACING (from INCAR)
224+
# 4. INCAR (many sequential checks of possible INCAR tags + updating defaults)
218225

219226
# TODO: check for surface/slab calculations!!!!!!
220227

@@ -244,8 +251,6 @@ def from_dict(
244251
fast=fast,
245252
).check()
246253

247-
# Get subset of POTCAR summary stats to validate calculation
248-
249254
if check_potcar:
250255
CheckPotcar(
251256
reasons=cls_kwargs["reasons"],
@@ -270,7 +275,7 @@ def from_dict(
270275
fast=fast,
271276
).check()
272277

273-
return cls(valid=len(cls_kwargs["reasons"]) == 0, **cls_kwargs)
278+
return cls(**cls_kwargs)
274279

275280
@classmethod
276281
def from_directory(cls, dir_name: Path | str, **kwargs) -> ValidationDoc:

0 commit comments

Comments
 (0)