Add kwarg to index TPRParser from 0 or 1#3152
Conversation
|
Hello @lilyminium! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2021-03-14 17:05:53 UTC |
Codecov Report
@@ Coverage Diff @@
## develop #3152 +/- ##
========================================
Coverage 92.68% 92.68%
========================================
Files 168 168
Lines 22677 22679 +2
Branches 3212 3213 +1
========================================
+ Hits 21018 21020 +2
Misses 1611 1611
Partials 48 48
Continue to review full report at Codecov.
|
jbarnoud
left a comment
There was a problem hiding this comment.
Looks good to me. I am not sure the deprecation message is very clear, though. I would phrase the message to say that from version 2.0, resid will start at 1 rather than 0.
jbarnoud
left a comment
There was a problem hiding this comment.
I just realized it is missing an entry in the changelog and a "versionchanged".
orbeckst
left a comment
There was a problem hiding this comment.
Thank you! I was first confused by the PR description but then saw that this is one against develop.
I have minor improvements and one bigger discussion point regarding the default value inside the low-level TPR reader code.
|
|
||
|
|
||
| def do_mtop(data, fver): | ||
| def do_mtop(data, fver, tpr_resid_from_one=True): |
There was a problem hiding this comment.
I feel the default should remain False because that is what the TPR actually contains. IMHO the TPR functions themselves could/should stay as faithful to the original format as possible. Assume someone wrote their own TPR parser with our functions. With the new default you break their code needlessly, with the old defaults nothing changes and our own parser just makes the well-documented choice to index from 1.
There was a problem hiding this comment.
I can be convinced otherwise (ie to let default True stand) but wanted to discuss this point first before approving.
There was a problem hiding this comment.
Others may want to chime in (maybe the most knowledgeable, @jbarnoud) but I agree with your argument.
There was a problem hiding this comment.
I am going to approve because it looks sensible from my point but let @jbarnoud also say something before merging.
There was a problem hiding this comment.
TPR indeed index from 0, but it is a bit moot because you do not read a TPR directly. Instead, you end up reading your gro and ITP files to make sense of your TPR so consistency there seems the right thing to do.
There was a problem hiding this comment.
My previous objection was that it would break the existing code, but the deprecation in 1.1.0 should be enough.
|
@lilyminium the issue description is not correct, is it?
This PR (against develop) does change the default indexing to 1-based. |
|
Note that anything referring to 1.0.2 should become 1.1.0 (see comment on #3153 ). |
Co-authored-by: Oliver Beckstein <orbeckst@gmail.com>
|
@jbarnoud any last comments? Otherwise I'll merge tomorrow. |
- Fixes #2364 - Master version of #3152. - Changes made in this Pull Request: - Add `tpr_resid_from_one` keyword to TPRParser - Set default to `False`, keeping current status quo - Emits a warning for `tpr_resid_from_one=False` indicating that default behaviour will change in 2.0 - add tests - update CHANGELOG
* add kwarg * change default to True for 2.0 * fix tests to index resids from 0 again * Update package/CHANGELOG Co-authored-by: Oliver Beckstein <orbeckst@gmail.com> * change default arg for TPR utilities and remove warnings * updated to 1.1.0 Co-authored-by: Oliver Beckstein <orbeckst@gmail.com>
Fixes #2364
Changes made in this Pull Request:
This is easily undoable. I read the discussion in #2364 as supporting both including a kwarg and a warning. If that is not consensus, please let me know. I'll update CHANGELOG once we have this nailed down :-)PR Checklist