- class rmgpy.rmg.main.RMG(input_file=None, output_directory=None, profiler=None, stats_file=None)¶
A representation of a Reaction Mechanism Generator (RMG) job. The attributes are:
The path to the input file
A cProfile.Profile object for time profiling RMG
The directory containing the RMG database
The thermodynamics libraries to load
The kinetics libraries to load
The statistical mechanics libraries to load
The seed mechanisms included in the model
The kinetics families to use for reaction generation
The kinetics depositories to use for looking up kinetics in each family
The method to use to estimate kinetics: ‘group additivity’ or ‘rate rules’
If solvation estimates are required, the name of the solvent.
If kLA estimates are required, the coefficients for kLA power law
The core-edge reaction model generated by this job
A list of the reaction systems used in this job
The RMG database used in this job
List of ModelSettings objects containing information related to how to manage species/reaction movement
List of SimulatorSettings objects containing information on how to run simulations
List of name tuples of species to react at beginning of run
Trueto consider reactions between three species (i.e., if trimolecular reaction families are present)
Array of flags indicating whether a species is above the unimolecular reaction threshold
Array of flags indicating whether two species are above the bimolecular reaction threshold
Array of flags indicating whether three species are above the trimolecular reaction threshold
Array of flags indicating whether a species should react unimolecularly in the enlarge step
Array of flags indicating whether two species should react in the enlarge step
Array of flags indicating whether three species should react in the enlarge step
A list of termination targets (i.e
Dictates the maximum number of atoms, carbons, electrons, etc. generated by RMG
The directory used to save output files
The level of logging verbosity for console output
The unit system to use to save output files (currently must be ‘si’)
Trueto draw pictures of the species and reactions, saving a visualized model in an output HTML file.
Trueto generate plots of the job execution statistics after each iteration,
Trueto keep the verbose comments for database estimates,
Trueto save chemkin and HTML files of the edge species,
Trueto keep ireversibility of library reactions as is (‘<=>’ or ‘=>’).
False(default) to force all library reactions to be reversible (‘<=>’)
True(default) to allow families with trimolecular products to react in the reverse direction,
Whether to process unimolecular (pressure-dependent) reaction networks
Whether to apply quantum mechanical calculations instead of group additivity to certain molecular types.
To use thermo estimation with machine learning
Settings for ML estimation
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
The maximum number of RMG iterations allowed, after which the job will terminate
Trueif storing details of each kinetic database entry in text file,
The time at which the job was initiated, in seconds since the epoch (i.e. from time.time())
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(initialize=True, **kwargs)¶
Execute an RMG job using the command-line arguments args as returned by the
booltype flag used to determine whether to call self.initialize()
Complete the model generation.
- generate_cantera_files(chemkin_file, **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
Initialize the process of saving the seed mechanism by performing the following:
Create the initial seed mechanism folder (the seed from a previous iterations will be deleted)
Save the restart-from-seed file (unless the current job is itself a restart job)
Ensure that we don’t overwrite existing libraries in the database that have the same name as this job
Create the previous_seeds directory to save intermediate seeds if the user gives a value for saveSeedModulus
Load an RMG job from the input file located at input_file, or from the input_file attribute if not given as a parameter.
Load an RMG-Java job from the input file located at input_file, or from the input_file attribute if not given as a parameter.
Load an Thermo Estimation job from a thermo input file located at input_file, or from the input_file attribute if not given as a parameter.
Output a header containing identifying information about RMG to the log.
Save a seed mechanism (both core and edge) in the ‘seed’ sub-folder of the output directory. Additionally, save the filter tensors to the ‘seed/filters’ sub-folder so that the RMG job can be restarted from a seed mechanism. If self.save_seed_to_database is True then the seed mechanism is also saved as libraries (one each for the core and edge) in the RMG-database.
initialize_seed_mech should be called one time before this function is ever called.
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
Reacts tuples given in the react block
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.
Run sensitivity and uncertainty analysis if requested.
Run uncertainty analysis if proper settings are available.
Saves the output HTML and the Chemkin file. If the job is being profiled this is saved as well.
Save an RMG job to the input file located at path.
- update_reaction_threshold_and_react_flags(rxn_sys_unimol_threshold=None, rxn_sys_bimol_threshold=None, rxn_sys_trimol_threshold=None, skip_update=False)¶
updates the length and boolean value of the unimolecular and bimolecular react and threshold flags
- rmgpy.rmg.main.initialize_log(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
- rmgpy.rmg.main.make_profile_graph(stats_file, force_graph_generation=False)¶
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.
Will only generate a graph if a display is present as errors can occur otherwise. If force_graph_generation is True then the graph generation will be attempted either way
- rmgpy.rmg.main.process_profile_stats(stats_file, log_file)¶