Skip to content

Writing input files fails for liquid cat reactor #2883

@sevyharris

Description

@sevyharris

Bug Description

I tried to read in and then write the input file for the liquid cat reactor and got this error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[2], line 10
      7 print('read RMG input file')
      9 new_input_file = 'new_input.py'
---> 10 rmgpy.rmg.input.save_input_file(new_input_file, rmg0)
     11 print('wrote RMG input file')

File ~/rmg/RMG-Py/rmgpy/rmg/input.py:1758, in save_input_file(path, rmg)
   1756 f.write('    temperature = ' + format_temperature(system) + '\n')
   1757 f.write('    initialConcentrations={\n')
-> 1758 for spcs, conc in system.initial_concentrations.items():
   1759     # conc may have been converted to SI, so we need to convert back
   1760     if type(conc) == float:
   1761         conc = Quantity(conc, Concentration.units)

AttributeError: 'ConstantTLiquidSurfaceReactor' object has no attribute 'initial_concentrations'

Also, the internal code for reading liquid reactor input files should use Quantity to hold the concentration instead of .value_si
https://github.com/sevyharris/RMG-Py/blob/e848daa4bb915809e1c32781dcb4a4dd83f905a2/rmgpy/rmg/input.py#L662

How To Reproduce

import os
import rmgpy.rmg.input
import rmgpy.rmg.main


# reset with  cp ~/rmg/RMG-Py/examples/rmg/superminimal/input.py .
my_input_file = '/home/moon/rmg/RMG-Py/examples/rmg/liquid_cat/input.py'

rmg0 = rmgpy.rmg.main.RMG()
rmgpy.rmg.input.read_input_file(my_input_file, rmg0)

print('read RMG input file')

new_input_file = 'new_input.py'
rmgpy.rmg.input.save_input_file(new_input_file, rmg0)
print('wrote RMG input file')

Expected Behavior

RMG should be able to write input files.

Installation Information

  • RMG version information:
    • RMG-Py: 6b6f576
    • RMG-database: c73ea80097ec9b13e6c47f2bbe2dcec88752927d

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