rmgpy.rmg.main.RMG

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
unimolecularThreshold Array of flags indicating whether a species is above the unimolecular reaction threshold
bimolecularaThreshold Array of flags indicating whether two species are above the bimolecular 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
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 (‘<=>’)
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)
checkInput()

Check for a few common mistakes in the input file.

checkLibraries()

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.

clear()

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

execute(**kwargs)

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

finish()

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(**kwargs)

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

loadInput(path=None)

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

loadRMGJavaInput(path)

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

loadRestartFile(path)

Load a restart file at path on disk.

loadThermoInput(path=None)

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

logHeader(level=20)

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

makeSeedMech(firstTime=False)

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

makeSpeciesLabelsIndependent(species)

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

processPdepNetworks(obj)

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

processReactionsToSpecies(obj)

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

processToSpeciesNetworks(obj)

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

readMeaningfulLineJava(f)

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

register_listeners()

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

saveEverything()

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.

saveInput(path=None)

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

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.

rmgpy.rmg.main.makeProfileGraph(stats_file)

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)