Skip to content

Commit

Permalink
Merge pull request #2653 from ReactionMechanismGenerator/fix_seed_mec…
Browse files Browse the repository at this point in the history
…h_initial_species_core_edge

FIx Handling of Initial Species with Seed Mechanisms
  • Loading branch information
JacksonBurns authored Apr 23, 2024
2 parents a027e42 + 42e1ddc commit 042c944
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions rmgpy/rmg/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,10 @@ def enlarge(self, new_object=None, react_edge=False, unimolecular_react=None, bi
display(new_species) # if running in IPython --pylab mode, draws the picture!

# Add new species
reactions_moved_from_edge = self.add_species_to_core(new_species)
if new_species not in self.core.species:
reactions_moved_from_edge = self.add_species_to_core(new_species)
else:
reactions_moved_from_edge = []

elif isinstance(new_object, tuple) and isinstance(new_object[0], PDepNetwork) and self.pressure_dependence:
pdep_network, new_species = new_object
Expand Down Expand Up @@ -1582,7 +1585,8 @@ def add_seed_mechanism_to_core(self, seed_mechanism, react=False):

self.new_reaction_list = []
self.new_species_list = []

edge_species_to_move = []

num_old_core_species = len(self.core.species)
num_old_core_reactions = len(self.core.reactions)

Expand Down Expand Up @@ -1611,6 +1615,9 @@ def add_seed_mechanism_to_core(self, seed_mechanism, react=False):
reversible=rxn.reversible,
)
r, isNew = self.make_new_reaction(rxn) # updates self.new_species_list and self.new_reaction_list
for s in rxn.reactants+rxn.products:
if s in self.edge.species and s not in edge_species_to_move:
edge_species_to_move.append(s)
if getattr(r.kinetics, "coverage_dependence", None):
self.process_coverage_dependence(r.kinetics)
if not isNew:
Expand Down Expand Up @@ -1661,7 +1668,7 @@ def add_seed_mechanism_to_core(self, seed_mechanism, react=False):
" explicitly allow it.".format(spec.label, seed_mechanism.label)
)

for spec in self.new_species_list:
for spec in edge_species_to_move+self.new_species_list:
if spec.reactive:
submit(spec, self.solvent_name)
if vapor_liquid_mass_transfer.enabled:
Expand Down

0 comments on commit 042c944

Please sign in to comment.