Skip to content

logging and output

Mark Goldman edited this page Feb 27, 2017 · 12 revisions

logging options in rmg

There are three options for logging in RMG. 'Quiet', 'Verbose' and 'Debug'.

Default option:

Print information is placed in the log file.

The logic is like this:

Print input file information, and then simple information that RMG are loading thermo libraries, transport libraries, and thermo group database, transport database, kinetic families, frequencies group databases, Platts additivity group databse. Then terminal prints information that RMG are adding rate rules from training set in kinetic families. Then terminal will print how RMG calculates the thermo data of specific species, from thermo library or group additivity. Thermo library is always first choice, or RMG will print all possible resonance isomers and their thermo estimates when using group additivity. Then terminal will give summary of model enlargement, about new core species, new edge species, new edge reactions, and output information about estimating thermo and kinetics of new created species. Current model is saved to file. RMG then will conduct simulation of reactor systems and see if the termination rule is met. Above steps will be done and output repeatedly until final mechanism is generated. RMG will automatically add AR, He, Ne and N2 to core in the first model enlargement. And the RMG will begin the iterative calculation with species given in inupt.py, new species and reactions. Finally, terminal output information of final mechanism, about numbers of core species and reactions, as well as same information about edge species and reactions. Execution time and memory usage will also be output.

Verbose option

Print information is same as log file.

Compared to Default option, terminal will provide much more details about where to load kinetics family groups and rules.

After summary of model enlargement, terminal will provide information about new species and new template reaction before estimating thermo of these new created species.

Debug option

Print information is same as log file.

Compared to Verbose option, terminal will not only provide much more details about where to load kinetics family groups and rules, but also provide details about how to find the specific kinetics group when kinetics family groups are loading. But it will only give us memory address, so it still need improvement to make more helpful for debug

Quiet option

Terminal will print nothing, so does RMG.log. But when there are some warnings and errors, terminal will print them, but will not output to RMG.log file.

  • how files, graphs, etc are saved
  • methods RMG uses to display molecules, reactions, etc. in ipython notebook and website

Visualizing objects in RMG

One vital benefit of RMG is the ability to visualize the molecules. RMG has the capability to draw various structures:

  • Molecules
  • Reactions
  • Groups
  • Flux Diagrams

Some of these drawing methods work quite differently. Here I describe how some of them function:

Molecules

Molecules, not Species, are actually drawn using the _repr_png_. Species also has a _repr_png_ method which just calls the underlying molecule object. A separate class, MoleculeDrawer in rmgpy/molecule/draw.py actually draws and creates the png object. The method draw can output a drawing as png, csv, or other formats. It creates a copy of the object, modifies the bond structure and atom types, calls the rmgpy.qm.molecule.Geometry module to find a geometry from module rdkit to get the 2D geometry, and then draws the molecule with cairo.

Why molecules are drawn this way isn't completely clear. Orignally, we decided against using draw from RDKit or openbabel since they don't support radicals or some other rmg specific attributes. Major changes occured 5 years ago with rdkit being added for geometry 3 years ago (as of Feb 2017). Since then rdkit has been updated (and maybe openbabel). If we need to completely redo the drawing algrithm, we may consider switching to rdkit (and contributing if necessary).

Reactions

Reactions are drawn similar to molecules, using a class called ReactionDrawer in rmgpy/molecule/draw.py. This essentially just draws the molecule objects using MoleculeDrawer and then draws the reaction arrow and signs.

Groups

In addition to drawing molecules, RMG also can represent groups, which are essentially a general structure that molecules are a more specific version of. These are draw in in a completely different way, which doesn't look as pretty or readable. It uses pydot repository to draw the atoms as nodes and bonds as edges. It looks a little jankety, but works better than having no image.

Implementing these into how we draw Molecules or utilizing using RDkit or openbabel might be a challenge since our form of group bonds is not completely standard.

Flux diagrams

An algorithm exists for making flux diagram movies (rmgpy/scripts/generateFluxDiagram.py). This works by creating many images and then sticking them together into a movie file. This was created many years ago for a visual representation in a presentation, and was refactored about 1 year ago (as of February 2017). It still seems mostly useful for presentations.

Chemkin and Cantera both have pathway analysis that are primarily beneficial for understtanding pathway chemistry. A difficulty in using these is that the species names in RMG are often ambiguous which leads to inefficiency in analysis. Modifying Cantera's pathway analysis using RMG's drawn images might be a beneficial addition to RMG's functionality.