Skip to content

Commit 042c944

Browse files
authored
Merge pull request #2653 from ReactionMechanismGenerator/fix_seed_mech_initial_species_core_edge
FIx Handling of Initial Species with Seed Mechanisms
2 parents a027e42 + 42e1ddc commit 042c944

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

rmgpy/rmg/model.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,10 @@ def enlarge(self, new_object=None, react_edge=False, unimolecular_react=None, bi
635635
display(new_species) # if running in IPython --pylab mode, draws the picture!
636636

637637
# Add new species
638-
reactions_moved_from_edge = self.add_species_to_core(new_species)
638+
if new_species not in self.core.species:
639+
reactions_moved_from_edge = self.add_species_to_core(new_species)
640+
else:
641+
reactions_moved_from_edge = []
639642

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

15831586
self.new_reaction_list = []
15841587
self.new_species_list = []
1585-
1588+
edge_species_to_move = []
1589+
15861590
num_old_core_species = len(self.core.species)
15871591
num_old_core_reactions = len(self.core.reactions)
15881592

@@ -1611,6 +1615,9 @@ def add_seed_mechanism_to_core(self, seed_mechanism, react=False):
16111615
reversible=rxn.reversible,
16121616
)
16131617
r, isNew = self.make_new_reaction(rxn) # updates self.new_species_list and self.new_reaction_list
1618+
for s in rxn.reactants+rxn.products:
1619+
if s in self.edge.species and s not in edge_species_to_move:
1620+
edge_species_to_move.append(s)
16141621
if getattr(r.kinetics, "coverage_dependence", None):
16151622
self.process_coverage_dependence(r.kinetics)
16161623
if not isNew:
@@ -1661,7 +1668,7 @@ def add_seed_mechanism_to_core(self, seed_mechanism, react=False):
16611668
" explicitly allow it.".format(spec.label, seed_mechanism.label)
16621669
)
16631670

1664-
for spec in self.new_species_list:
1671+
for spec in edge_species_to_move+self.new_species_list:
16651672
if spec.reactive:
16661673
submit(spec, self.solvent_name)
16671674
if vapor_liquid_mass_transfer.enabled:

0 commit comments

Comments
 (0)