Skip to content

Commit a084af8

Browse files
committed
Fixes Arkane QM corrections file path
Updates the Arkane quantum corrections file path resolution. The code now correctly identifies the location of the `data.py` file containing QM corrections by checking multiple possible paths. Raises an InputError if the file cannot be located, guiding the user to set the RMG_DB_PATH correctly. This prevents errors when running Arkane calculations due to missing quantum corrections data. This ensures that the Arkane model chemistry and BAC checks correctly identify and utilize the quantum corrections data.
1 parent 97f1f12 commit a084af8

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

arc/statmech/arkane.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -692,8 +692,16 @@ def _get_qm_corrections_files() -> List[str]:
692692
"""
693693
candidates = [
694694
os.path.join(RMG_DB_PATH, 'input', 'quantum_corrections', 'data.py'),
695+
os.path.join(RMG_DB_PATH, 'quantum_corrections', 'data.py'),
695696
]
696-
return [path for path in candidates if os.path.isfile(path)]
697+
existing = [path for path in candidates if os.path.isfile(path)]
698+
if not existing:
699+
raise InputError(
700+
"Could not locate Arkane quantum corrections data.py. "
701+
f"Checked: {', '.join(candidates)}. "
702+
"Please set RMG_DB_PATH to a valid RMG database."
703+
)
704+
return existing
697705

698706

699707
def _normalize_method(method: str) -> str:
@@ -950,9 +958,7 @@ def get_arkane_model_chemistry(sp_level: 'Level',
950958
Returns:
951959
Optional[str]: Arkane-compatible model chemistry string.
952960
"""
953-
qm_corr_file = os.path.join(RMG_DB_PATH, 'input', 'quantum_corrections', 'data.py')
954-
if not os.path.isfile(qm_corr_file):
955-
qm_corr_file = os.path.join(RMG_DB_PATH, 'quantum_corrections', 'data.py')
961+
qm_corr_files = _get_qm_corrections_files()
956962

957963
atom_energies_start = "atom_energies = {"
958964
atom_energies_end = "pbac = {"
@@ -1081,9 +1087,7 @@ def check_arkane_bacs(sp_level: 'Level',
10811087
- basis (normalized)
10821088
and picking the latest year where multiple exist.
10831089
"""
1084-
qm_corr_file = os.path.join(RMG_DB_PATH, 'input', 'quantum_corrections', 'data.py')
1085-
if not os.path.isfile(qm_corr_file):
1086-
qm_corr_file = os.path.join(RMG_DB_PATH, 'quantum_corrections', 'data.py')
1090+
qm_corr_files = _get_qm_corrections_files()
10871091

10881092
atom_energies_start = "atom_energies = {"
10891093
atom_energies_end = "pbac = {"

0 commit comments

Comments
 (0)