diff --git a/rmgpy/data/kinetics/family.py b/rmgpy/data/kinetics/family.py index c8dec38919..f534aa472f 100644 --- a/rmgpy/data/kinetics/family.py +++ b/rmgpy/data/kinetics/family.py @@ -1564,7 +1564,7 @@ def apply_recipe(self, reactant_structures, forward=True, unique=True, relabel_a struct.reset_ring_membership() if label in ['1,2_insertion_co', 'r_addition_com', 'co_disproportionation', 'intra_no2_ono_conversion', 'lone_electron_pair_bond', - '1,2_nh3_elimination', '1,3_nh3_elimination', 'co2_elimination_from_lactone_ether']: + '1,2_nh3_elimination', '1,3_nh3_elimination', 'co2_elimination_from_lactone_ether']: #, 'enol_ether_formation']: struct.update_charge() else: raise TypeError('Expecting Molecule or Group object, not {0}'.format(struct.__class__.__name__)) @@ -1669,8 +1669,9 @@ def _generate_product_structures(self, reactant_structures, maps, forward, relab product_structures = self.apply_recipe(reactant_structures, forward=forward, relabel_atoms=relabel_atoms) if not product_structures: return None - except (InvalidActionError, KekulizationError, AtomTypeError): #added in by NK + except (InvalidActionError, KekulizationError, AtomTypeError) as e: #added in by NK # If unable to apply the reaction recipe, then return no product structures + print(e) return None except ActionError: logging.error('Could not generate product structures for reaction family {0} in {1} ' diff --git a/rmgpy/molecule/filtration.py b/rmgpy/molecule/filtration.py index 00eb7530d5..40185c40f7 100644 --- a/rmgpy/molecule/filtration.py +++ b/rmgpy/molecule/filtration.py @@ -64,6 +64,8 @@ def filter_structures(mol_list, mark_unreactive=True, allow_expanded_octet=True, if not all([(mol.multiplicity == mol_list[0].multiplicity) for mol in mol_list]): raise ValueError("Cannot filter structures with different multiplicities!") + if 'F' in mol_list[0].smiles: + print('testing') # Get an octet deviation list octet_deviation_list = get_octet_deviation_list(mol_list, allow_expanded_octet=allow_expanded_octet) @@ -117,7 +119,18 @@ def get_octet_deviation(mol, allow_expanded_octet=True): continue val_electrons = 2 * (int(atom.get_total_bond_order()) + atom.lone_pairs) + atom.radical_electrons if atom.is_carbon() or atom.is_nitrogen() or atom.is_oxygen(): + if '(F)[C]OC(F)' in mol.smiles: #we need to have an exception for some PFAS chemistry + # There are some cases for PFAS chemistry where a resonance structure of molecules like FC(F)(F)[C]OC(F)(F)F is FC(F)(F)[C-]=[O+]C(F)(F)F. + # However, the get_octet_deviation function marks the FC(F)(F)[C]OC(F)(F)F as unreactive and keeps the FC(F)(F)[C-]=[O+]C(F)(F)F as reactive. + # This is a problem because Brown University calculated reaction rates using the first structure, so we want to keep that reactive and write a reaction recipe with this structure. + if atom.is_carbon() and val_electrons==6: #this is the C with just 2 single bonds and no unpaired + val_electrons += 2 #add two to the valence charge so we get a total octet deviation of 0 + if atom.is_oxygen(): + pass #no modification of oxygen valence + else: + pass # if not related to PFAS chemistry octet_deviation += abs(8 - val_electrons) # expecting C/N/O to be near octet + elif atom.is_sulfur(): if not allow_expanded_octet: # If allow_expanded_octet is False, then adhere to the octet rule for sulfur as well.