diff --git a/rmgpy/data/kinetics/family.py b/rmgpy/data/kinetics/family.py index 8ba433e34a..291e639380 100644 --- a/rmgpy/data/kinetics/family.py +++ b/rmgpy/data/kinetics/family.py @@ -1519,10 +1519,9 @@ def apply_recipe(self, reactant_structures, forward=True, unique=True, relabel_a # If product structures are Group objects and the reaction is in certain families # (families with charged substances), the charge of structures will be updated if isinstance(struct, Molecule): - struct.update_charge() + if not isinstance(struct, Fragment): + struct.update_charge() struct.update(sort_atoms=not self.save_order) - elif isinstance(struct, Fragment): - struct.update() elif isinstance(struct, Group): is_molecule = False struct.reset_ring_membership() diff --git a/rmgpy/reaction.py b/rmgpy/reaction.py index 90471acc19..80be78e154 100644 --- a/rmgpy/reaction.py +++ b/rmgpy/reaction.py @@ -1440,16 +1440,16 @@ def is_balanced(self): if not isinstance(atom, CuttingLabel): reactants_net_charge += atom.charge reactant_elements[atom.element] += 1 - elif isinstance(reactant, Molecule): - molecule = reactant - for atom in molecule.atoms: - reactants_net_charge += atom.charge - reactant_elements[atom.element] += 1 elif isinstance(reactant, Fragment): for atom in reactant.atoms: if not isinstance(atom, CuttingLabel): reactants_net_charge += atom.charge reactant_elements[atom.element] += 1 + elif isinstance(reactant, Molecule): + molecule = reactant + for atom in molecule.atoms: + reactants_net_charge += atom.charge + reactant_elements[atom.element] += 1 for product in self.products: if isinstance(product, Species): molecule = product.molecule[0] @@ -1457,16 +1457,16 @@ def is_balanced(self): if not isinstance(atom, CuttingLabel): products_net_charge += atom.charge product_elements[atom.element] += 1 - elif isinstance(product, Molecule): - molecule = product - for atom in molecule.atoms: - products_net_charge += atom.charge - product_elements[atom.element] += 1 elif isinstance(product, Fragment): for atom in product.atoms: if not isinstance(atom, CuttingLabel): products_net_charge += atom.charge product_elements[atom.element] += 1 + elif isinstance(product, Molecule): + molecule = product + for atom in molecule.atoms: + products_net_charge += atom.charge + product_elements[atom.element] += 1 for element in element_list: if reactant_elements[element] != product_elements[element]: