Skip to content
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

Cat fixes - vdw radicals, bidentates, resonance #2136

Merged
merged 9 commits into from
Jun 5, 2021
Merged

Cat fixes - vdw radicals, bidentates, resonance #2136

merged 9 commits into from
Jun 5, 2021

Conversation

davidfarinajr
Copy link
Contributor

@davidfarinajr davidfarinajr commented May 21, 2021

Motivation or Problem and Description of Changes

  1. vdw radicals - We previously implemented a multiplicity check to ensure products in the reverse direction match the multiplicity of the template reactants . However, we are getting vdw products that do not obey multiplicity restriction in the forward direction (Undeterminable Kinetics Error of Surface_Abstraction_vdW family #2122) , so we also need to check this direction as well.

  2. radicals on X - if resonance generation puts radicals/lone pairs/or a formal charge on X, RMG crashes. I added a commit on this PR to filter out these structures

  3. bidentate vdw - We were getting bidentate vdw structures. This PR makes them forbidden for surface families

Testing

added unit test for forbidden vdw bidentates and successfully built an ammonia cat oxidation model that was previously crashing.

@codecov
Copy link

codecov bot commented May 21, 2021

Codecov Report

Merging #2136 (08c6343) into master (e414514) will decrease coverage by 0.00%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2136      +/-   ##
==========================================
- Coverage   47.24%   47.23%   -0.01%     
==========================================
  Files          89       89              
  Lines       24151    24169      +18     
  Branches     6302     6309       +7     
==========================================
+ Hits        11409    11417       +8     
- Misses      11531    11539       +8     
- Partials     1211     1213       +2     
Impacted Files Coverage Δ
rmgpy/data/kinetics/family.py 47.27% <50.00%> (-0.02%) ⬇️

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 e414514...08c6343. Read the comment docs.

Copy link
Contributor

@mazeau mazeau left a comment

Choose a reason for hiding this comment

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

I think everything here looks fine. There definitely shouldn't be any bidentate things matching with vdw families.

I don't think the best thing to do is to trash species after we generate charges/radicals/lone pairs on surface sites, but to prevent rmg from suggesting them in the first place.

@davidfarinajr
Copy link
Contributor Author

I think everything here looks fine. There definitely shouldn't be any bidentate things matching with vdw families.

I don't think the best thing to do is to trash species after we generate charges/radicals/lone pairs on surface sites, but to prevent rmg from suggesting them in the first place.

Yes, I agree. The fix on this PR is a band-aid to prevent RMG from crashing, and we should avoid generating these types of structures in the first place. I think the filter on this PR is a sensible solution until we figure out how we want to generate resonance structs for adsorbates

mazeau
mazeau previously approved these changes May 22, 2021
Copy link
Contributor

@mazeau mazeau left a comment

Choose a reason for hiding this comment

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

I think everything here looks fine. There definitely shouldn't be any bidentate things matching with vdw families.
I don't think the best thing to do is to trash species after we generate charges/radicals/lone pairs on surface sites, but to prevent rmg from suggesting them in the first place.

Yes, I agree. The fix on this PR is a band-aid to prevent RMG from crashing, and we should avoid generating these types of structures in the first place. I think the filter on this PR is a sensible solution until we figure out how we want to generate resonance structs for adsorbates

Yes, sorry, I forgot to change the bubble from comment to approve!

Copy link
Contributor

@ChrisBNEU ChrisBNEU left a comment

Choose a reason for hiding this comment

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

This looks good, I agree with you and emily that this is a band-aid but hopefully when we have our surface resonance meetup with franklin we can revisit this. I tried it with an NO2/O2 on pt111 input file just to make sure it wouldn't give any errors. I had two concerns but other wise it looks ok

  1. the commented out logging in resonance.py (see my other comment)
  2. should we update the resonanceTest so we capture what we are doing for charged gas/surface and radical surface species?

@davidfarinajr
Copy link
Contributor Author

  1. should we update the resonanceTest so we capture what we are doing for charged gas/surface and radical surface species?

Yes, we should add unit test that makes resonance structs with radicals on X and make sure we filter them out (with this PR). We may have to change the test once we overhaul resonance generation for adsorbates, but that's ok. It could actually help to make sure future changes don't break this.

Tingchenlee
Tingchenlee previously approved these changes May 26, 2021
Copy link
Contributor

@Tingchenlee Tingchenlee left a comment

Choose a reason for hiding this comment

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

This looks good to me, thanks for the fixes!

@rwest
Copy link
Member

rwest commented May 26, 2021

There was a comment up thread that a unit test should be added. Are we waiting for that before merging, or has it been done and I missed it?

@davidfarinajr
Copy link
Contributor Author

There was a comment up thread that a unit test should be added. Are we waiting for that before merging, or has it been done and I missed it?

I still need to add that unit test before merging. I also might get rid of the logging or change it to debug because it looks ugly in the RMG log files.

I'm also not completely satisfied with the way the filter works (makes bad structs then removes them). I can prevent them from being made, but I am not sure if that is a better long term solution since we may drastically change how resonance generation works for adsorbates 🤔

@davidfarinajr davidfarinajr dismissed stale reviews from Tingchenlee and mazeau via 3c7a484 May 26, 2021 17:33
ChrisBNEU
ChrisBNEU previously approved these changes May 26, 2021
@davidfarinajr
Copy link
Contributor Author

There was a comment up thread that a unit test should be added. Are we waiting for that before merging, or has it been done and I missed it?

I still need to add that unit test before merging. I also might get rid of the logging or change it to debug because it looks ugly in the RMG log files.

I'm also not completely satisfied with the way the filter works (makes bad structs then removes them). I can prevent them from being made, but I am not sure if that is a better long term solution since we may drastically change how resonance generation works for adsorbates 🤔

I added the unit test. I think the resonance fix on this PR is ok since it fixes a bug, but we should revisit resonance for adsorbates in the future.

@davidfarinajr
Copy link
Contributor Author

rmgpy.exceptions.ChemkinError: 
Unexpected species identifier Estimated encountered in flux pairs for 
reaction H(6) + C2H4(10) <=> C2H5(5).

getting strange chemkin error in integration tests 🤔

@rwest
Copy link
Member

rwest commented Jun 4, 2021

I saw that. I think this commit just got merged via #2139 a couple hours ago - maybe even during the middle of running the tests. Let's rebase yet again and see if the problem goes away?

do not generate resonance for charges species, ensure input charge equals output charge, and discard adsorbates with radicals, lone pairs or charges on `X`
Copy link
Member

@rwest rwest left a comment

Choose a reason for hiding this comment

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

I requested you check one thing (atom label swaps), and chris had a comment (about logging stuff)) that's not been resolved yet. Otherwise looks good to me. So, very nearly ready to merge.

rmgpy/data/kinetics/family.py Show resolved Hide resolved
davidfarinajr and others added 3 commits June 4, 2021 17:39
One of the places where reactions
that are their own reverse need to be
hard-coded into RMG-Py
`Surface_Abstraction_Single_vdW` is generating products in the forward direction that violate the multiplcity of the template products
@davidfarinajr
Copy link
Contributor Author

I requested you check one thing (atom label swaps), and chris had a comment (about logging stuff)) that's not been resolved yet. Otherwise looks good to me. So, very nearly ready to merge.

Thanks for the review Richard. Your label swaps for surface_abstraction_single_vdw are correct, so I removed it from my commit and cherrypicked yours onto this PR. The logging is not needed for resonance in my opinion, and is better left commented out.

Doing it this way, the string formatting is not evaluated if you aren't 
actually going to log the debug statements (usually the case, as we normally
don't run in verbose mode). Should be marginally quicker.
@rwest
Copy link
Member

rwest commented Jun 5, 2021

This was meant to be catalysis fixes, and yet the regression tests are showing a change in a gas phase molecule's thermo:

Non-identical thermo!
original:	O1[C]=N1
tested:	O1[C]=N1
Hf(300K)  |S(300K)   |Cp(300K)  |Cp(400K)  |Cp(500K)  |Cp(600K)  |Cp(800K)  |Cp(1000K) |Cp(1500K) 
    116.46|     53.90|     11.62|     12.71|     13.49|     13.96|     14.14|     13.85|     13.58
    141.64|     58.66|     12.26|     12.27|     12.09|     11.96|     12.26|     12.72|     12.15
thermo: Thermo group additivity estimation: group(O2s-CdN3d) + group(N3d-OCd) + group(Cd-HN3dO) + ring(Cyclopropene) + radical(CdJ-NdO)
thermo: Thermo group additivity estimation: group(O2s-CdN3d) + group(N3d-OCd) + group(Cd-HN3dO) + ring(oxirene) + radical(CdJ-NdO)

is this a false alarm? Could we have somehow changed from ring(Cyclopropene) to ring(oxirene) by tweaking a resonance algorithm, or is this a prior non-deterministic bug in RMG and we got unlucky?

Looking at the code diff again, I can't think of anything that would cause this change. So maybe it's random?

...and so I check the issue tracker and sure enough: #2010

So, I'm satisfied it's not our fault, and am approving this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants