class rmgpy.rmg.main.RMG(inputFile=None, outputDirectory=None)

A representation of a Reaction Mechanism Generator (RMG) job. The attributes are:

Attribute Description
inputFile The path to the input file
databaseDirectory The directory containing the RMG database
thermoLibraries The thermodynamics libraries to load
reactionLibraries The kinetics libraries to load
statmechLibraries The statistical mechanics libraries to load
seedMechanisms The seed mechanisms included in the model
kineticsFamilies The kinetics families to use for reaction generation
kineticsDepositories The kinetics depositories to use for looking up kinetics in each family
kineticsEstimator The method to use to estimate kinetics: ‘group additivity’ or ‘rate rules’
solvent If solvation estimates are required, the name of the solvent.
reactionModel The core-edge reaction model generated by this job
reactionSystems A list of the reaction systems used in this job
database The RMG database used in this job
modelSettingsList List of ModelSettings objects containing information related to how to manage species/reaction movement
simulatorSettingsList List of SimulatorSettings objects containing information on how to run simulations
trimolecular True to consider reactions between three species (i.e., if trimolecular reaction families are present)
unimolecularThreshold Array of flags indicating whether a species is above the unimolecular reaction threshold
bimolecularThreshold Array of flags indicating whether two species are above the bimolecular reaction threshold
trimolecularThreshold Array of flags indicating whether three species are above the trimolecular reaction threshold
unimolecularReact Array of flags indicating whether a species should react unimolecularly in the enlarge step
bimolecularReact Array of flags indicating whether two species should react in the enlarge step
trimolecularReact Array of flags indicating whether three species should react in the enlarge step
termination A list of termination targets (i.e TerminationTime and TerminationConversion objects)
speciesConstraints Dictates the maximum number of atoms, carbons, electrons, etc. generated by RMG
outputDirectory The directory used to save output files
verbosity The level of logging verbosity for console output
loadRestart True if restarting a previous job, False otherwise
saveRestartPeriod The time period to periodically save a restart file (Quantity), or None for never.
units The unit system to use to save output files (currently must be ‘si’)
generateOutputHTML True to draw pictures of the species and reactions, saving a visualized model in an output HTML file. False otherwise
generatePlots True to generate plots of the job execution statistics after each iteration, False otherwise
verboseComments True to keep the verbose comments for database estimates, False otherwise
saveEdgeSpecies True to save chemkin and HTML files of the edge species, False otherwise
keepIrreversible True to keep ireversibility of library reactions as is (‘<=>’ or ‘=>’). False (default) to force all library reactions to be reversible (‘<=>’)
trimolecularProductReversible True (default) to allow families with trimolecular products to react in the reverse direction, False otherwise
pressureDependence Whether to process unimolecular (pressure-dependent) reaction networks
quantumMechanics Whether to apply quantum mechanical calculations instead of group additivity to certain molecular types.
wallTime The maximum amount of CPU time in the form DD:HH:MM:SS to expend on this job; used to stop gracefully so we can still get profiling information
kineticsdatastore True if storing details of each kinetic database entry in text file, False otherwise
initializationTime The time at which the job was initiated, in seconds since the epoch (i.e. from time.time())
done Whether the job has completed (there is nothing new to add)

Check for a few common mistakes in the input file.


Check unwanted use of libraries: Liquid phase libraries in Gas phase simulation. Loading a Liquid phase library obtained in another solvent than the one defined in the input file. Other checks can be added here.


Run checks on the RMG model


Clear all loaded information about the job (except the file paths).


Execute an RMG job using the command-line arguments args as returned by the argparse package.


Complete the model generation.

generateCanteraFiles(chemkinFile, **kwargs)

Convert a chemkin mechanism chem.inp file to a cantera mechanism file chem.cti and save it in the cantera directory


Initialize an RMG job using the command-line arguments args as returned by the argparse package.


Load an RMG job from the input file located at inputFile, or from the inputFile attribute if not given as a parameter.


Load an RMG-Java job from the input file located at inputFile, or from the inputFile attribute if not given as a parameter.


Load a restart file at path on disk.


Load an Thermo Estimation job from a thermo input file located at inputFile, or from the inputFile attribute if not given as a parameter.


Output a header containing identifying information about RMG to the log.


causes RMG to make a seed mechanism out of the current chem_annotated.inp and species_dictionary.txt this seed mechanism is outputted in a seed folder within the run directory and automatically added to as the (or replaces the current) ‘Seed’ thermo and kinetics libraries in database

if run with firstTime=True it will change self.name to be unique within the thermo/kinetics libraries by adding integers to the end of the name to prevent overwritting


This method looks at the core species labels and makes sure none of them conflict If a conflict occurs, the second occurance will have ‘-2’ added returns a list of the old labels


properly processes PDepNetwork objects and lists of PDepNetwork objects returned from simulate


properly processes Reaction objects and lists of Reaction objects returned from simulate


breaks down the objects returned by simulate into Species and PDepNetwork components


Read a meaningful line from an RMG-Java condition file object f, returning the line with any comments removed.


Attaches listener classes depending on the options found in the RMG input file.


Saves the output HTML, the Chemkin file, and the Restart file (if appropriate).

The restart file is only saved if self.saveRestartPeriod or self.done.


Save an RMG job to the input file located at path, or from the outputFile attribute if not given as a parameter.

updateReactionThresholdAndReactFlags(rxnSysUnimolecularThreshold=None, rxnSysBimolecularThreshold=None, rxnSysTrimolecularThreshold=None, skipUpdate=False)

updates the length and boolean value of the unimolecular and bimolecular react and threshold flags

rmgpy.rmg.main.initializeLog(verbose, log_file_name)

Set up a logger for RMG to use to print output to stdout. The verbose parameter is an integer specifying the amount of log text seen at the console; the levels correspond to those of the logging module.


Uses gprof2dot to create a graphviz dot file of the profiling information.

This requires the gprof2dot package available via pip install gprof2dot. Render the result using the program ‘dot’ via a command like dot -Tps2 input.dot -o output.ps2.

Rendering the ps2 file to pdf requires an external pdf converter ps2pdf output.ps2 which produces a output.ps2.pdf file.

rmgpy.rmg.main.processProfileStats(stats_file, log_file)