Skip to content

Commit df92b40

Browse files
committed
Improves level of theory matching in Arkane
Updates Arkane's level of theory matching logic to prioritize entries with the latest year when no target year is specified. This ensures that the most up-to-date level of theory is selected when multiple options are available.
1 parent 57a812b commit df92b40

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

arc/statmech/arkane.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,7 @@ def _find_best_level_key_for_sp_level(level: "Level",
856856
target_software = level.software.lower() if level.software else None
857857

858858
best_key = None
859+
best_year = None
859860

860861
for lot_str in _iter_level_keys_from_section(file_path, section_start, section_end):
861862
params = _parse_lot_params(lot_str)
@@ -890,10 +891,16 @@ def _find_best_level_key_for_sp_level(level: "Level",
890891
continue
891892
best_key = lot_str
892893
break
893-
else:
894-
if cand_year is None:
894+
895+
# No target year specified: pick the latest year if present, otherwise fall back to no-year entry.
896+
if cand_year is None:
897+
if best_year is None:
895898
best_key = lot_str
896-
break
899+
continue
900+
901+
if best_year is None or cand_year > best_year:
902+
best_year = cand_year
903+
best_key = lot_str
897904

898905
return best_key
899906

0 commit comments

Comments
 (0)