-
Notifications
You must be signed in to change notification settings - Fork 250
Added Chlorine as a new reactive element in RMG #1310
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 #1310 +/- ##
==========================================
- Coverage 43.05% 43.03% -0.02%
==========================================
Files 169 169
Lines 28342 28365 +23
Branches 5535 5538 +3
==========================================
+ Hits 12203 12208 +5
- Misses 15302 15321 +19
+ Partials 837 836 -1
Continue to review full report at Codecov.
|
and rearranged He/N2/Ar for better readability
|
@rwest , regarding @mliu49's comment above, are there any chlorine additions you'd like to add to either this PR or ReactionMechanismGenerator/RMG-database#257? Or shall we continue with these as they are? |
|
Sorry, I've not been keeping on top of this or ReactionMechanismGenerator/RMG-database#257. Here's a brief recap. Our work was done by @faribas and can be found on her
Because this forked three years ago (March 2015) it's probably hard to merge them directly, but there may be value in copying across what she did. Thermochemistry: Reactions: More details are in chapter 3 of her PhD thesis at http://hdl.handle.net/2047/D20213055 Also worth mentioning is that I have just received a grant to work on adding halogens to RMG (https://www.nsf.gov/awardsearch/showAward?AWD_ID=1751720), so would love to start a conversation about the best way to do this! It will be @skrsna working on that project, starting soon. Perhaps we can all meet. |
|
Sure @alongd , I can take a look at the -db repo. Congratulations @rwest on the grant. My immediate interest in halogen chemistry is pretty narrow: I just want to use RMG as a tool to account for chlorine side-chemistry during chlorine initiated oxidation experiments from 300-1000 K. For that purpose, what @faribas already did is probably sufficient. Hopefully we can talk sometime. |
amarkpayne
left a comment
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.
Great PR Alon! I have noted a couple of quick things that need fixing, but this PR should be ready for merging soon after these quick fixes.
The only other thing may be to add cases with chlorine to the unit tests for group.py and molecule.py, but this is probably not necessary.
| ``S6td`` sulfur atom with no lone pairs (valance 6), one triple bond, one double bond and up to one single bond | ||
| ``S6tt`` sulfur atom with no lone pairs (valance 6) and two triple bonds | ||
| ``S6tdc`` charged sulfur atom with no lone pairs (valance 6), one to two triple bonds, up to two double bonds, and up to four single bonds | ||
| =============== ============================================================================================================================================================== |
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 need to delete line 118 for the table to format properly. Otherwise, it tries to end the table early
| +----------+-------------------+------------------------------------------------------------------------------------------------------------------+ | ||
| |S6tdc |Sulfur |No lone pairs, one to two triple bonds, up to two double bonds, up to four single bonds, charged -1/-1 | | ||
| +----------+-------------------+------------------------------------------------------------------------------------------------------------------+ | ||
| |Cl1s |Chlorine |Three lone pairs, zero to one single bonds | |
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.
Should you add an entry for Cl as well?
| 'C#C': -0.64, 'C#N': -0.89, 'C-S': 0.43, 'O=S': -0.78, 'S-H': 0.0, 'C-N': -0.13, # Table IX: Petersson GA (1998) J. of Chemical Physics, DOI: 10.1063/1.477794 | ||
| 'N-H': -0.42, 'N=O': 1.11, 'N-N': -1.87, 'N=N': -1.58, 'N-O': 0.35, #Table 2: Ashcraft R (2007) J. Phys. Chem. B; DOI: 10.1021/jp073539t | ||
| 'N#N': -2.0, 'O=O': -0.2, 'H-H': 1.1, # Unknown source | ||
| 'C-C': -0.495,'C-H': -0.045,'C=C': -0.825,'C-O': 0.378,'C=O': 0.743,'O-H': -0.423, #Table2: Paraskevas, PD (2013). Chemistry-A European J., DOI: 10.1002/chem.201301381 |
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.
It looks like your editor changed some of the spacing here
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.
That was actually me, trying to make the lines a bit shorter (now with the 'C-Cl', 'C-F' additions, the second line was too long). It still functions good and it's readable, let me know if you think otherwise.
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.
Gotcha, this is fine by me then, just making sure
| self.siliconCount = 0 | ||
| self.radicalCount = 0 | ||
| for atom in self.vertices: | ||
| if len(atom.atomType) == 1: |
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.
This is outside the scope of your commit, but what should happen if len(atom.atomType) != 1?
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.
My understanding is that since it is a Group and not a Molecule, an "atom" can be defined as 1 [C,N,O] ux px cx {2,S}, in which case we can't fingerprint it and we correctly skip this condition. I think this also means we're missing out on cases like 1 [Cs,Cd] ux px cx {2,S} where we could fingerprint, but don't (for that atom in the Group). However, this should be working smoothly for Molecules.
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.
That makes sense. I wonder if there is a way to catch cases like 1 [Cs,Cd] ux px cx {2,S} and if that would be useful. If so this is something for another PR though.
| isChlorine = atomType.equivalent(chlorine) | ||
| isSilicon = atomType.equivalent(silicon) | ||
| sum_is_atom = isCarbon + isNitrogen + isOxygen + isSulfur + isChlorine + isSilicon | ||
| if sum_is_atom == 1: |
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 happens if sum_is_atom != 1? I can't imagine this happening, but maybe I am missing a subtlety here. I would think that this would either always evaluate to True (and thus it is not needed) or we need some sort of error handling if it does occur.
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 think this is related to the previous comment: an "atom" in a Group could be defined as 1 [C,N,O] ux px cx {2,S}. In this case, atomType = [C,N,O], and .equivalent will return True for more than one isAtom. In this case, sum_is_atom will be 3.
I agree that it seems unnecessary (now that I rethink it) since it's already under the if len(atom.atomType) == 1: condition discussed above. We could either keep it to keep the same functionality as before in case I'm also missing a subtlety, or remove. I'll check.
|
|
||
| cpdef bint isFluorine(self) | ||
|
|
||
| cpdef bint isSilicon(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.
Make a note in the commit that isSilicon was added to cython file as well, good catch!
rmgpy/molecule/molecule.py
Outdated
|
|
||
| def isFluorine(self): | ||
| """ | ||
| Return ``True`` if the atom represents an oxygen atom or ``False`` if |
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 doc string element name to "fluorine"
rmgpy/molecule/molecule.py
Outdated
|
|
||
| def isChlorine(self): | ||
| """ | ||
| Return ``True`` if the atom represents an sulfur atom or ``False`` if |
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.
Same here, but for "chlorine"
rmgpy/molecule/molecule.py
Outdated
|
|
||
| def isIodine(self): | ||
| """ | ||
| Return ``True`` if the atom represents an sulfur atom or ``False`` if |
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.
Same here, but for "Iodine"
rmgpy/molecule/group.py
Outdated
| carbon = atomTypes['C'] | ||
| nitrogen = atomTypes['N'] | ||
| oxygen = atomTypes['O'] | ||
| # flourine = atomTypes['F'] |
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 think we should either go ahead and add fluorine and iodine atom types in this PR, or remove this commented line until we are ready.
|
Thanks for the timely review, @amarkpayne! I addressed all comments but one in fixup commits. I'll double check the implications of removing the |
amarkpayne
left a comment
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.
Looks good! I am looking into the if sum_is_atom == 1: issue as well, though so far it appears that the unit tests do fail without this. Given this I think this PR is good to go. Go ahead and auto-squash the fixup commits, and I'll merge this in
|
I just saw your comment. I pushed an optional solution, if it won't do the trick I'll squash w/o it |
Table IX: Petersson GA (1998) J. of Chemical Physics, DOI: 10.1063/1.477794
Also added isSilicon to molecule.pxd, which eas missing
Cl1s atomType
This PR allows Chlorine to be reactive in RMG. Only valance 1 is considered, and no hypervalance atomTypes were defined.
A respective atomType test was added, and the documentation was changed accordingly.
I also made a small change to the isomorphismTest which otherwise insists that Cl should be charged.
This PR will soon be accompanied by a sister -db PR with relevant kinetics and thermo data by @zjburas. They should be merged together, but this branch can principally be reviewed.