-
-
Notifications
You must be signed in to change notification settings - Fork 349
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
Update three body logic #1338
Update three body logic #1338
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1338 +/- ##
==========================================
+ Coverage 67.93% 68.03% +0.10%
==========================================
Files 316 327 +11
Lines 41948 42652 +704
Branches 16853 17180 +327
==========================================
+ Hits 28498 29020 +522
- Misses 11186 11345 +159
- Partials 2264 2287 +23
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
f541972
to
275a569
Compare
I believe this is ready for a review. |
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 have one very minor suggestion, which may not be an improvement. I also wonder if you can clarify, in the docstring and the error message, what "ambiguous" means in this context. What should the user do to correct this problem?
@bryanwweber ... thanks! I updated the comments and error messages. Let me know if this clarifies things sufficiently. |
PS: the only question I have is about another edge case. At the moment, the logic requires either three reactants or three products to detect a three-body reaction and thus misses the following
... it is certainly perceivable that this should be a
PPS: regardless, serialization works and I'd rather not introduce another set of cases where duplicates are created where there weren't any before. |
I think this is finally ready. At this point I believe that unit tests cover everything I can think of - once this is merged, we should be good to bump the alpha version with #1337 |
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 working on these refinements, @ischoegl.
Beside the suggestions below, I was thinking that we should probably limit the use of the efficiencies
and default-efficiency
fields to the case where third body is M
, to avoid allowing the rather confusing example below:
equation: H + O2 + N2 = HO2 + N2
rate-constant: {A: 1, b: 1, Ea: 200}
efficiencies: {N2: 10.0}
default-efficiency: 1
which is currently allowed and seems to be equivalent to writing the same reaction with M
as the third body.
@speth ... thanks for the review! I adopted recommendations and tweaked the logic so that your example throws the following error:
(it does make sense that the default efficiency has to be zero in this case). On the other hand, I'd like to keep the ability to change the efficiency for equation: CH2 + O2 <=> CH2 + O2
rate-constant: {A: 5.0e+9, b: 0.0, Ea: 0.0}
efficiencies: {O2: 1.} I.e. this is handled as a three-body reaction, where the user specifies which of the two participating species is treated as a third body. (As an aside: I realize that the reaction makes little sense; I had originally blocked those but the feedback was that these reactions should be allowed.) |
8bebace
to
f59b6e3
Compare
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, @ischoegl. This looks good to me.
Changes proposed in this pull request
If applicable, provide an example illustrating new features this pull request is introducing
plus several edge cases where three-body reactions are explicitly or implicitly defined, e.g.
or
Checklist
scons build
&scons test
) and unit tests address code coverage