Skip to content

We should replace cantera.Species.fromCti() calls with cantera.Species.from_yaml() calls #2676

Open
@rwest

Description

@rwest

Bug Description

The unit tests include the warning:

test/rmgpy/speciesTest.py::TestSpecies::test_cantera
  /home/runner/work/RMG-Py/RMG-Py/test/rmgpy/speciesTest.py:477: DeprecationWarning: XML_Node::build: 
  The CTI and XML input file formats are deprecated and will be removed in
  Cantera 3.0. Use 'cti2yaml.py' or 'ctml2yaml.py' to convert CTI or XML input
  files to the YAML format. See https://cantera.org/tutorials/legacy2yaml.html
  for more information.

The relevant part of RMG-Py/test/rmgpy/speciesTest.py is

        rmg_ct_species = rmg_species.to_cantera(use_chemkin_identifier=True)

        ct_species = ct.Species.fromCti(
            """species(name=u'Ar',
        atoms='Ar:1',
        thermo=(NASA([200.00, 1000.00],
                     [ 2.50000000E+00,  0.00000000E+00,  0.00000000E+00,
                       0.00000000E+00,  0.00000000E+00, -7.45375000E+02,
                       4.37967000E+00]),
                NASA([1000.00, 6000.00],
                     [ 2.50000000E+00,  0.00000000E+00,  0.00000000E+00,
                       0.00000000E+00,  0.00000000E+00, -7.45375000E+02,
                       4.37967000E+00])),
        transport=gas_transport(geom='atom',
                                diam=3.33,
                                well_depth=136.501,
                                dipole=2.0,
                                polar=1.0,
                                rot_relax=15.0))"""
        )
        assert type(rmg_ct_species) == type(ct_species)

We should replace the fromCti block with a from_yaml block with a syntax a bit like this (this example is obviously a different species)

ct.Species.from_yaml(
'''name: C6H5CH3
composition: {C: 7, H: 8}
thermo:
  model: NASA7
  temperature-ranges: [100.00, 1073.72, 5000.00]
  data:
  - [2.05719474e+00, 3.12152776E-02, 3.04758250E-05, -5.05435593E-08, 
     1.81542493E-11, 3.83493690E+03, 1.65378111E+01]
  - [9.30667130E+00, 3.36713230E-02, -1.41158452E-05, 2.69973752E-09, 
    -1.93204076E-13, 5.79813528E+02, -2.68610894E+01]'''
    )

Note the transportDataTest.py also has a fromCti call.

  • speciesTest.py
  • transportDataTest.py

How To Reproduce

Run the unit tests, specifically test/rmgpy/speciesTest.py

Expected Behavior

We wouldn't get deprecation warnings from Cantera.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions