Skip to content

Commit

Permalink
prevent adding net reactions that don't conserve spin
Browse files Browse the repository at this point in the history
  • Loading branch information
donerancl committed Jun 27, 2024
1 parent 1ac1dd5 commit c7b1679
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions rmgpy/rmg/pdep.py
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,7 @@ def update(self, reaction_model, pdep_settings):
for r in self.net_reactions:
if r.has_template(configurations[j], configurations[i]):
net_reaction = r

# If net reaction does not already exist, make a new one
if net_reaction is None:
net_reaction = PDepReaction(
Expand All @@ -900,9 +901,12 @@ def update(self, reaction_model, pdep_settings):
network=self,
kinetics=None,
)
net_reaction = reaction_model.make_new_pdep_reaction(net_reaction)
self.net_reactions.append(net_reaction)

num_unpaired_electrons_reactants = sum([reactant.multiplicity - 1 for reactant in configurations[j]])
num_unpaired_electrons_products = sum([product.multiplicity - 1 for product in configurations[i]])
if not (len(configurations[i]) > 1 and len(configurations[j])>1 and num_unpaired_electrons_reactants!=num_unpaired_electrons_products):
net_reaction = reaction_model.make_new_pdep_reaction(net_reaction)
self.net_reactions.append(net_reaction)

# Place the net reaction in the core or edge if necessary
# Note that leak reactions are not placed in the edge
if all([s in reaction_model.core.species for s in net_reaction.reactants]) \
Expand Down

0 comments on commit c7b1679

Please sign in to comment.