Skip to content

Add test for DMSReader convert_pos_from_native with non-zero unit cell - #5307

Open
xovishnukosuri wants to merge 2 commits into
MDAnalysis:developfrom
xovishnukosuri:dms-convert-pos-test
Open

xovishnukosuri wants to merge 2 commits into
MDAnalysis:developfrom
xovishnukosuri:dms-convert-pos-test

Conversation

@xovishnukosuri

@xovishnukosuri xovishnukosuri commented Mar 14, 2026

Copy link
Copy Markdown

Summary

Closes #3304.

The existing TestDMSReader only loads adk_closed.dms, which has all-zero global_cell vectors. triclinic_box converts those to a zero array, Timestep.dimensions setter treats that as None, so the branch at DMS.py:115 (if self.ts.dimensions is not None: convert_pos_from_native(ts.dimensions[:3])) was never reached by any test.

This PR adds TestDMSReaderWithBox which:

  • builds a minimal DMS SQLite file in tmp_path with a real 30x40x50 Angstrom orthorhombic box
  • asserts ts.dimensions is not None
  • checks the parsed dimension values
  • checks that atom coordinates are read correctly when a box is present

Test plan

  • python -m pytest testsuite/MDAnalysisTests/coordinates/test_dms.py -v — 12 passed
  • python -m pytest testsuite/MDAnalysisTests/topology/test_dms.py -v — 22 passed

🤖 Generated with Claude Code


📚 Documentation preview 📚: https://mdanalysis--5307.org.readthedocs.build/en/5307/

Vishnu Kosuri and others added 2 commits March 14, 2026 12:18
…step

Closes MDAnalysis#5127. The elif branch in DumpReader._read_next_timestep that
raises ValueError when a specific coordinate convention is requested
but not present in the file had no test coverage. Add
test_missing_convention_in_timestep which uses LAMMPSDUMP (scaled
coords only) with lammps_coordinate_convention="unscaled" to trigger
the error.
The existing test only uses a DMS file with all-zero cell vectors, so
ts.dimensions ends up None and the convert_pos_from_native branch for
dimensions was never exercised. Add TestDMSReaderWithBox which builds a
minimal DMS SQLite file in tmp_path with a real orthorhombic box and
checks that dimensions are read and not None.

Closes MDAnalysis#3304

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov

codecov Bot commented Mar 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.84%. Comparing base (50dc512) to head (0e215c0).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #5307      +/-   ##
===========================================
+ Coverage    93.82%   93.84%   +0.01%     
===========================================
  Files          182      182              
  Lines        22487    22487              
  Branches      3196     3196              
===========================================
+ Hits         21099    21102       +3     
+ Misses         925      923       -2     
+ Partials       463      462       -1     

☔ View full report in Codecov by Sentry.
📢 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.

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.

DMSReader: convert_pos_from_native coverage

1 participant