Skip to content

ENH: add subselection keyword argument to AlignTraj (Issue #5380) - #5464

Open
AkshitBoora wants to merge 1 commit into
MDAnalysis:developfrom
AkshitBoora:issue-5380-align-subselection-docs
Open

ENH: add subselection keyword argument to AlignTraj (Issue #5380)#5464
AkshitBoora wants to merge 1 commit into
MDAnalysis:developfrom
AkshitBoora:issue-5380-align-subselection-docs

Conversation

@AkshitBoora

@AkshitBoora AkshitBoora commented Aug 20, 2026

Copy link
Copy Markdown

Fixes #5380

Changes made in this Pull Request:

  • Added a subselection keyword argument to AlignTraj.__init__ that accepts
    a selection string or AtomGroup. When provided, only the selected atoms are
    written to the output trajectory, enabling a performance/memory trade-off
    while the superposition/RMSD fit is still computed using the atoms defined by
    select. Raises TypeError for invalid types.
  • Added a new guide "Performance and memory trade-offs when aligning
    sub-systems"
    to the MDAnalysis.analysis.align module docstring,
    demonstrating three usage patterns: fit-only selection, subselection output,
    and in-memory alignment.
  • Added 4 unit tests covering string subselection, AtomGroup subselection,
    in-memory subselection, and invalid type handling.

LLM / AI generated code disclosure

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

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.

Add a new 'subselection' keyword argument to AlignTraj.__init__ that
accepts a selection string or AtomGroup. When provided, only those atoms
are written to the output trajectory (enabling a performance/memory
trade-off), while the superposition/RMSD fit is still computed using the
atoms defined by 'select'.

Also add a module-level guide in MDAnalysis.analysis.align documenting
three usage patterns for aligning sub-systems with different memory
characteristics.

Changes:
- package/MDAnalysis/analysis/align.py: add subselection param + docs
- testsuite/MDAnalysisTests/analysis/test_align.py: 4 new unit tests
- package/CHANGELOG: Enhancements + Documentation entries
- package/AUTHORS: add Akshit Boora

Closes MDAnalysis#5380
@read-the-docs-community

Copy link
Copy Markdown

@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.88%. Comparing base (c882e5c) to head (c884ebc).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #5464   +/-   ##
========================================
  Coverage    93.87%   93.88%           
========================================
  Files          182      182           
  Lines        22522    22530    +8     
  Branches      3206     3208    +2     
========================================
+ Hits         21143    21152    +9     
+ Misses         917      916    -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.

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

@AkshitBoora you declared "yes" to the use of AI generated code. Given that our AI policy does not generally allow for AI generated code, please tell us how AI tools were used in this contribution.

@AkshitBoora

Copy link
Copy Markdown
Author

@AkshitBoora you declared "yes" to the use of AI generated code. Given that our AI policy does not generally allow for AI generated code, please tell us how AI tools were used in this contribution.

Hi @IAlibay, I have used AI for understanding the codebase and the issue. All the code was generated by me. Since I have used AI for understanding the codebase that's why I have declared "Yes".
Sorry for misunderstanding , I will change the usage of AI from "Yes" to "No"

@AkshitBoora
AkshitBoora requested a review from IAlibay August 21, 2026 08:30
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.

Performance vs memory tradeoff, interested in subset of a universe

2 participants