From aca0b343e9b1f3415d8c85b0d928e99e9c0395b1 Mon Sep 17 00:00:00 2001 From: Richard West Date: Sun, 24 Nov 2024 00:44:10 -0500 Subject: [PATCH] Small efficiency gain checking for charged species. I couldn't help myself, while doing code review. --- rmgpy/data/kinetics/family.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rmgpy/data/kinetics/family.py b/rmgpy/data/kinetics/family.py index a05056a069..43e3836169 100644 --- a/rmgpy/data/kinetics/family.py +++ b/rmgpy/data/kinetics/family.py @@ -1701,9 +1701,9 @@ def _create_reaction(self, reactants, products, is_forward): ) if not self.allow_charged_species: - charged_species = [spc for spc in (reaction.reactants + reaction.products) if spc.get_net_charge() != 0] - if charged_species: - return None + for spc in (reaction.reactants + reaction.products): + if spc.get_net_charge() != 0: + return None if not reaction.is_balanced(): return None