-
Notifications
You must be signed in to change notification settings - Fork 251
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
Changes from all commits
e2bd018
444d908
7495ad0
7cd5cf5
6ed0c14
4288bec
87dc475
7758183
f317c69
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1117,18 +1117,23 @@ def updateFingerprint(self): | |
| isomorphism checks. | ||
| """ | ||
| cython.declare(atom=GroupAtom, atomType=AtomType) | ||
| cython.declare(carbon=AtomType, nitrogen=AtomType, oxygen=AtomType, sulfur=AtomType) | ||
| cython.declare(isCarbon=cython.bint, isNitrogen=cython.bint, isOxygen=cython.bint, isSulfur=cython.bint, radical=cython.int) | ||
|
|
||
| cython.declare(carbon=AtomType, nitrogen=AtomType, oxygen=AtomType, sulfur=AtomType, chlorine=AtomType, silicon=AtomType) | ||
| cython.declare(isCarbon=cython.bint, isNitrogen=cython.bint, isOxygen=cython.bint, isSulfur=cython.bint, | ||
| isChlorine=cython.bint, isSilicon=cython.bint, radical=cython.int) | ||
|
|
||
| carbon = atomTypes['C'] | ||
| nitrogen = atomTypes['N'] | ||
| oxygen = atomTypes['O'] | ||
| sulfur = atomTypes['S'] | ||
| chlorine = atomTypes['Cl'] | ||
| silicon = atomTypes['Si'] | ||
|
|
||
| self.carbonCount = 0 | ||
| self.nitrogenCount = 0 | ||
| self.oxygenCount = 0 | ||
| self.sulfurCount = 0 | ||
| self.chlorineCount = 0 | ||
| self.siliconCount = 0 | ||
| self.radicalCount = 0 | ||
| for atom in self.vertices: | ||
| if len(atom.atomType) == 1: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
|
@@ -1137,17 +1142,24 @@ def updateFingerprint(self): | |
| isNitrogen = atomType.equivalent(nitrogen) | ||
| isOxygen = atomType.equivalent(oxygen) | ||
| isSulfur = atomType.equivalent(sulfur) | ||
| if isCarbon and not isNitrogen and not isOxygen and not isSulfur: | ||
| self.carbonCount += 1 | ||
| elif isNitrogen and not isCarbon and not isOxygen and not isSulfur: | ||
| self.nitrogenCount += 1 | ||
| elif isOxygen and not isCarbon and not isNitrogen and not isSulfur: | ||
| self.oxygenCount += 1 | ||
| elif isSulfur and not isCarbon and not isNitrogen and not isOxygen: | ||
| self.sulfurCount += 1 | ||
| if len(atom.radicalElectrons) == 1: | ||
| radical = atom.radicalElectrons[0] | ||
| self.radicalCount += radical | ||
| isChlorine = atomType.equivalent(chlorine) | ||
| isSilicon = atomType.equivalent(silicon) | ||
| sum_is_atom = isCarbon + isNitrogen + isOxygen + isSulfur + isChlorine + isSilicon | ||
| if sum_is_atom == 1: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| if isCarbon: | ||
| self.carbonCount += 1 | ||
| elif isNitrogen: | ||
| self.nitrogenCount += 1 | ||
| elif isOxygen: | ||
| self.oxygenCount += 1 | ||
| elif isSulfur: | ||
| self.sulfurCount += 1 | ||
| elif isChlorine: | ||
| self.chlorineCount += 1 | ||
| elif isSilicon: | ||
| self.siliconCount += 1 | ||
| if len(atom.radicalElectrons) >= 1: | ||
| self.radicalCount += atom.radicalElectrons[0] | ||
|
|
||
| def isIsomorphic(self, other, initialMap=None): | ||
| """ | ||
|
|
||
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