Skip to content

Add dtype kwarg to check_box to preserve input precision - #5471

Open
Phantom8420 wants to merge 2 commits into
MDAnalysis:developfrom
Phantom8420:fix-check-box-dtype
Open

Phantom8420 wants to merge 2 commits into
MDAnalysis:developfrom
Phantom8420:fix-check-box-dtype

Conversation

@Phantom8420

@Phantom8420 Phantom8420 commented Sep 16, 2026

Copy link
Copy Markdown

Fixes #3500

Changes made in this Pull Request:

  • check_box() accepts a new dtype keyword (default numpy.float32, so existing behavior/callers are unchanged) and passes it through to triclinic_vectors(), which already supported it.
  • Added tests covering float32/float64 output for both ortho and triclinic box types.
  • Updated CHANGELOG and AUTHORS.

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.

check_box always cast to float32 internally, which forced any triclinic
box to also come out as float32 since it just called triclinic_vectors
on the already-cast array. triclinic_vectors already accepted a dtype
kwarg, so this just plumbs the same option through check_box, keeping
float32 as the default so no existing caller changes behavior.

Fixes MDAnalysis#3500
@read-the-docs-community

read-the-docs-community Bot commented Sep 16, 2026

Copy link
Copy Markdown

Documentation build overview

📚 MDAnalysis | 🛠️ Build #34594161 | 📁 Comparing eb6407d against latest (8b8875c)

  🔍 Preview build  

4 files changed
± index.html
± documentation_pages/analysis/wbridge_analysis.html
± documentation_pages/lib/util.html
± _modules/MDAnalysis/lib/util.html

@codecov

codecov Bot commented Sep 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.86%. Comparing base (8b8875c) to head (83d05d7).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #5471      +/-   ##
===========================================
- Coverage    93.87%   93.86%   -0.02%     
===========================================
  Files          182      182              
  Lines        22522    22522              
  Branches      3206     3206              
===========================================
- Hits         21143    21140       -3     
- Misses         917      919       +2     
- Partials       462      463       +1     

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

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

We can't review until you have filled out the PR template.

@BradyAJohnston BradyAJohnston added more information needed Please reply to requests for information or the issue will be closed. AI-assisted Generated with AI/LLM assistance close? Evaluate if issue/PR is stale and can be closed. labels Sep 16, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-assisted Generated with AI/LLM assistance close? Evaluate if issue/PR is stale and can be closed. more information needed Please reply to requests for information or the issue will be closed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

check_box and triclinic_vectors don't respect dtype

2 participants