Skip to content

Exclude carboxylates from conjugated bonds rebuilding in RDKitConverter (#3996) - #5550

Closed
RK-NerdyBirdy wants to merge 1 commit into
MDAnalysis:developfrom
RK-NerdyBirdy:fix/issue-3996-rdkit-carboxylate-exclude
Closed

RK-NerdyBirdy wants to merge 1 commit into
MDAnalysis:developfrom
RK-NerdyBirdy:fix/issue-3996-rdkit-carboxylate-exclude

Conversation

@RK-NerdyBirdy

Copy link
Copy Markdown

Fixes #3996

Changes made in this Pull Request:

  • Update SMARTS patterns in MDAnalysisInferrer._rebuild_conjugated_bonds to exclude carboxylate anions [O-]-C(=O) ([!$([O-][#6]=O);*-{1-2}]) from being matched as unstandardized conjugated systems. This eliminates infinite ping-pong double bond oscillations between carboxylate oxygens that previously hit max_iter=200 with UserWarning: The standardization could not be completed within a reasonable number of iterations.
  • Guard reorder_atoms in MDAnalysisInferrer.__call__ so that it only runs when the molecule was converted from an AtomGroup with _MDAnalysis_index, preventing 1800+ spurious warning spams (UserWarning: '_MDAnalysis_index' not available on the input mol atoms, skipping reordering of atoms.) when inferring generic RDKit molecules.
  • Add regression tests in testsuite/MDAnalysisTests/converters/test_rdkit.py covering carboxylates (CC(=O)[O-], c1ccccc1C(=O)[O-], NC(CC(=O)[O-])C(=O)[O-], [O-]C(=O)c1ccccc1C(=O)[O-], [O-]C(=O)/C=C/c1ccccc1, [O-]C(=O)/C=C/C(=O)[O-]) and asserting that generic molecules can be inferred without missing index warnings.
  • Update package/AUTHORS and package/CHANGELOG.

LLM / AI generated code disclosure

LLMs or other AI-powered tools (beyond simple IDE use cases) were used in this contribution: yes

  • An LLM was used to assist in identifying and verifying the SMARTS pattern exclusions for carboxylates and generating test cases. All code and test suites were locally reviewed, compiled, and verified against MDAnalysis tests.

PR Checklist

  • Issue raised/referenced?
  • Tests updated/added?
  • Documentation updated/added?
  • package/CHANGELOG file updated?
  • Is your name in package/AUTHORS? (If it is not, add it!)
  • I have read and understand the current AI Policy
  • LLM/AI disclosure was updated.

Developers Certificate of Origin

I certify that I can submit this code contribution as described in the Developer Certificate of Origin, under the MDAnalysis LICENSE.

…er (MDAnalysis#3996)

- Update SMARTS patterns in `_rebuild_conjugated_bonds` to exclude carboxylate
  anions `[O-]-C(=O)` from being matched as unstandardized conjugated systems.
  This resolves infinite ping-pong double bond oscillations between carboxylate
  oxygens that reached `max_iter=200` with UserWarning.
- Guard `reorder_atoms` in `MDAnalysisInferrer.__call__` so that it only runs
  when the molecule was converted from an AtomGroup with `_MDAnalysis_index`,
  preventing spurious warning spam when inferring generic molecules.
- Add regression tests covering acetate, benzoate, aspartate, phthalate,
  cinnamate, and fumarate, and verify that inferring generic molecules emits
  no missing property warnings.

Fixes MDAnalysis#3996

Signed-off-by: Maneet Gupta <131141424+RK-NerdyBirdy@users.noreply.github.com>
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 MDAnalysis | 🛠️ Build #35893443 | 📁 Comparing a7f6d09 against latest (951f305)

  🔍 Preview build  

3 files changed
± index.html
± documentation_pages/analysis/wbridge_analysis.html
± _modules/MDAnalysis/converters/RDKitInferring.html

@codecov

codecov Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.93%. Comparing base (951f305) to head (a7f6d09).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #5550   +/-   ##
========================================
  Coverage    93.93%   93.93%           
========================================
  Files          184      184           
  Lines        22675    22676    +1     
  Branches      3227     3228    +1     
========================================
+ Hits         21300    21301    +1     
  Misses         915      915           
  Partials       460      460           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@RK-NerdyBirdy
RK-NerdyBirdy deleted the fix/issue-3996-rdkit-carboxylate-exclude branch November 14, 2026 16:50
@RK-NerdyBirdy
RK-NerdyBirdy restored the fix/issue-3996-rdkit-carboxylate-exclude branch November 14, 2026 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RDKitConverter improvements

1 participant