Skip to content

Commit

Permalink
added a new exception for AtomType Error into family.py. This is beca…
Browse files Browse the repository at this point in the history
…use the 1,2+Cycloaddition family was giving problems in .add_rate_rules_from_training
  • Loading branch information
Nora-Khalil committed Jun 12, 2024
1 parent e85af70 commit a6815ef
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions rmgpy/data/kinetics/family.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
from rmgpy.data.kinetics.groups import KineticsGroups
from rmgpy.data.kinetics.rules import KineticsRules
from rmgpy.exceptions import ActionError, DatabaseError, InvalidActionError, KekulizationError, KineticsError, \
ForbiddenStructureException, UndeterminableKineticsError
ForbiddenStructureException, UndeterminableKineticsError, AtomTypeError
from rmgpy.kinetics import Arrhenius, SurfaceArrhenius, SurfaceArrheniusBEP, StickingCoefficient, \
StickingCoefficientBEP, ArrheniusBM
from rmgpy.kinetics.uncertainties import RateUncertainty, rank_accuracy_map
Expand Down Expand Up @@ -1168,6 +1168,9 @@ def add_rules_from_training(self, thermo_database=None, train_indices=None):
For each reaction involving real reactants and products in the training
set, add a rate rule for that reaction.
"""
#added in by NK
print(self.label)
logging.info(self.label)
if self.auto_generated:
warnings.warn(f'add_rules_from_training should be only called for non-ATG families, '
f'but {self.label} is an ATG family. Skip this function call. '
Expand Down Expand Up @@ -1380,7 +1383,10 @@ def apply_recipe(self, reactant_structures, forward=True, unique=True, relabel_a
If ``relabel_atoms`` is ``True``, product atom labels of reversible families
will be reversed to assist in identifying forbidden structures.
"""

#added in by NK
print(reactant_structures)
logging.info(reactant_structures)

# There is some hardcoding of reaction families in this function, so
# we need the label of the reaction family for this
label = self.label.lower()
Expand Down Expand Up @@ -1663,7 +1669,7 @@ 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):
except (InvalidActionError, KekulizationError, AtomTypeError): #added in by NK
# If unable to apply the reaction recipe, then return no product structures
return None
except ActionError:
Expand Down

0 comments on commit a6815ef

Please sign in to comment.