Remove python level MMFF prop shim in favor of direct C++#138
Remove python level MMFF prop shim in favor of direct C++#138scal444 wants to merge 3 commits intoNVIDIA-Digital-Bio:mainfrom
Conversation
|
| Filename | Overview |
|---|---|
| nvmolkit/mmff_python_utils.h | Adds ForceFields::PyMMFFMolProperties shim and buildMMFFPropertiesFromRDKit; relies on Linux ODR symbol merging (documented, previously reviewed, with static_assert guard and TODO) |
| nvmolkit/_mmff_bridge.py | Removes the fragile Python-level WeakKeyDictionary settings cache and delegates directly to _batchedForcefield.buildMMFFPropertiesFromRDKit; clean simplification |
| nvmolkit/batchedForcefield.cpp | Adds Boost.Python binding for buildMMFFPropertiesFromRDKit with correct arg names and docstring |
| nvmolkit/tests/test_batched_forcefield.py | Removes capture_mmff_settings dependency; adds test_mmff_batched_forcefield_reads_externally_configured_properties covering the exact bug the PR fixes |
| nvmolkit/tests/test_mmff_optimization.py | Removes capture_mmff_settings import; replaces capture_mmff_settings call with a direct return mmff_props |
Reviews (3): Last reviewed commit: "Add explicit support test" | Re-trigger Greptile
Document the Linux/ELF symbol-resolution dependency and the upstream RDKit issue tracking the permanent fix. Add a static_assert guarding against accidental layout changes to the shim itself.
evasnow1992
left a comment
There was a problem hiding this comment.
Changes look good to me. Thank you for fixing this bug. May benefit from adding one test for testing building properties with raw rdForceFieldHelpers.MMFFGetMoleculeProperties(mol), then configuring with Set*Term() calls, and handing to MMFFBatchedForcefield, to see if the previous broken path works now. Not a blocker.
The weird python cache wasn't actually working for all use cases, which was being hidden in unit tests, unfortunately, due to the call to
capture_mmff_settings.The difficulty in general was that this class isn't exposed via public API to the python interface on the rdkit side, but since we can see it, we can create our own quick wrapper.