Skip to content

fixes #3307#3356

Merged
richardjgowers merged 2 commits intodevelopfrom
TRZ_fixes
Jun 25, 2021
Merged

fixes #3307#3356
richardjgowers merged 2 commits intodevelopfrom
TRZ_fixes

Conversation

@richardjgowers
Copy link
Member

writing a trz file with dimensions=None issues a warning

Fixes #3307

Changes made in this Pull Request:

PR Checklist

  • Tests?
  • Docs?
  • CHANGELOG updated?
  • Issue raised/referenced?

writing a trz file with dimensions=None issues a warning
Copy link
Member

@IAlibay IAlibay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, just the one comment [I know it's a near-zero use reader/writer, but we should really read the same way we write]

if ts.dimensions is not None:
unitcell = triclinic_vectors(ts.dimensions).reshape(9)
else:
warnings.warn("Timestep didn't have dimensions information, "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably should have self-consistency here, if None == np.zeros(6), then np.allclose(box, np.zeros(6)) should read in as None ? (my understanding is that currently it just sets a zero sized unitcell?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a test for this, it's already implemented like this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad I forgot about :

if (self._unitcell[:3] == 0).all():

Side note - shouldn't that be an allclose [if we're comparing floats] ?

Copy link
Member

@IAlibay IAlibay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll approve - the only thing I'll leave up to you is whether you want to document the behaviour somewhere, maybe an entry in the class notes?

[I'm not going to request changes for it since it's a very low use class]

@richardjgowers
Copy link
Member Author

richardjgowers commented Jun 21, 2021 via email

@codecov
Copy link

codecov bot commented Jun 21, 2021

Codecov Report

Merging #3356 (9fef9a6) into develop (a6d4ffc) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #3356   +/-   ##
========================================
  Coverage    93.62%   93.62%           
========================================
  Files          176      176           
  Lines        22837    22838    +1     
  Branches      3225     3225           
========================================
+ Hits         21380    21381    +1     
  Misses        1406     1406           
  Partials        51       51           
Impacted Files Coverage Δ
package/MDAnalysis/coordinates/TRZ.py 89.05% <100.00%> (+0.04%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a6d4ffc...9fef9a6. Read the comment docs.

@richardjgowers richardjgowers merged commit e4c7673 into develop Jun 25, 2021
@IAlibay IAlibay deleted the TRZ_fixes branch May 29, 2022 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document TRZ writer behaviour when dimensions is None

2 participants