Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial species in core before seed mechanism #2382

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions rmgpy/rmg/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,23 +614,35 @@ def initialize(self, **kwargs):

# Initialize reaction model

# Seed mechanisms: add species and reactions from seed mechanism
# DON'T generate any more reactions for the seed species at this time
for seed_mechanism in self.seed_mechanisms:
self.reaction_model.add_seed_mechanism_to_core(seed_mechanism, react=False)

# Reaction libraries: add species and reactions from reaction library to the edge so
# that RMG can find them if their rates are large enough
for library, option in self.reaction_libraries:
self.reaction_model.add_reaction_library_to_edge(library)

# Also always add in a few bath gases (since RMG-Java does)
for label, smiles in [("Ar", "[Ar]"), ("He", "[He]"), ("Ne", "[Ne]"), ("N2", "N#N")]:
for label, smiles in [('Ar', '[Ar]'), ('He', '[He]'), ('Ne', '[Ne]'), ('N2', 'N#N')]:
molecule = Molecule().from_smiles(smiles)
spec, is_new = self.reaction_model.make_new_species(molecule, label=label, reactive=False)
if is_new:
self.initial_species.append(spec)

for spec in self.initial_species:
submit(spec, self.solvent)

# Add nonreactive species (e.g. bath gases) to core first
# This is necessary so that the PDep algorithm can identify the bath gas
for spec in self.initial_species:
if not spec.reactive:
self.reaction_model.enlarge(spec)
for spec in self.initial_species:
if spec.reactive:
self.reaction_model.enlarge(spec)

# Seed mechanisms: add species and reactions from seed mechanism
# DON'T generate any more reactions for the seed species at this time
for seed_mechanism in self.seed_mechanisms:
self.reaction_model.add_seed_mechanism_to_core(seed_mechanism, react=False)

# Perform species constraints and forbidden species checks on input species
for spec in self.initial_species:
if self.database.forbidden_structures.is_molecule_forbidden(spec.molecule[0]):
Expand Down Expand Up @@ -690,15 +702,6 @@ def initialize(self, **kwargs):
spec.get_liquid_volumetric_mass_transfer_coefficient_data()
spec.get_henry_law_constant_data()

# Add nonreactive species (e.g. bath gases) to core first
# This is necessary so that the PDep algorithm can identify the bath gas
for spec in self.initial_species:
if not spec.reactive:
self.reaction_model.enlarge(spec)
for spec in self.initial_species:
if spec.reactive:
self.reaction_model.enlarge(spec)

# chatelak: store constant SPC indices in the reactor attributes if any constant SPC provided in the input file
# advantages to write it here: this is run only once (as species indexes does not change over the generation)
if self.solvent is not None:
Expand Down
Loading