Repository navigation
Conversation
Topology.setPeriodicBoxVectors checked only the first element's type, so a NumPy object array whose elements are Quantities was stored unnormalized. PDBFile's CRYST1 record then formatted bare Quantities as edge lengths and raised TypeError. Collapse such inputs into a single Quantity over a plain numeric matrix before the existing validation. Fixes openmm#3265.
barlowa124
marked this pull request as ready for review
October 5, 2026 16:17
Member
|
The new test case is failing on CI: |
Contributor
Author
|
Fixed in 83385bb. The new test was passing plain lists to |
Member
|
Thanks, builds are running now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The check only looked at the first element, nested Quantity arrays skipped normalization.
The section below was generated with AI assistance (Devin) and checked locally before submission.
Fixes #3265.
Topology.setPeriodicBoxVectorschecked only whether the first element was aQuantity, so a NumPy object array whose elements are allQuantityobjects was stored unnormalized.PDBFile.writeFilethen formatted bareQuantityobjects as CRYST1 edge lengths and raisedTypeErrorfromQuantity.__float__.The setter now recognizes a nested sequence of
Quantitiesand collapses it into a singleQuantitywrapping a numeric matrix before the existing validation and storage. Plain numeric sequences and properQuantityinputs are handled exactly as before.Added
test_BoxVectorsArrayOfQuantitiestoTestPdbFile.py, which builds the issue's box-vector shape and asserts the CRYST1 edge lengths after aPDBFile.writeFileround trip. The new test raises the reportedTypeErroron the unfixed code and passes with the change.The issue's reproduction script now writes a correct CRYST1 record, and neighboring input forms behave as before (proper
Quantityinput, plain numeric list, invalid reduced-form input still raisingValueError). The full Python test suite was not run since a local Python-wrapper build was not available.