Skip to content

BUG: combine cmaps when merging Universes (Issue #3672)#5415

Merged
orbeckst merged 1 commit into
MDAnalysis:developfrom
apoorva-01:bugfix/3672-cmaps-merge
Jul 12, 2026
Merged

BUG: combine cmaps when merging Universes (Issue #3672)#5415
orbeckst merged 1 commit into
MDAnalysis:developfrom
apoorva-01:bugfix/3672-cmaps-merge

Conversation

@apoorva-01

@apoorva-01 apoorva-01 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Fixes #3672

Changes made in this Pull Request:
Merge() remaps the connection attributes (bonds, angles, dihedrals, impropers) onto the merged Universe and concatenates everything else as a plain array. cmaps is a connection attribute too, but it wasn't in that set, so merging a Universe that carries cmaps raised TypeError: Encountered unexpected topology attribute of type ...TopologyGroup. This adds cmaps to the set so it's combined the same way as the others, with a regression test that fails without the change.

UreyBradleys is another _Connection missing from that set, so it has the same latent bug. I kept this PR to just cmaps, but I'm happy to generalise it (derive the set from the _Connection subclasses) or do a follow-up if you'd rather.

LLM / AI generated code disclosure

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

PR Checklist

  • Issue raised/referenced?
  • Tests updated/added?
  • Documentation updated/added? (bug fix, no API change)
  • package/CHANGELOG file updated?
  • Is your name in package/AUTHORS?
  • 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.

Merge() only remapped bonds/angles/dihedrals/impropers, so a Universe
carrying cmaps fell through to the plain-array path and raised a TypeError.
Add cmaps to that set so it's merged like the other connection groups.
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.85%. Comparing base (32b7808) to head (94ac5b6).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #5415   +/-   ##
========================================
  Coverage    93.85%   93.85%           
========================================
  Files          182      182           
  Lines        22509    22509           
  Branches      3202     3202           
========================================
  Hits         21125    21125           
  Misses         922      922           
  Partials       462      462           

☔ 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.

@orbeckst orbeckst left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code and tests look good.

Can you please check the formatting? The linter seems unhappy. Once that passes, I'm happy to merge.

The read the docs failure is not due to your PR.

@orbeckst

Copy link
Copy Markdown
Member

UreyBradleys is another _Connection missing from that set, so it has the same latent bug. I kept this PR to just cmaps, but I'm happy to generalise it (derive the set from the _Connection subclasses) or do a follow-up if you'd rather.

Can you please raise an issue for UB's? Then make a separate PR addressing that issue separately. Thanks!

@orbeckst orbeckst self-assigned this Jul 11, 2026

@orbeckst orbeckst left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The linter issue is not due to this PR (I am fixing it elsewhere, eg see PR #5425 ).

Thank you for your contribution!

@orbeckst
orbeckst merged commit a26df04 into MDAnalysis:develop Jul 12, 2026
23 of 25 checks passed
@orbeckst

Copy link
Copy Markdown
Member

Your first contribution has been merged @apoorva-01 🎉 ! Thank you!

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.

cmaps are not correctly merged with Merge()

2 participants