Skip to content

Commit 73d4706

Browse files
authored
Merge pull request #1310 from ReactionMechanismGenerator/chlorine
Added Chlorine `Cl1s` atomType
2 parents f5b7467 + f317c69 commit 73d4706

File tree

12 files changed

+118
-50
lines changed

12 files changed

+118
-50
lines changed

documentation/source/reference/molecule/atomtype.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,8 @@ Atom type Description
115115
``S6td`` sulfur atom with no lone pairs (valance 6), one triple bond, one double bond and up to one single bond
116116
``S6tt`` sulfur atom with no lone pairs (valance 6) and two triple bonds
117117
``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
118+
*Chlorine atom types*
119+
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
120+
``Cl`` chlorine atom with any local bond structure
121+
``Cl1s`` chlorine atom with three lone pairs and zero to one single bonds
118122
=============== ==============================================================================================================================================================

documentation/source/users/rmg/database/introduction.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ table below shows all atoms types in RMG.
189189
+----------+-------------------+------------------------------------------------------------------------------------------------------------------+
190190
|S6tdc |Sulfur |No lone pairs, one to two triple bonds, up to two double bonds, up to four single bonds, charged -1/-1 |
191191
+----------+-------------------+------------------------------------------------------------------------------------------------------------------+
192+
|Cl |Chlorine |No requirements |
193+
+----------+-------------------+------------------------------------------------------------------------------------------------------------------+
194+
|Cl1s |Chlorine |Three lone pairs, zero to one single bonds |
195+
+----------+-------------------+------------------------------------------------------------------------------------------------------------------+
192196
|He |Helium |No requirements, nonreactive |
193197
+----------+-------------------+------------------------------------------------------------------------------------------------------------------+
194198
|Ne |Neon |No requirements, nonreactive |

rmgpy/cantherm/statmech.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -705,10 +705,10 @@ def applyEnergyCorrections(E0, modelChemistry, atoms, bonds):
705705
'N-H': 0.06, 'N-N': -0.23, 'N=N': -0.37, 'N#N': -0.64,}
706706
elif modelChemistry == 'CBS-QB3':
707707
bondEnergies = {
708-
'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
709-
'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
710-
'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
711-
'N#N': -2.0, 'O=O': -0.2, 'H-H': 1.1, # Unknown source
708+
'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
709+
'C#C': -0.64, 'C#N': -0.89, 'C-S': 0.43, 'O=S': -0.78,'S-H': 0.0, 'C-N': -0.13, 'C-Cl': 1.29, 'C-F': 0.55, # Table IX: Petersson GA (1998) J. of Chemical Physics, DOI: 10.1063/1.477794
710+
'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
711+
'N#N': -2.0, 'O=O': -0.2, 'H-H': 1.1, # Unknown source
712712
}
713713
elif modelChemistry in ['B3LYP/cbsb7', 'B3LYP/6-311G(2d,d,p)', 'DFT_G03_b3lyp','B3LYP/6-311+G(3df,2p)','b3lyp/6-31G**']:
714714
bondEnergies = { 'C-H': 0.25, 'C-C': -1.89, 'C=C': -0.40, 'C#C': -1.50,

rmgpy/molecule/atomtype.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -235,25 +235,24 @@ def getFeatures(self):
235235
'H',
236236
'R!H',
237237
'Val4','Val5','Val6','Val7',
238-
'He',
238+
'He','Ne','Ar',
239239
'C','Ca','Cs','Csc','Cd','CO','CS','Cdd','Cdc','Ct','Cb','Cbf','C2s','C2sc','C2d','C2dc','C2tc',
240240
'N','N0sc','N1s','N1sc','N1dc','N3s','N3sc','N3d','N3t','N3b','N5sc','N5dc','N5ddc','N5dddc','N5t','N5tc','N5b','N5bd',
241241
'O','Oa','O0sc','O2s','O2sc','O2d','O4sc','O4dc','O4tc','O4b',
242-
'Ne',
242+
243243
'Si','Sis','Sid','Sidd','Sit','SiO','Sib','Sibf',
244244
'S','Sa','S0sc','S2s','S2sc','S2d','S2dc','S2tc','S4s','S4sc','S4d','S4dd','S4dc','S4b','S4t','S4tdc','S6s','S6sc','S6d','S6dd','S6ddd','S6dc','S6t','S6td','S6tt','S6tdc',
245-
'Cl','Ar']
246-
)
245+
'Cl','Cl1s'])
246+
247247
atomTypes['R!H'] = AtomType(label='R!H', generic=['R'], specific=[
248-
'He',
249248
'Val4','Val5','Val6','Val7',
249+
'He','Ne','Ar',
250250
'C','Ca','Cs','Csc','Cd','CO','CS','Cdd','Cdc','Ct','Cb','Cbf','C2s','C2sc','C2d','C2dc','C2tc',
251251
'N','N0sc','N1s','N1sc','N1dc','N3s','N3sc','N3d','N3t','N3b','N5sc','N5dc','N5ddc','N5dddc','N5t','N5tc','N5b','N5bd',
252252
'O','Oa','O0sc','O2s','O2sc','O2d','O4sc','O4dc','O4tc','O4b',
253-
'Ne',
254253
'Si','Sis','Sid','Sidd','Sit','SiO','Sib','Sibf',
255254
'S','Sa','S0sc','S2s','S2sc','S2d','S2dc','S2tc','S4s','S4sc','S4d','S4dd','S4dc','S4b','S4t','S4tdc','S6s','S6sc','S6d','S6dd','S6ddd','S6dc','S6t','S6td','S6tt','S6tdc',
256-
'Cl','Ar'])
255+
'Cl','Cl1s'])
257256

258257
atomTypes['Val4'] = AtomType(label='Val4', generic=['R','R!H'], specific=[
259258
'C','Ca','Cs','Csc','Cd','CO','CS','Cdd','Cdc','Ct','Cb','Cbf','C2s','C2sc','C2d','C2dc','C2tc',
@@ -267,11 +266,13 @@ def getFeatures(self):
267266
'S','Sa','S0sc','S2s','S2sc','S2d','S2dc','S2tc','S4s','S4sc','S4d','S4dd','S4dc','S4b','S4t','S4tdc','S6s','S6sc','S6d','S6dd','S6ddd','S6dc','S6t','S6td','S6tt','S6tdc'])
268267

269268
atomTypes['Val7'] = AtomType(label='Val7', generic=['R','R!H'], specific=[
270-
'Cl'])
269+
'Cl','Cl1s'])
271270

272271
atomTypes['H' ] = AtomType('H', generic=['R'], specific=[])
273272

274-
atomTypes['He' ] = AtomType('He', generic=['R','R!H'], specific=[])
273+
atomTypes['He' ] = AtomType('He', generic=['R','R!H'], specific=[])
274+
atomTypes['Ne' ] = AtomType('Ne', generic=['R','R!H'], specific=[])
275+
atomTypes['Ar' ] = AtomType('Ar', generic=['R','R!H'], specific=[])
275276

276277
atomTypes['C' ] = AtomType('C', generic=['R','R!H','Val4'], specific=['Ca','Cs','Csc','Cd','CO','CS','Cdd','Cdc','Ct','Cb','Cbf','C2s','C2sc','C2d','C2dc','C2tc'],
277278
single=[], allDouble=[], rDouble=[], oDouble=[], sDouble=[], triple=[], benzene=[], lonePairs=[], charge=[])
@@ -408,7 +409,6 @@ def getFeatures(self):
408409
single=[0], allDouble=[0], rDouble=[0], oDouble=[0], sDouble=[0], triple=[0], benzene=[2], lonePairs=[1], charge=[0])
409410
# examples for S4b: Furane, Benzofurane, Benzo[c]thiophene, Oxazole...
410411

411-
atomTypes['Ne' ] = AtomType('Ne', generic=['R','R!H'], specific=[])
412412
atomTypes['Si' ] = AtomType('Si', generic=['R','R!H','Val4'], specific=['Sis','Sid','Sidd','Sit','SiO','Sib','Sibf'],
413413
single=[], allDouble=[], rDouble=[], oDouble=[], sDouble=[], triple=[], benzene=[], lonePairs=[], charge=[])
414414
atomTypes['Sis' ] = AtomType('Sis', generic=['R','R!H','Si','Val4'], specific=[],
@@ -504,9 +504,11 @@ def getFeatures(self):
504504
single=[0,1,2,3,4], allDouble=[0,1,2], rDouble=[], oDouble=[], sDouble=[], triple=[1,2], benzene=[0], lonePairs=[0], charge=[-1,+1])
505505
# *Composite atomType; examples for S6tdc: [SH2+]#[C-], [N-]=[S+]#N
506506

507-
atomTypes['Cl' ] = AtomType('Cl', generic=['R','R!H','Val7'], specific=[])
507+
atomTypes['Cl' ] = AtomType('Cl', generic=['R','R!H','Val7'], specific=['Cl1s'])
508+
atomTypes['Cl1s'] = AtomType('Cl1s', generic=['R','R!H','Cl','Val7'], specific=[],
509+
single=[0,1], allDouble=[0], rDouble=[], oDouble=[], sDouble=[], triple=[0], benzene=[0], lonePairs=[3], charge=[0])
510+
# examples for Cl1s: HCl, [Cl]
508511

509-
atomTypes['Ar' ] = AtomType('Ar', generic=['R','R!H'], specific=[])
510512

511513
atomTypes['R' ].setActions(incrementBond=['R'], decrementBond=['R'], formBond=['R'], breakBond=['R'], incrementRadical=['R'], decrementRadical=['R'], incrementLonePair=['R'], decrementLonePair=['R'])
512514
atomTypes['R!H' ].setActions(incrementBond=['R!H'], decrementBond=['R!H'], formBond=['R!H'], breakBond=['R!H'], incrementRadical=['R!H'], decrementRadical=['R!H'], incrementLonePair=['R!H'], decrementLonePair=['R!H'])
@@ -515,10 +517,11 @@ def getFeatures(self):
515517
atomTypes['Val6'].setActions(incrementBond=['Val6'], decrementBond=['Val6'], formBond=['Val6'], breakBond=['Val6'], incrementRadical=['Val6'], decrementRadical=['Val6'], incrementLonePair=['Val6'],decrementLonePair=['Val6'])
516518
atomTypes['Val7'].setActions(incrementBond=['Val7'], decrementBond=['Val7'], formBond=['Val7'], breakBond=['Val7'], incrementRadical=['Val7'], decrementRadical=['Val7'], incrementLonePair=['Val7'],decrementLonePair=['Val7'])
517519

518-
519520
atomTypes['H' ].setActions(incrementBond=[], decrementBond=[], formBond=['H'], breakBond=['H'], incrementRadical=['H'], decrementRadical=['H'], incrementLonePair=[], decrementLonePair=[])
520521

521522
atomTypes['He' ].setActions(incrementBond=[], decrementBond=[], formBond=[], breakBond=[], incrementRadical=['He'], decrementRadical=['He'], incrementLonePair=[], decrementLonePair=[])
523+
atomTypes['Ne' ].setActions(incrementBond=[], decrementBond=[], formBond=[], breakBond=[], incrementRadical=['Ne'], decrementRadical=['Ne'], incrementLonePair=[], decrementLonePair=[])
524+
atomTypes['Ar' ].setActions(incrementBond=[], decrementBond=[], formBond=[], breakBond=[], incrementRadical=[], decrementRadical=[], incrementLonePair=[], decrementLonePair=[])
522525

523526
atomTypes['C' ].setActions(incrementBond=['C'], decrementBond=['C'], formBond=['C'], breakBond=['C'], incrementRadical=['C'], decrementRadical=['C'], incrementLonePair=['C'], decrementLonePair=['C'])
524527
atomTypes['Ca' ].setActions(incrementBond=[], decrementBond=[], formBond=[], breakBond=[], incrementRadical=[], decrementRadical=[], incrementLonePair=[], decrementLonePair=['C2s'])
@@ -568,8 +571,6 @@ def getFeatures(self):
568571
atomTypes['O4tc'].setActions(incrementBond=[], decrementBond=['O4dc'], formBond=[], breakBond=[], incrementRadical=[], decrementRadical=[], incrementLonePair=['O2d'], decrementLonePair=[])
569572
atomTypes['O4b' ].setActions(incrementBond=[], decrementBond=[], formBond=[], breakBond=[], incrementRadical=[], decrementRadical=[], incrementLonePair=[], decrementLonePair=[])
570573

571-
atomTypes['Ne' ].setActions(incrementBond=[], decrementBond=[], formBond=[], breakBond=[], incrementRadical=['Ne'], decrementRadical=['Ne'], incrementLonePair=[], decrementLonePair=[])
572-
573574
atomTypes['Si' ].setActions(incrementBond=['Si'], decrementBond=['Si'], formBond=['Si'], breakBond=['Si'], incrementRadical=['Si'], decrementRadical=['Si'], incrementLonePair=[], decrementLonePair=[])
574575
atomTypes['Sis' ].setActions(incrementBond=['Sid','SiO'], decrementBond=[], formBond=['Sis'], breakBond=['Sis'], incrementRadical=['Sis'], decrementRadical=['Sis'], incrementLonePair=[], decrementLonePair=[])
575576
atomTypes['Sid' ].setActions(incrementBond=['Sidd','Sit'], decrementBond=['Sis'], formBond=['Sid'], breakBond=['Sid'], incrementRadical=['Sid'], decrementRadical=['Sid'], incrementLonePair=[], decrementLonePair=[])
@@ -606,15 +607,14 @@ def getFeatures(self):
606607
atomTypes['S6tt'].setActions(incrementBond=[], decrementBond=['S6td','S6tdc'], formBond=[], breakBond=[], incrementRadical=[], decrementRadical=[], incrementLonePair=[], decrementLonePair=[])
607608
atomTypes['S6tdc'].setActions(incrementBond=['S6td','S6tdc','S6tt'],decrementBond=['S6dc','S6tdc'],formBond=['S6tdc'],breakBond=['S6tdc'], incrementRadical=['S6tdc'],decrementRadical=['S6tdc'],incrementLonePair=['S4t','S4tdc'],decrementLonePair=[])
608609

610+
atomTypes['Cl' ].setActions(incrementBond=[], decrementBond=[], formBond=['Cl'], breakBond=['Cl'], incrementRadical=['Cl'], decrementRadical=['Cl'], incrementLonePair=[], decrementLonePair=[])
611+
atomTypes['Cl1s'].setActions(incrementBond=[], decrementBond=[], formBond=['Cl1s'], breakBond=['Cl1s'], incrementRadical=['Cl1s'], decrementRadical=['Cl1s'], incrementLonePair=[], decrementLonePair=[])
609612

610-
atomTypes['Cl' ].setActions(incrementBond=[], decrementBond=['Cl'], formBond=['Cl'], breakBond=['Cl'], incrementRadical=['Cl'], decrementRadical=['Cl'], incrementLonePair=[], decrementLonePair=[])
611-
612-
atomTypes['Ar' ].setActions(incrementBond=[], decrementBond=[], formBond=[], breakBond=[], incrementRadical=[], decrementRadical=[], incrementLonePair=[], decrementLonePair=[])
613613

614614
#list of elements that do not have more specific atomTypes
615615
#these are ordered on priority of picking if we encounter a more general atomType for make
616616
allElements=['H', 'C', 'O', 'N', 'S', 'Si', 'Cl', 'Ne', 'Ar', 'He',]
617-
nonSpecifics=['H', 'He', 'Ne', 'Cl', 'Ar',]
617+
nonSpecifics=['H', 'He', 'Ne', 'Ar',]
618618

619619
for atomType in atomTypes.values():
620620
for items in [atomType.generic, atomType.specific,

rmgpy/molecule/atomtypeTest.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,9 @@ def setUp(self):
486486
# 10 H u0 p0 {4,S}
487487
# 11 H u0 p0 {5,S}''')
488488

489+
self.mol73 = Molecule().fromAdjacencyList('''1 H u0 p0 c0 {2,S}
490+
2 Cl u0 p3 c0 {1,S}''')
491+
489492
def atomType(self, mol, atomID):
490493
atom = mol.atoms[atomID]
491494
type = getAtomType(atom, mol.getBonds(atom))
@@ -604,7 +607,13 @@ def testSulfurTypes(self):
604607
self.assertEqual(self.atomType(self.mol36, 0), 'S6td')
605608
self.assertEqual(self.atomType(self.mol37, 1), 'S6tt')
606609
self.assertEqual(self.atomType(self.mol70, 0), 'S6tdc')
607-
610+
611+
def testChlorineTypes(self):
612+
"""
613+
Test that getAtomType() returns appropriate chlorine atom types.
614+
"""
615+
self.assertEqual(self.atomType(self.mol73, 1), 'Cl1s')
616+
608617
def testOtherTypes(self):
609618
"""
610619
Test that getAtomType() returns appropriate types for other misc inerts.

rmgpy/molecule/element.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ class PeriodicSystem(object):
113113
`lone_pairs`: the number of lone pairs an element has
114114
"""
115115

116-
valences = {'H': 1, 'He': 0, 'C': 4, 'N': 3, 'O': 2, 'Ne': 0, 'Si': 4, 'S': 2, 'Cl': 1, 'Ar': 0}
117-
valence_electrons = {'H': 1, 'He': 2, 'C': 4, 'N': 5, 'O': 6, 'Ne': 8, 'Si': 4, 'S': 6, 'Cl': 7, 'Ar': 8}
118-
lone_pairs = {'H': 0, 'He': 1, 'C': 0, 'N': 1, 'O': 2, 'Ne': 4, 'Si': 0, 'S': 2, 'Cl': 3, 'Ar': 4}
116+
valences = {'H': 1, 'He': 0, 'C': 4, 'N': 3, 'O': 2, 'F': 1, 'Ne': 0, 'Si': 4, 'S': 2, 'Cl': 1, 'Ar': 0, 'I': 1}
117+
valence_electrons = {'H': 1, 'He': 2, 'C': 4, 'N': 5, 'O': 6, 'F': 7, 'Ne': 8, 'Si': 4, 'S': 6, 'Cl': 7, 'Ar': 8, 'I': 7}
118+
lone_pairs = {'H': 0, 'He': 1, 'C': 0, 'N': 1, 'O': 2, 'F': 3, 'Ne': 4, 'Si': 0, 'S': 2, 'Cl': 3, 'Ar': 4, 'I': 3}
119119

120120
################################################################################
121121

rmgpy/molecule/group.pxd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ cdef class Group(Graph):
118118
cdef public short nitrogenCount
119119
cdef public short oxygenCount
120120
cdef public short sulfurCount
121+
cdef public short chlorineCount
122+
cdef public short siliconCount
121123
cdef public short radicalCount
122124

123125
cpdef addAtom(self, GroupAtom atom)

rmgpy/molecule/group.py

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,18 +1117,23 @@ def updateFingerprint(self):
11171117
isomorphism checks.
11181118
"""
11191119
cython.declare(atom=GroupAtom, atomType=AtomType)
1120-
cython.declare(carbon=AtomType, nitrogen=AtomType, oxygen=AtomType, sulfur=AtomType)
1121-
cython.declare(isCarbon=cython.bint, isNitrogen=cython.bint, isOxygen=cython.bint, isSulfur=cython.bint, radical=cython.int)
1122-
1120+
cython.declare(carbon=AtomType, nitrogen=AtomType, oxygen=AtomType, sulfur=AtomType, chlorine=AtomType, silicon=AtomType)
1121+
cython.declare(isCarbon=cython.bint, isNitrogen=cython.bint, isOxygen=cython.bint, isSulfur=cython.bint,
1122+
isChlorine=cython.bint, isSilicon=cython.bint, radical=cython.int)
1123+
11231124
carbon = atomTypes['C']
11241125
nitrogen = atomTypes['N']
11251126
oxygen = atomTypes['O']
11261127
sulfur = atomTypes['S']
1128+
chlorine = atomTypes['Cl']
1129+
silicon = atomTypes['Si']
11271130

11281131
self.carbonCount = 0
11291132
self.nitrogenCount = 0
11301133
self.oxygenCount = 0
11311134
self.sulfurCount = 0
1135+
self.chlorineCount = 0
1136+
self.siliconCount = 0
11321137
self.radicalCount = 0
11331138
for atom in self.vertices:
11341139
if len(atom.atomType) == 1:
@@ -1137,17 +1142,24 @@ def updateFingerprint(self):
11371142
isNitrogen = atomType.equivalent(nitrogen)
11381143
isOxygen = atomType.equivalent(oxygen)
11391144
isSulfur = atomType.equivalent(sulfur)
1140-
if isCarbon and not isNitrogen and not isOxygen and not isSulfur:
1141-
self.carbonCount += 1
1142-
elif isNitrogen and not isCarbon and not isOxygen and not isSulfur:
1143-
self.nitrogenCount += 1
1144-
elif isOxygen and not isCarbon and not isNitrogen and not isSulfur:
1145-
self.oxygenCount += 1
1146-
elif isSulfur and not isCarbon and not isNitrogen and not isOxygen:
1147-
self.sulfurCount += 1
1148-
if len(atom.radicalElectrons) == 1:
1149-
radical = atom.radicalElectrons[0]
1150-
self.radicalCount += radical
1145+
isChlorine = atomType.equivalent(chlorine)
1146+
isSilicon = atomType.equivalent(silicon)
1147+
sum_is_atom = isCarbon + isNitrogen + isOxygen + isSulfur + isChlorine + isSilicon
1148+
if sum_is_atom == 1:
1149+
if isCarbon:
1150+
self.carbonCount += 1
1151+
elif isNitrogen:
1152+
self.nitrogenCount += 1
1153+
elif isOxygen:
1154+
self.oxygenCount += 1
1155+
elif isSulfur:
1156+
self.sulfurCount += 1
1157+
elif isChlorine:
1158+
self.chlorineCount += 1
1159+
elif isSilicon:
1160+
self.siliconCount += 1
1161+
if len(atom.radicalElectrons) >= 1:
1162+
self.radicalCount += atom.radicalElectrons[0]
11511163

11521164
def isIsomorphic(self, other, initialMap=None):
11531165
"""

0 commit comments

Comments
 (0)