-
Notifications
You must be signed in to change notification settings - Fork 250
Add carbene species constraint #1187
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1187 +/- ##
==========================================
+ Coverage 46.44% 46.52% +0.07%
==========================================
Files 152 152
Lines 27538 27553 +15
Branches 5410 5416 +6
==========================================
+ Hits 12789 12818 +29
+ Misses 13868 13860 -8
+ Partials 881 875 -6
Continue to review full report at Codecov.
|
7bb2cf9 to
4bfb0ad
Compare
|
ReactionMechanismGenerator/RMG-database@2e18d62 should be reverted along with this pull request. |
|
Side note (not necessarily need to be done in this PR): |
| self.assertEqual(mol.getRadicalCount(), 2) | ||
| self.assertEqual(mol.getSingletCarbeneCount(), 0) | ||
|
|
||
| def testSingletCarbon(self): |
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.
the test examples need a bit more complicated. Ideally test example should come from ReactionMechanismGenerator/RMG-database@2e18d62 since you are trying to replace it. Please pick some representatives from there.
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.
What do you mean by more complicated? A molecule with 2 carbenes?
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.
You are trying to replace the 18 forbidden groups with this PR. So I think the sample molecules from the 18 groups should be tested and more representative.
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 don't think that's necessary. First of all, these tests are just for getSingletCarbeneCount(), which counts the number of carbene carbons in a molecule. I don't think the test molecules here need to be more complicated to test that RMG can count properly.
I also wrote tests for the actual species constraint module, to make sure that it catches what we expect it to catch. There I tested sample molecules with carbenes/radicals on adjacent carbons. Since the 18 forbidden groups were just trying to ban carbenes/radicals on the same molecule, I think this should be sufficient. Adding more carbons won't change the effect of the test.
| # maximum number of singlet carbenes (lone pair on a carbon atom) in a molecule | ||
| maximumSingletCarbenes=1, | ||
| # maximum number of radicals on a molecule with a singlet carbene | ||
| # should be lower than maximumRadicalElectrons in order to have an effect |
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.
change "lower" to "lower or equal"
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.
If it's equal, then it still won't have any effect, since it will enforce the same limitation as maximumRadicalElectrons, which returns first.
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.
what I'm trying to say is that it's confusing to have comment written as "lower than" but you have example with "equal"
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'll change the value to 0 then.
|
Review comments on things to be done before merging:
|
|
A pull request has been made for reverting the forbidden group additions to RMG-database. The RMG-tests build for that branch is up, but still fails to complete the second example, presumably because the benchmark version (with the forbidden groups) is taking to long to finish. The only job to finish (eg1) took about half as long after removing the forbidden groups, as expected. It also had many additional species and reactions, which this PR should remove. |
89cf472 to
bd4a9fd
Compare
|
The code looks good now. Can you run a local RMG-tests with testing version being |
|
Here are the RMG-tests results.
There were fewer speices and reactions for eg1 in the testing version, mostly due to additional carbenes which were caught by the species constraints. The test suite stopped at eg7 due to [CH] from GRI-Mech3.0 being forbidden by the species constraints. Because of the way the |
|
After talking with @zjburas, I think we should just add the |
|
Thanks for the update on RMG-tests. Will fix them soon. In terms of next step for this PR, please git rebase and squash accordingly. |
Counts the number of carbon atoms with a lone pair
Limit the number of radicals in a molecule which has a carbene
No content changes
Remove maximumHydrogenAtoms since it's not actually implemented. Change the values for the species constraints in the example code to more reasonable values in case users use it directly.
bb2e2c9 to
09ef13c
Compare
|
Looks good to me now. I'm going to merge ReactionMechanismGenerator/RMG-database#211 and this one soon. |
Note added by rwest: This is for the benefit of halocarbon / PFAS chemistry. Perhaps we should just set the carbene radical count in those input files and leave the default here at 0. (but with better documentation.)
Adds two new species constraint options:
maxSingletCarbenes: limits the number of carbon atoms with lone pairs in a moleculemaxCarbeneRadicals: limits the number of unpaired electrons a molecule with a carbene can haveThis eliminates the need for the global forbidden groups added in ReactionMechanismGenerator/RMG-database@2e18d62, and addresses the speed concerns raised in #1079. Since the intention of the forbidden groups was to prevent molecules with 2 carbenes or 1 carbene and 1 radical from being formed, using species constraints provides a more robust filter than the forbidden groups.
Note: I set the default for
maxSingletCarbenesto 1 and the default formaxCarbeneRadicalsto 0, which makes them the only species constraints with a default value. The reasoning is that this accomplishes the same thing as having the forbidden groups without any extra input from the user. Any thoughts on whether or not this is a good idea would be appreciated.The following table compares results of eg1 for different RMG-database versions on current master of RMG-Py (f3550f4), with the last column being on this branch of RMG-Py.
Conclusions which can be drawn from these results: