Skip to content

Commit e34766a

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 37510c9 commit e34766a

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
@@ -716,8 +716,16 @@ def _get_qm_corrections_files() -> List[str]:
716716
"""
717717
candidates = [
718718
os.path.join(RMG_DB_PATH, 'input', 'quantum_corrections', 'data.py'),
719+
os.path.join(RMG_DB_PATH, 'quantum_corrections', 'data.py'),
719720
]
720-
return [path for path in candidates if os.path.isfile(path)]
721+
existing = [path for path in candidates if os.path.isfile(path)]
722+
if not existing:
723+
raise InputError(
724+
"Could not locate Arkane quantum corrections data.py. "
725+
f"Checked: {', '.join(candidates)}. "
726+
"Please set RMG_DB_PATH to a valid RMG database."
727+
)
728+
return existing
721729

722730

723731
def _normalize_method(method: str) -> str:
@@ -974,9 +982,7 @@ def get_arkane_model_chemistry(sp_level: 'Level',
974982
Returns:
975983
Optional[str]: Arkane-compatible model chemistry string.
976984
"""
977-
qm_corr_file = os.path.join(RMG_DB_PATH, 'input', 'quantum_corrections', 'data.py')
978-
if not os.path.isfile(qm_corr_file):
979-
qm_corr_file = os.path.join(RMG_DB_PATH, 'quantum_corrections', 'data.py')
985+
qm_corr_files = _get_qm_corrections_files()
980986

981987
atom_energies_start = "atom_energies = {"
982988
atom_energies_end = "pbac = {"
@@ -1105,9 +1111,7 @@ def check_arkane_bacs(sp_level: 'Level',
11051111
- basis (normalized)
11061112
and picking the latest year where multiple exist.
11071113
"""
1108-
qm_corr_file = os.path.join(RMG_DB_PATH, 'input', 'quantum_corrections', 'data.py')
1109-
if not os.path.isfile(qm_corr_file):
1110-
qm_corr_file = os.path.join(RMG_DB_PATH, 'quantum_corrections', 'data.py')
1114+
qm_corr_files = _get_qm_corrections_files()
11111115

11121116
atom_energies_start = "atom_energies = {"
11131117
atom_energies_end = "pbac = {"

0 commit comments

Comments
 (0)