@@ -42,14 +42,12 @@ def runThermoEstimator(inputFile):
42
42
output = open (os .path .join (rmg .outputDirectory , 'output.txt' ),'wb' )
43
43
library = ThermoLibrary (name = 'Thermo Estimation Library' )
44
44
listOfSpecies = rmg .initialSpecies
45
- chunksize = 50
45
+ chunksize = 1000
46
46
if rmg .reactionModel .quantumMechanics : logging .debug ("qmValue fine @ runThermoEstimator" )
47
47
shared .setConst (qmValue = rmg .reactionModel .quantumMechanics )
48
48
for chunk in list (chunks (listOfSpecies ,chunksize )):
49
- logging .debug ("Parallelized section starts..." )
50
49
# There will be no stdout from workers except the main one.
51
50
outputList = futures .map (makeThermoForSpecies , chunk )
52
- logging .debug ("Parallelized section ends." )
53
51
for species , thermo in zip (chunk , outputList ):
54
52
logging .debug ("Species {0}" .format (species .label ))
55
53
species .thermo = thermo
@@ -60,7 +58,6 @@ def runThermoEstimator(inputFile):
60
58
thermo = species .thermo .toThermoData (),
61
59
shortDesc = species .thermo .comment ,
62
60
)
63
- logging .debug ("chunk done" )
64
61
output .write (writeThermoEntry (species ))
65
62
output .write ('\n ' )
66
63
@@ -74,12 +71,22 @@ def runThermoEstimator(inputFile):
74
71
75
72
import argparse
76
73
77
- parser = argparse .ArgumentParser ()
74
+ parser = argparse .ArgumentParser (description =
75
+ """
76
+ thermoEstimator.py generates thermochemical parameters based on Benson group additivity
77
+ or quantum mechanical calculations. \n
78
+ Generates three output files.
79
+ RMG.log: Contains information about the process.
80
+ output.txt: Contains string representations of the NASA model for each species, readable by Chemkin.
81
+ ThermoLibrary.py: Thermo library that can be used in RMG simulations. Can be uploaded to RMG-database.
82
+ """ )
78
83
parser .add_argument ('input' , metavar = 'FILE' , type = str , nargs = 1 ,
79
84
help = 'Thermo input file' )
80
85
parser .add_argument ('-p' , '--profile' , action = 'store_true' , help = 'run under cProfile to gather profiling statistics, and postprocess them if job completes' )
81
86
parser .add_argument ('-P' , '--postprocess' , action = 'store_true' , help = 'postprocess profiling statistics from previous [failed] run; does not run the simulation' )
82
-
87
+ group = parser .add_mutually_exclusive_group ()
88
+ group .add_argument ('-d' , '--debug' , action = 'store_true' , help = 'print debug information' )
89
+ group .add_argument ('-q' , '--quiet' , action = 'store_true' , help = 'only print warnings and errors' )
83
90
args = parser .parse_args ()
84
91
85
92
inputFile = os .path .abspath (args .input [0 ])
@@ -106,7 +113,10 @@ def runThermoEstimator(inputFile):
106
113
makeProfileGraph (stats_file )
107
114
108
115
else :
109
- level = logging .INFO
110
- initializeLog (level , 'thermo.log' )
116
+
117
+ if args .debug : level = logging .DEBUG
118
+ elif args .quiet : level = logging .WARNING
119
+ else : level = logging .INFO
120
+ initializeLog (level , 'RMG.log' )
111
121
logging .debug ("runThermoEstimator starts..." )
112
122
runThermoEstimator (inputFile )
0 commit comments