Skip to content

Commit 54775a8

Browse files
committed
add initial species in core before seed mechanism to make sure initial species in phase.names
1 parent 87b96e1 commit 54775a8

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

rmgpy/rmg/main.py

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,25 @@ def initialize(self, **kwargs):
614614

615615
# Initialize reaction model
616616

617+
# Also always add in a few bath gases (since RMG-Java does)
618+
for label, smiles in [('Ar', '[Ar]'), ('He', '[He]'), ('Ne', '[Ne]'), ('N2', 'N#N')]:
619+
molecule = Molecule().from_smiles(smiles)
620+
spec, is_new = self.reaction_model.make_new_species(molecule, label=label, reactive=False)
621+
if is_new:
622+
self.initial_species.append(spec)
623+
624+
for spec in self.initial_species:
625+
submit(spec, self.solvent)
626+
627+
# Add nonreactive species (e.g. bath gases) to core first
628+
# This is necessary so that the PDep algorithm can identify the bath gas
629+
for spec in self.initial_species:
630+
if not spec.reactive:
631+
self.reaction_model.enlarge(spec)
632+
for spec in self.initial_species:
633+
if spec.reactive:
634+
self.reaction_model.enlarge(spec)
635+
617636
# Seed mechanisms: add species and reactions from seed mechanism
618637
# DON'T generate any more reactions for the seed species at this time
619638
for seed_mechanism in self.seed_mechanisms:
@@ -624,13 +643,6 @@ def initialize(self, **kwargs):
624643
for library, option in self.reaction_libraries:
625644
self.reaction_model.add_reaction_library_to_edge(library)
626645

627-
# Also always add in a few bath gases (since RMG-Java does)
628-
for label, smiles in [("Ar", "[Ar]"), ("He", "[He]"), ("Ne", "[Ne]"), ("N2", "N#N")]:
629-
molecule = Molecule().from_smiles(smiles)
630-
spec, is_new = self.reaction_model.make_new_species(molecule, label=label, reactive=False)
631-
if is_new:
632-
self.initial_species.append(spec)
633-
634646
# Perform species constraints and forbidden species checks on input species
635647
for spec in self.initial_species:
636648
if self.database.forbidden_structures.is_molecule_forbidden(spec.molecule[0]):
@@ -690,15 +702,6 @@ def initialize(self, **kwargs):
690702
spec.get_liquid_volumetric_mass_transfer_coefficient_data()
691703
spec.get_henry_law_constant_data()
692704

693-
# Add nonreactive species (e.g. bath gases) to core first
694-
# This is necessary so that the PDep algorithm can identify the bath gas
695-
for spec in self.initial_species:
696-
if not spec.reactive:
697-
self.reaction_model.enlarge(spec)
698-
for spec in self.initial_species:
699-
if spec.reactive:
700-
self.reaction_model.enlarge(spec)
701-
702705
# chatelak: store constant SPC indices in the reactor attributes if any constant SPC provided in the input file
703706
# advantages to write it here: this is run only once (as species indexes does not change over the generation)
704707
if self.solvent is not None:

0 commit comments

Comments
 (0)