Skip to content

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

Open
apoorva-01 wants to merge 1 commit into
MDAnalysis:developfrom
apoorva-01:fix-3672-merge-cmaps
Open

BUG: combine cmaps when merging Universes (Issue #3672)#5413
apoorva-01 wants to merge 1 commit into
MDAnalysis:developfrom
apoorva-01:fix-3672-merge-cmaps

Conversation

@apoorva-01

@apoorva-01 apoorva-01 commented Jun 29, 2026

Copy link
Copy Markdown

Fixes #3672

Merge() remaps the connection attributes bonds, angles, dihedrals and impropers, but treats everything else as a plain array. cmaps is a connection attribute too, so a Universe with cmaps hit the array path and raised
TypeError: Encountered unexpected topology attribute of type ...TopologyGroup.

  • Add "cmaps" to the connection-attribute set in Merge().
  • Add a regression test (test_merge_with_cmaps) that fails without the fix.

Note: UreyBradleys is also a _Connection missing from that set (same latent bug). I kept this PR to the narrowed cmaps scope; happy to generalise (derive the set from _Connection subclasses) or do a follow-up if preferred.

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() handles the connection attributes bonds, angles, dihedrals and
impropers through a dedicated path that remaps their atom indices onto
the merged Universe; every other topology attribute is concatenated as a
plain array. cmaps is a connection attribute as well, but it was missing
from that set, so a Universe carrying cmaps fell through to the array
path and raised

    TypeError: Encountered unexpected topology attribute of type
    <class 'MDAnalysis.core.topologyobjects.TopologyGroup'>

Add cmaps to the set so it is merged the same way as the other
connection groups.

Issue MDAnalysis#3672

@IAlibay IAlibay 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.

Thanks for opening this PR. Please fill in the AI disclosure that can be found in the original PR template before we review.

@codecov

codecov Bot commented Jun 29, 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 (090b58e).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #5413   +/-   ##
========================================
  Coverage    93.85%   93.85%           
========================================
  Files          182      182           
  Lines        22509    22509           
  Branches      3202     3202           
========================================
+ Hits         21125    21126    +1     
+ Misses         922      921    -1     
  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.

@apoorva-01 apoorva-01 requested a review from IAlibay June 30, 2026 21:27
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