Skip to content

Commit bba3e6b

Browse files
committed
Make drawing all PES diagrams an option in the input file.
You can set generatePESDiagrams=True in the options() block of an input file if you want to save them all. This is presumably a runtime penalty, or at least a hard disk space penalty, and probably shouldn't be a default. Default is False.
1 parent 90c5ec2 commit bba3e6b

File tree

7 files changed

+17
-1
lines changed

7 files changed

+17
-1
lines changed

documentation/source/users/rmg/input.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -965,6 +965,7 @@ Miscellaneous options::
965965
units='si',
966966
generateOutputHTML=True,
967967
generatePlots=False,
968+
generatePESDiagrams=False,
968969
saveSimulationProfiles=True,
969970
verboseComments=False,
970971
saveEdgeSpecies=True,
@@ -986,6 +987,8 @@ HTML file for your model containing all the species and reactions. Turning this
986987

987988
Setting ``generatePlots`` to ``True`` will generate a number of plots describing the statistics of the RMG job, including the reaction model core and edge size and memory use versus execution time. These will be placed in the output directory in the plot/ folder.
988989

990+
Setting ``generatePESDiagrams`` to ``True`` will generate potential energy surface diagrams for each pressure dependent network in the model. These diagrams will be saved in the ``pdep/`` folder in the output directory. Only applicable if pressure dependence is enabled.
991+
989992
Setting ``saveSimulationProfiles`` to ``True`` will make RMG save csv files of the simulation in .csv files in the ``solver/`` folder. The filename will be ``simulation_1_26.csv`` where the first number corresponds to the reaciton system, and the second number corresponds to the total number of species at the point of the simulation. Therefore, the highest second number will indicate the latest simulation that RMG has complete while enlarging the core model. The information inside the csv file will provide the time, reactor volume in m^3, as well as mole fractions of the individual species.
990993

991994
Setting ``verboseComments`` to ``True`` will make RMG generate chemkin files with complete verbose commentary for the kinetic and thermo parameters. This will be helpful in debugging what values are being averaged for the kinetics. Note that this may produce very large files.

examples/rmg/1,3-hexadiene/input.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,5 @@
8989
units='si',
9090
generateOutputHTML=False,
9191
generatePlots=False,
92+
generatePESDiagrams=True,
9293
)

examples/rmg/commented/input.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@
217217
generateOutputHTML=True,
218218
# generates plots of the RMG's performance statistics. Not helpful if you just want a model.
219219
generatePlots=False,
220+
# generates potential energy surface diagrams for pressure dependent networks in the model.
221+
generatePESDiagrams=False,
220222
# saves mole fraction of species in 'solver/' to help you create plots
221223
saveSimulationProfiles=False,
222224
# gets RMG to output comments on where kinetics were obtained in the chemkin file.

examples/rmg/ethane-oxidation/input.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,5 @@
6767
units='si',
6868
generateOutputHTML=False,
6969
generatePlots=False,
70+
generatePESDiagrams=True,
7071
)

rmgpy/rmg/input.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,7 @@ def pressure_dependence(
13691369

13701370

13711371
def options(name='Seed', generateSeedEachIteration=True, saveSeedToDatabase=False, units='si', saveRestartPeriod=None,
1372-
generateOutputHTML=False, generatePlots=False, saveSimulationProfiles=False, verboseComments=False,
1372+
generateOutputHTML=False, generatePlots=False, generatePESDiagrams=False, saveSimulationProfiles=False, verboseComments=False,
13731373
saveEdgeSpecies=False, keepIrreversible=False, trimolecularProductReversible=True, wallTime='00:00:00:00',
13741374
saveSeedModulus=-1):
13751375
if saveRestartPeriod:
@@ -1386,6 +1386,9 @@ def options(name='Seed', generateSeedEachIteration=True, saveSeedToDatabase=Fals
13861386
logging.warning('Generate Output HTML option was turned on. Note that this will slow down model generation.')
13871387
rmg.generate_output_html = generateOutputHTML
13881388
rmg.generate_plots = generatePlots
1389+
rmg.generate_PES_diagrams = generatePESDiagrams
1390+
if generatePESDiagrams:
1391+
logging.info('Potential Energy Surface diagrams will be generated in the "pdep" folder.')
13891392
rmg.save_simulation_profiles = saveSimulationProfiles
13901393
rmg.verbose_comments = verboseComments
13911394
if saveEdgeSpecies:
@@ -1835,6 +1838,7 @@ def save_input_file(path, rmg):
18351838
f.write(' units = "{0}",\n'.format(rmg.units))
18361839
f.write(' generateOutputHTML = {0},\n'.format(rmg.generate_output_html))
18371840
f.write(' generatePlots = {0},\n'.format(rmg.generate_plots))
1841+
f.write(' generatePESDiagrams = {0},\n'.format(rmg.generate_PES_diagrams))
18381842
f.write(' saveSimulationProfiles = {0},\n'.format(rmg.save_simulation_profiles))
18391843
f.write(' saveEdgeSpecies = {0},\n'.format(rmg.save_edge_species))
18401844
f.write(' keepIrreversible = {0},\n'.format(rmg.keep_irreversible))

rmgpy/rmg/main.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ class RMG(util.Subject):
143143
`units` The unit system to use to save output files (currently must be 'si')
144144
`generate_output_html` ``True`` to draw pictures of the species and reactions, saving a visualized model in an output HTML file. ``False`` otherwise
145145
`generate_plots` ``True`` to generate plots of the job execution statistics after each iteration, ``False`` otherwise
146+
`generate_PES_diagrams` ``True`` to generate potential energy surface diagrams for pressure dependent networks in the model, ``False`` otherwise
146147
`verbose_comments` ``True`` to keep the verbose comments for database estimates, ``False`` otherwise
147148
`save_edge_species` ``True`` to save chemkin and HTML files of the edge species, ``False`` otherwise
148149
`keep_irreversible` ``True`` to keep ireversibility of library reactions as is ('<=>' or '=>'). ``False`` (default) to force all library reactions to be reversible ('<=>')
@@ -222,6 +223,7 @@ def clear(self):
222223
self.units = "si"
223224
self.generate_output_html = None
224225
self.generate_plots = None
226+
self.generate_PES_diagrams = None
225227
self.save_simulation_profiles = None
226228
self.verbose_comments = None
227229
self.save_edge_species = None
@@ -271,6 +273,7 @@ def load_input(self, path=None):
271273
if self.pressure_dependence:
272274
self.pressure_dependence.output_file = self.output_directory
273275
self.reaction_model.pressure_dependence = self.pressure_dependence
276+
self.pressure_dependence.generate_PES_diagrams = self.generate_PES_diagrams
274277
if self.solvent:
275278
self.reaction_model.solvent_name = self.solvent
276279

rmgpy/rmg/pdep.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,8 @@ def update(self, reaction_model, pdep_settings, requires_rms=False):
872872
if output_directory:
873873
job.save_input_file(
874874
os.path.join(output_directory, 'pdep', 'network{0:d}_{1:d}.py'.format(self.index, len(self.isomers))))
875+
if pdep_settings.generate_PES_diagrams:
876+
job.draw(os.path.join(output_directory, 'pdep'), filename_stem=f'network{self.index:d}_{len(self.isomers):d}', file_format='pdf')
875877

876878
# Calculate the rate coefficients
877879
self.initialize(Tmin, Tmax, Pmin, Pmax, maximum_grain_size, minimum_grain_count, active_j_rotor, active_k_rotor,

0 commit comments

Comments
 (0)