Add optional ML-based solvation correction pathway #2798
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces an optional ML-based solvation correction pathway into RMG’s thermochemistry pipeline. It provides an interface for estimating solvation effects using a pre-trained ML model, while preserving the existing LSER (Linear Solvation Energy Relationship) method as a fallback mechanism.
Motivation or Problem
Currently, RMG uses LSER for solvation corrections for thermo. At this stage, the ML component is implemented as a dummy version that always outputs zero corrections. This is intentional — actual ML functionality will be introduced later, after transitioning to Python 3.11 for better compatibility.
Description of Changes
Add
MLSolvation
class tormgpy/data/solvation.py
MLSolvation
class that mirrors the structure ofMLEstimator
frommlEstimator
.mlSolvation
block in the input file, with options likeuse_ml_solvation=True
andname='solvation'
.MLEstimator
, which resides inrmgpy/ml/estimator.py
, this new class is defined withinrmgpy/data/solvation.py
.get_solvation_correction()
method, analogous toSolvationDatabase
, and returns aSolvationCorrection
object.Add
ml_solvation()
function tormgpy/rmg/input.py
ml_estimator()
block and allows ML solvation to be optionally configured via the input file.Modify
rmgpy/thermo/thermoengine.py
to support fallback logicget_input("ml_solvation")
.try-except
block.Testing
mlSolvation
block → expected warning:mlSolvation
block → dummy ML model successfully invoked:Reviewer Tips
from rmgpy.data.solvation import SolvationCorrection
insolvation.py
from rmgpy.rmg.input import get_input
inthermoengine.py
MLSolvation
is currently a dummy implementation and does not load an actual model. It is prepared to be upgraded in future commits after Python 3.11 migration.