diff --git a/importChemkin.py b/importChemkin.py index 7da3a08cc6a..5c8e9232fb0 100755 --- a/importChemkin.py +++ b/importChemkin.py @@ -288,6 +288,17 @@ def __init__(self, args=None): self.kineticsLibrary = None """An rmgpy.data.kinetics.KineticsLibrary object containing chemkin-defined reactions of identified species""" + + # Determine what to call this model, based on its path + location = os.path.abspath(self.args.reactions or self.args.species) + name = os.path.split(location)[0] + try: + name = name[(name.index('RMG-models') + 11):] + except ValueError: + pass + self.name = name + "The name of the model (based on its source path)" + def loadSpecies(self, species_file): """ Load the chemkin list of species @@ -1806,7 +1817,6 @@ def main(self): known_species_file = args.known or species_file + '.SMILES.txt' self.known_species_file = known_species_file self.blocked_matches_file = os.path.splitext(known_species_file)[0] + '-BLOCKED.txt' - self.outputThermoFile = os.path.splitext(thermo_file)[0] + '.thermo.py' self.outputKineticsFile = os.path.splitext(reactions_file)[0] + '.kinetics.py' @@ -1841,7 +1851,7 @@ def main(self): self.thermoLibrary = rmgpy.data.thermo.ThermoLibrary( label=thermo_file.replace('"', ''), - name=thermo_file.replace('"', ''), + name=self.name, solvent=None, shortDesc=os.path.abspath(thermo_file).replace('"', ''), longDesc=source.strip(), @@ -1849,7 +1859,7 @@ def main(self): self.kineticsLibrary = rmgpy.data.kinetics.KineticsLibrary( label=reactions_file.replace('"', ''), - name=reactions_file.replace('"', ''), + name=self.name, solvent=None, shortDesc=os.path.abspath(reactions_file).replace('"', ''), longDesc=source.strip(), @@ -2096,12 +2106,7 @@ def _img(self, species): @cherrypy.expose def index(self): location = os.path.abspath(self.args.reactions or self.args.species) - name = os.path.split(location)[0] - try: - name = name[(name.index('RMG-models')+11):] - except ValueError: - pass - + name = self.name output = [self.html_head() , """ -

Mechanism importer:"""+name+"""

+

Mechanism importer: """ + name + """