-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reverse recipes should be in reverse order #1829
Conversation
rmgpy/data/kinetics/family.py
Outdated
@@ -258,6 +258,7 @@ def get_reverse(self): | |||
other.add_action(['GAIN_PAIR', action[1], action[2]]) | |||
elif action[0] == 'GAIN_PAIR': | |||
other.add_action(['LOSE_PAIR', action[1], action[2]]) | |||
other.actions = reversed(other.actions) # Play the reverse recipe in the reverse order |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reversed
returns an iterator. Do we expect any issues with that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't think that would cause any issues. I'm able to run it perfectly fine. Maybe @rwest feels differently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hard to anticipate, but might as well try other.actions = list(reversed(other.actions))
.
Then should (rebase and) look into why the unit tests failed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I have a better suggestion: use reversed directly on the for loop, for action in reversed(self.actions)
The failing unit tests are all related to reaction generation:
I don't have any intuition for why this change would have these effects, so you would need to do some debugging. |
Codecov Report
@@ Coverage Diff @@
## master #1829 +/- ##
==========================================
- Coverage 43.98% 42.89% -1.09%
==========================================
Files 83 83
Lines 21581 21565 -16
Branches 5653 5652 -1
==========================================
- Hits 9492 9251 -241
- Misses 11043 11290 +247
+ Partials 1046 1024 -22
Continue to review full report at Codecov.
|
Recipes that decrement THEN break a bond, when reversed must create THEN increment the bond, not increment then create. i.e. the recipe steps must be played backwards in order. reversing the loop, suggested by mliu49.
I can't imagine why this change would cause a
that was showing up in Travis, so I've triggered a new travis build, in case it's something weird or random. |
It seems that a lot of new builds are failing due to that. It's discussed somewhat in #1682, but we were not able to reach a conclusion. It is possible that this new wave of failures is caused by a new version of some dependency, but the idea that math could change (by 0.1!) is quite odd. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution!
This is a duplicate of PR #1827, but only contains the relevant commits.
I found that when generating reverse templates, the action list would go in the same order as the forward, and this would cause issues when making and breaking multiple bonds.
This change fixes this template's reverse recipe.