Skip to content

Commit 74ba2bd

Browse files
hwpangmjohnson541
authored andcommitted
add initial species in core before seed mechanism to make sure initial species in phase.names
1 parent c68ba9a commit 74ba2bd

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

rmgpy/rmg/main.py

+19-16
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,25 @@ def initialize(self, **kwargs):
585585

586586
# Initialize reaction model
587587

588+
# Also always add in a few bath gases (since RMG-Java does)
589+
for label, smiles in [('Ar', '[Ar]'), ('He', '[He]'), ('Ne', '[Ne]'), ('N2', 'N#N')]:
590+
molecule = Molecule().from_smiles(smiles)
591+
spec, is_new = self.reaction_model.make_new_species(molecule, label=label, reactive=False)
592+
if is_new:
593+
self.initial_species.append(spec)
594+
595+
for spec in self.initial_species:
596+
submit(spec, self.solvent)
597+
598+
# Add nonreactive species (e.g. bath gases) to core first
599+
# This is necessary so that the PDep algorithm can identify the bath gas
600+
for spec in self.initial_species:
601+
if not spec.reactive:
602+
self.reaction_model.enlarge(spec)
603+
for spec in self.initial_species:
604+
if spec.reactive:
605+
self.reaction_model.enlarge(spec)
606+
588607
# Seed mechanisms: add species and reactions from seed mechanism
589608
# DON'T generate any more reactions for the seed species at this time
590609
for seed_mechanism in self.seed_mechanisms:
@@ -595,13 +614,6 @@ def initialize(self, **kwargs):
595614
for library, option in self.reaction_libraries:
596615
self.reaction_model.add_reaction_library_to_edge(library)
597616

598-
# Also always add in a few bath gases (since RMG-Java does)
599-
for label, smiles in [('Ar', '[Ar]'), ('He', '[He]'), ('Ne', '[Ne]'), ('N2', 'N#N')]:
600-
molecule = Molecule().from_smiles(smiles)
601-
spec, is_new = self.reaction_model.make_new_species(molecule, label=label, reactive=False)
602-
if is_new:
603-
self.initial_species.append(spec)
604-
605617
# Perform species constraints and forbidden species checks on input species
606618
for spec in self.initial_species:
607619
if self.database.forbidden_structures.is_molecule_forbidden(spec.molecule[0]):
@@ -654,15 +666,6 @@ def initialize(self, **kwargs):
654666
spec.get_liquid_volumetric_mass_transfer_coefficient_data()
655667
spec.get_henry_law_constant_data()
656668

657-
# Add nonreactive species (e.g. bath gases) to core first
658-
# This is necessary so that the PDep algorithm can identify the bath gas
659-
for spec in self.initial_species:
660-
if not spec.reactive:
661-
self.reaction_model.enlarge(spec)
662-
for spec in self.initial_species:
663-
if spec.reactive:
664-
self.reaction_model.enlarge(spec)
665-
666669
# chatelak: store constant SPC indices in the reactor attributes if any constant SPC provided in the input file
667670
# advantages to write it here: this is run only once (as species indexes does not change over the generation)
668671
if self.solvent is not None:

0 commit comments

Comments
 (0)