diff --git a/documentation/source/reference/molecule/atomtype.rst b/documentation/source/reference/molecule/atomtype.rst index cdc1c5223c..765419ad36 100644 --- a/documentation/source/reference/molecule/atomtype.rst +++ b/documentation/source/reference/molecule/atomtype.rst @@ -119,4 +119,8 @@ Atom type Description ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ``Cl`` chlorine atom with any local bond structure ``Cl1s`` chlorine atom with three lone pairs and zero to one single bonds +*Iodine atom types* +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +``I`` iodine atom with any local bond structure +``I1s`` iodine atom with three lone pairs and zero to one single bonds =============== ============================================================================================================================================================== diff --git a/documentation/source/users/rmg/database/introduction.rst b/documentation/source/users/rmg/database/introduction.rst index 81033965c6..43b1add114 100644 --- a/documentation/source/users/rmg/database/introduction.rst +++ b/documentation/source/users/rmg/database/introduction.rst @@ -193,6 +193,10 @@ table below shows all atoms types in RMG. +----------+-------------------+------------------------------------------------------------------------------------------------------------------+ |Cl1s |Chlorine |Three lone pairs, zero to one single bonds | +----------+-------------------+------------------------------------------------------------------------------------------------------------------+ +|I |Iodine |No requirements | ++----------+-------------------+------------------------------------------------------------------------------------------------------------------+ +|I1s |Iodine |Three lone pairs, zero to one single bonds | ++----------+-------------------+------------------------------------------------------------------------------------------------------------------+ |He |Helium |No requirements, nonreactive | +----------+-------------------+------------------------------------------------------------------------------------------------------------------+ |Ne |Neon |No requirements, nonreactive | diff --git a/rmgpy/molecule/atomtype.py b/rmgpy/molecule/atomtype.py index c31815bac0..02e5323ae2 100644 --- a/rmgpy/molecule/atomtype.py +++ b/rmgpy/molecule/atomtype.py @@ -239,10 +239,10 @@ def getFeatures(self): 'C','Ca','Cs','Csc','Cd','CO','CS','Cdd','Cdc','Ct','Cb','Cbf','C2s','C2sc','C2d','C2dc','C2tc', 'N','N0sc','N1s','N1sc','N1dc','N3s','N3sc','N3d','N3t','N3b','N5sc','N5dc','N5ddc','N5dddc','N5t','N5tc','N5b','N5bd', 'O','Oa','O0sc','O2s','O2sc','O2d','O4sc','O4dc','O4tc','O4b', - 'Si','Sis','Sid','Sidd','Sit','SiO','Sib','Sibf', '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', - 'Cl','Cl1s']) + 'Cl','Cl1s', + 'I','I1s']) atomTypes['R!H'] = AtomType(label='R!H', generic=['R'], specific=[ 'Val4','Val5','Val6','Val7', @@ -252,7 +252,8 @@ def getFeatures(self): 'O','Oa','O0sc','O2s','O2sc','O2d','O4sc','O4dc','O4tc','O4b', 'Si','Sis','Sid','Sidd','Sit','SiO','Sib','Sibf', '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', - 'Cl','Cl1s']) + 'Cl','Cl1s', + 'I','I1s']) atomTypes['Val4'] = AtomType(label='Val4', generic=['R','R!H'], specific=[ 'C','Ca','Cs','Csc','Cd','CO','CS','Cdd','Cdc','Ct','Cb','Cbf','C2s','C2sc','C2d','C2dc','C2tc', @@ -266,7 +267,8 @@ def getFeatures(self): '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']) atomTypes['Val7'] = AtomType(label='Val7', generic=['R','R!H'], specific=[ - 'Cl','Cl1s']) + 'Cl','Cl1s', + 'I','I1s']) atomTypes['H' ] = AtomType('H', generic=['R'], specific=[]) @@ -509,6 +511,10 @@ def getFeatures(self): single=[0,1], allDouble=[0], rDouble=[], oDouble=[], sDouble=[], triple=[0], benzene=[0], lonePairs=[3], charge=[0]) # examples for Cl1s: HCl, [Cl] +atomTypes['I' ] = AtomType('I', generic=['R','R!H','Val7'], specific=['I1s']) +atomTypes['I1s'] = AtomType('I1s', generic=['R','R!H','I','Val7'], specific=[], + single=[0,1], allDouble=[0], rDouble=[], oDouble=[], sDouble=[], triple=[0], benzene=[0], lonePairs=[3], charge=[0]) +# examples for I1s: HI, [I], IO, CH3I, I2 atomTypes['R' ].setActions(incrementBond=['R'], decrementBond=['R'], formBond=['R'], breakBond=['R'], incrementRadical=['R'], decrementRadical=['R'], incrementLonePair=['R'], decrementLonePair=['R']) 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']) @@ -610,6 +616,8 @@ def getFeatures(self): atomTypes['Cl' ].setActions(incrementBond=[], decrementBond=[], formBond=['Cl'], breakBond=['Cl'], incrementRadical=['Cl'], decrementRadical=['Cl'], incrementLonePair=[], decrementLonePair=[]) atomTypes['Cl1s'].setActions(incrementBond=[], decrementBond=[], formBond=['Cl1s'], breakBond=['Cl1s'], incrementRadical=['Cl1s'], decrementRadical=['Cl1s'], incrementLonePair=[], decrementLonePair=[]) +atomTypes['I' ].setActions(incrementBond=[], decrementBond=[], formBond=['I'], breakBond=['I'], incrementRadical=['I'], decrementRadical=['I'], incrementLonePair=[], decrementLonePair=[]) +atomTypes['I1s'].setActions(incrementBond=[], decrementBond=[], formBond=['I1s'], breakBond=['I1s'], incrementRadical=['I1s'], decrementRadical=['I1s'], incrementLonePair=[], decrementLonePair=[]) #list of elements that do not have more specific atomTypes #these are ordered on priority of picking if we encounter a more general atomType for make diff --git a/rmgpy/molecule/atomtypeTest.py b/rmgpy/molecule/atomtypeTest.py index 44e2aa6344..b0c05fcfc6 100644 --- a/rmgpy/molecule/atomtypeTest.py +++ b/rmgpy/molecule/atomtypeTest.py @@ -489,6 +489,9 @@ def setUp(self): self.mol73 = Molecule().fromAdjacencyList('''1 H u0 p0 c0 {2,S} 2 Cl u0 p3 c0 {1,S}''') + self.mol74 = Molecule().fromAdjacencyList('''1 H u0 p0 c0 {2,S} + 2 I u0 p3 c0 {1,S}''') + def atomType(self, mol, atomID): atom = mol.atoms[atomID] type = getAtomType(atom, mol.getBonds(atom)) @@ -614,6 +617,12 @@ def testChlorineTypes(self): """ self.assertEqual(self.atomType(self.mol73, 1), 'Cl1s') + def testIodineTypes(self): + """ + Test that getAtomType() returns appropriate iodine atom types. + """ + self.assertEqual(self.atomType(self.mol74, 1), 'I1s') + def testOtherTypes(self): """ Test that getAtomType() returns appropriate types for other misc inerts. diff --git a/rmgpy/molecule/group.pxd b/rmgpy/molecule/group.pxd index 15112b1047..88567ee57c 100644 --- a/rmgpy/molecule/group.pxd +++ b/rmgpy/molecule/group.pxd @@ -119,6 +119,7 @@ cdef class Group(Graph): cdef public short oxygenCount cdef public short sulfurCount cdef public short chlorineCount + cdef public short iodineCount cdef public short siliconCount cdef public short radicalCount diff --git a/rmgpy/molecule/group.py b/rmgpy/molecule/group.py index 8ecc65e6ba..107765aa5d 100644 --- a/rmgpy/molecule/group.py +++ b/rmgpy/molecule/group.py @@ -1117,15 +1117,17 @@ def updateFingerprint(self): isomorphism checks. """ cython.declare(atom=GroupAtom, atomType=AtomType) - cython.declare(carbon=AtomType, nitrogen=AtomType, oxygen=AtomType, sulfur=AtomType, chlorine=AtomType, silicon=AtomType) + cython.declare(carbon=AtomType, nitrogen=AtomType, oxygen=AtomType, sulfur=AtomType, chlorine=AtomType, + iodine=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) + isChlorine=cython.bint, isIodine=cython.bint, isSilicon=cython.bint, radical=cython.int) carbon = atomTypes['C'] nitrogen = atomTypes['N'] oxygen = atomTypes['O'] sulfur = atomTypes['S'] chlorine = atomTypes['Cl'] + iodine = atomTypes['I'] silicon = atomTypes['Si'] self.carbonCount = 0 @@ -1133,7 +1135,8 @@ def updateFingerprint(self): self.oxygenCount = 0 self.sulfurCount = 0 self.chlorineCount = 0 - self.siliconCount = 0 + self.iodineCount = 0 + self.siliconCount = 0 self.radicalCount = 0 for atom in self.vertices: if len(atom.atomType) == 1: @@ -1143,8 +1146,9 @@ def updateFingerprint(self): isOxygen = atomType.equivalent(oxygen) isSulfur = atomType.equivalent(sulfur) isChlorine = atomType.equivalent(chlorine) + isIodine = atomType.equivalent(iodine) isSilicon = atomType.equivalent(silicon) - sum_is_atom = isCarbon + isNitrogen + isOxygen + isSulfur + isChlorine + isSilicon + sum_is_atom = isCarbon + isNitrogen + isOxygen + isSulfur + isChlorine + isIodine + isSilicon if sum_is_atom == 1: if isCarbon: self.carbonCount += 1 @@ -1156,6 +1160,8 @@ def updateFingerprint(self): self.sulfurCount += 1 elif isChlorine: self.chlorineCount += 1 + elif isIodine: + self.iodineCount += 1 elif isSilicon: self.siliconCount += 1 if len(atom.radicalElectrons) >= 1: diff --git a/rmgpy/molecule/isomorphismTest.py b/rmgpy/molecule/isomorphismTest.py index 4ba8d142d8..75dd788818 100644 --- a/rmgpy/molecule/isomorphismTest.py +++ b/rmgpy/molecule/isomorphismTest.py @@ -40,7 +40,7 @@ from rmgpy.molecule.molecule import Molecule from rmgpy.molecule.group import Group -molecule_atom_types = [ 'C', 'O', 'N', 'S', 'Si', 'Cl'] +molecule_atom_types = [ 'C', 'O', 'N', 'S', 'Si', 'Cl', 'I'] group_atomtypes = {} for item in create_atom_types() : @@ -140,7 +140,7 @@ def load_cases_molecule_atom_types(): ''' output = [] a_types = list(itertools.product(molecule_atom_types, repeat=2)) - uncharged_a_types = ['Cl'] + uncharged_a_types = ['Cl','I'] unpaired_electrons = list(itertools.product(range(3), repeat=2)) cross_element_unpaired = list(itertools.product(a_types,unpaired_electrons)) for item in cross_element_unpaired: diff --git a/rmgpy/reaction.py b/rmgpy/reaction.py index 0667f4a0ec..4797b9fbe0 100644 --- a/rmgpy/reaction.py +++ b/rmgpy/reaction.py @@ -922,22 +922,24 @@ def generatePairs(self): productSulfurs = [sum([1 for atom in product.molecule[0].atoms if atom.isSulfur()]) for product in products ] reactantChlorines = [sum([1 for atom in reactant.molecule[0].atoms if atom.isChlorine()]) for reactant in reactants] productChlorines = [sum([1 for atom in product.molecule[0].atoms if atom.isChlorine()]) for product in products ] + reactantIodines = [sum([1 for atom in reactant.molecule[0].atoms if atom.isChlorine()]) for reactant in reactants] + productIodines = [sum([1 for atom in product.molecule[0].atoms if atom.isChlorine()]) for product in products ] # Sort the reactants and products by C/O/N/S numbers - reactants = [(carbon, oxygen, nitrogen, silicon, sulfur, chlorine, reactant) for carbon, oxygen, nitrogen, silicon, sulfur, chlorine, reactant - in zip(reactantCarbons,reactantOxygens,reactantNitrogens,reactantSilicons,reactantSulfurs,reactantChlorines,reactants)] + reactants = [(carbon, oxygen, nitrogen, silicon, sulfur, chlorine, iodine, reactant) for carbon, oxygen, nitrogen, silicon, sulfur, chlorine, iodine, reactant + in zip(reactantCarbons,reactantOxygens,reactantNitrogens,reactantSilicons,reactantSulfurs,reactantChlorines, reactantIodines, reactants)] reactants.sort() - products = [(carbon, oxygen, nitrogen, silicon, sulfur, chlorine, product) for carbon, oxygen, nitrogen, silicon, sulfur, chlorine, product - in zip(productCarbons,productOxygens,productNitrogens,productSilicons,productSulfurs,productChlorines,products)] + products = [(carbon, oxygen, nitrogen, silicon, sulfur, chlorine, iodine, product) for carbon, oxygen, nitrogen, silicon, sulfur, chlorine, iodine, product + in zip(productCarbons,productOxygens,productNitrogens,productSilicons,productSulfurs,productChlorines, productIodines, products)] products.sort() while len(reactants) > 1 and len(products) > 1: - self.pairs.append((reactants[-1][6], products[-1][6])) + self.pairs.append((reactants[-1][-1], products[-1][-1])) reactants.pop() products.pop() for reactant in reactants: for product in products: - self.pairs.append((reactant[6], product[6])) + self.pairs.append((reactant[-1], product[-1])) def draw(self, path): """