Skip to content

OutputHTMLWriter causes confusing error during first model enlargement #2792

@sevyharris

Description

@sevyharris

Bug Description

I tried to run RMG using a kinetics library I made myself and it would error out in the first step of model enlargement unless I also included that library as a seed mechanism.

This was the error trace:

Adding species C[CH]CC(23) to model core
Traceback (most recent call last):
  File "/home/moon/anaconda3/envs/rmg_env/lib/python3.7/site-packages/julia/pseudo_python_cli.py", line 308, in main
    python(**vars(ns))
  File "/home/moon/anaconda3/envs/rmg_env/lib/python3.7/site-packages/julia/pseudo_python_cli.py", line 59, in python
    scope = runpy.run_path(script, run_name="__main__")
  File "/home/moon/anaconda3/envs/rmg_env/lib/python3.7/runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "/home/moon/anaconda3/envs/rmg_env/lib/python3.7/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/home/moon/anaconda3/envs/rmg_env/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/moon/rmg/RMG-Py/rmg.py", line 118, in <module>
    main()
  File "/home/moon/rmg/RMG-Py/rmg.py", line 112, in main
    rmg.execute(**kwargs)
  File "/home/moon/rmg/RMG-Py/rmgpy/rmg/main.py", line 1029, in execute
    self.reaction_model.enlarge(objectToEnlarge)
  File "/home/moon/rmg/RMG-Py/rmgpy/rmg/model.py", line 644, in enlarge
    reactions_moved_from_edge = self.add_species_to_core(new_species)
  File "/home/moon/rmg/RMG-Py/rmgpy/rmg/model.py", line 1144, in add_species_to_core
    self.edge.phase_system.pass_species(spec.label, self.core.phase_system)
  File "/home/moon/rmg/RMG-Py/rmgpy/rmg/reactors.py", line 144, in pass_species
    assert spc.name not in phasesys.phases[phase_label].names, spc.name
AttributeError: 'NoneType' object has no attribute 'name'

It turns out that the OutputHTMLWriter is overwriting some of the species labels in the edge with its own sanitized version, but it's not also doing this inside the phase_system. So, this line of main: execute changes the species labels in self.reaction_model.edge.species, but doesn't update it in self.reaction_model.edge.phase_system.phases.
This causes the crash in pass_species when it tries to look for C[CH]CC in the edge instead of C[CH]CC(23)

How To Reproduce

Here's my reaction library and dictionary.txt and input file.

But the basic ingredients are:

  1. Include a library--not as a seed, only as a reaction library-- that contains a species with the (1) in the name (or any number in parenthesis)
  2. Set generateOutputHTML=True in the input file
  3. Wait for RMG to add that species with (1) to the core.

Expected Behavior

I would expect RMG to be able to run with the Output HTML on for a library with arbitrary species names.

Installation Information

Describe your installation method and system information.

  • OS (include version if known): WSL Ubuntu 20.04 LTS
  • Installation method: source
  • RMG version information:
    • RMG-Py: 55dd066
    • RMG-database: 17cd80b2583ee94158c7585ccf392ceedc9dc020

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions