Skip to content

Commit

Permalink
Save sensitivity files for all species by specifying 'all'
Browse files Browse the repository at this point in the history
  • Loading branch information
amarkpayne authored and mjohnson541 committed Oct 17, 2018
1 parent aaf3dce commit 5dae781
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
10 changes: 7 additions & 3 deletions rmgpy/rmg/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,13 @@ def simpleReactor(temperature,

sensitiveSpecies = []
if sensitivity:
if isinstance(sensitivity, str): sensitivity = [sensitivity]
for spec in sensitivity:
sensitiveSpecies.append(speciesDict[spec])
if sensitivity != 'all':
if isinstance(sensitivity, str): sensitivity = [sensitivity]
for spec in sensitivity:
sensitiveSpecies.append(speciesDict[spec])

else:
sensitiveSpecies.append('all')

if not isinstance(T,list):
sensitivityTemperature = T
Expand Down
3 changes: 3 additions & 0 deletions rmgpy/rmg/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,9 @@ def execute(self, **kwargs):

if reactionSystem.sensitiveSpecies and reactionSystem.sensConditions:
logging.info('Conducting sensitivity analysis of reaction system %s...' % (index+1))

if reactionSystem.sensitiveSpecies == ['all']:
reactionSystem.sensitiveSpecies = self.reactionModel.core.species

sensWorksheet = []
for spec in reactionSystem.sensitiveSpecies:
Expand Down
3 changes: 2 additions & 1 deletion rmgpy/tools/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ def loadRMGPyJob(inputFile, chemkinFile=None, speciesDict=None, generateImages=T
for t in reactionSystem.termination:
if isinstance(t, TerminationConversion):
t.species = speciesDict[t.species]
reactionSystem.sensitiveSpecies = [speciesDict[spec] for spec in reactionSystem.sensitiveSpecies]
if reactionSystem.sensitiveSpecies != ['all']:
reactionSystem.sensitiveSpecies = [speciesDict[spec] for spec in reactionSystem.sensitiveSpecies]

# Set reaction model to match model loaded from Chemkin file
rmg.reactionModel.core.species = speciesList
Expand Down
2 changes: 2 additions & 0 deletions rmgpy/tools/simulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ def simulate(rmg, diffusionLimited=True):

if reactionSystem.sensitiveSpecies:
logging.info('Conducting simulation and sensitivity analysis of reaction system %s...' % (index+1))
if reactionSystem.sensitiveSpecies == ['all']:
reactionSystem.sensitiveSpecies = rmg.reactionModel.core.species

else:
logging.info('Conducting simulation of reaction system %s...' % (index+1))
Expand Down

0 comments on commit 5dae781

Please sign in to comment.