Skip to content

Commit 5b43580

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 ded92f2 commit 5b43580

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
@@ -850,6 +850,7 @@ def _find_best_level_key_for_sp_level(level: "Level",
850850
target_software = level.software.lower() if level.software else None
851851

852852
best_key = None
853+
best_year = None
853854

854855
for lot_str in _iter_level_keys_from_section(file_path, section_start, section_end):
855856
params = _parse_lot_params(lot_str)
@@ -884,10 +885,16 @@ def _find_best_level_key_for_sp_level(level: "Level",
884885
continue
885886
best_key = lot_str
886887
break
887-
else:
888-
if cand_year is None:
888+
889+
# No target year specified: pick the latest year if present, otherwise fall back to no-year entry.
890+
if cand_year is None:
891+
if best_year is None:
889892
best_key = lot_str
890-
break
893+
continue
894+
895+
if best_year is None or cand_year > best_year:
896+
best_year = cand_year
897+
best_key = lot_str
891898

892899
return best_key
893900

0 commit comments

Comments
 (0)