Exemple #1
0
master = 'n-Heptane'  # this should be what was used for '--names=' when generating the .pkl files

# Find and read the chemkin file
with open(os.path.join(RMG_MODELS_PATH, master, 'import.sh')) as infile:
    shellscript = infile.read()
reactions_filename = re.search('--reactions\s+(\S+)', shellscript).group(1)
reactions_filepath = os.path.join(RMG_MODELS_PATH, master, reactions_filename)
thermo_filename = re.search('--thermo\s+(\S+)', shellscript).group(1)
thermo_filepath = os.path.join(RMG_MODELS_PATH, master, thermo_filename)
print(reactions_filepath)
print(thermo_filepath)
with open(reactions_filepath) as infile:
    chemkin = infile.readlines()
print "".join(chemkin[:4])  # print first 4 lines only

parser = ck2cti.Parser()
surfaces = parser.convertMech(inputFile=reactions_filepath,
                              thermoFile=thermo_filepath,
                              transportFile=None,
                              surfaceFile=None,
                              phaseName=None,
                              outName='master_heptane.cti',
                              permissive=True)

dict_path = os.path.join(RMG_MODELS_PATH, master, 'RMG-Py-kinetics-library',
                         'dictionary.txt')
print "Loading species_dict from", dict_path
species_dict = rmgpy.data.kinetics.KineticsLibrary().getSpecies(dict_path)

smiles_to_nickname_dict = {}
for species in species_dict.itervalues():
Exemple #2
0
def convertMech(inputFile, outName=None, **kwargs):
    if os.path.exists(outName):
        os.remove(outName)
    parser = ck2cti.Parser()
    parser.convertMech(inputFile, outName=outName, **kwargs)