# Writing Chemkin files¶

## Main functions¶

rmgpy.chemkin.saveChemkinFile(path, species, reactions, verbose=True, checkForDuplicates=True)

Save a Chemkin input file to path on disk containing the provided lists of species and reactions. If checkForDuplicates is False then we don’t check for unlabeled duplicate reactions, thus saving time (eg. if you are sure you’ve already labeled them as duplicate).

rmgpy.chemkin.saveSpeciesDictionary(path, species, oldStyle=False)

Save the given list of species as adjacency lists in a text file path on disk.

If oldStyle==True then it saves it in the old RMG-Java syntax.

rmgpy.chemkin.saveTransportFile(path, species)

Save a Chemkin transport properties file to path on disk containing the transport properties of the given list of species.

The syntax is from the Chemkin TRANSPORT manual. The first 16 columns in each line of the database are reserved for the species name (Presently CHEMKIN is programmed to allow no more than 16-character names.) Columns 17 through 80 are free-format, and they contain the molecular parameters for each species. They are, in order:

1. An index indicating whether the molecule has a monatomic, linear or nonlinear geometrical configuration. If the index is 0, the molecule is a single atom. If the index is 1 the molecule is linear, and if it is 2, the molecule is nonlinear.
2. The Lennard-Jones potential well depth $$\epsilon / k_B$$ in Kelvins.
3. The Lennard-Jones collision diameter $$\sigma$$ in Angstroms.
4. The dipole moment $$\mu$$ in Debye. Note: a Debye is $$10^{-18} cm^{3/2}erg^{1/2}$$.
5. The polarizability $$\alpha$$ in cubic Angstroms.
6. The rotational relaxation collision number $$Z_rot$$ at 298K.
7. After the last number, a comment field can be enclosed in parenthesis.
rmgpy.chemkin.saveHTMLFile(path, readComments=True)

Save an output HTML file from the contents of a RMG-Java output folder

rmgpy.chemkin.saveJavaKineticsLibrary(path, species, reactions)

Save the reaction files for a RMG-Java kinetics library: pdepreactions.txt and reactions.txt given a list of reactions, with species.txt containing the RMG-Java formatted dictionary.

## Helper functions¶

rmgpy.chemkin.getSpeciesIdentifier(species)

Return a string identifier for the provided species that can be used in a Chemkin file. Although the Chemkin format allows up to 16 characters for a species identifier, this function uses a maximum of 10 to ensure that all reaction equations fit in the maximum limit of 52 characters.

rmgpy.chemkin.writeKineticsEntry(reaction, speciesList, verbose=True, javaLibrary=False)

Return a string representation of the reaction as used in a Chemkin file. Use verbose = True to turn on comments. Use javaLibrary = True in order to generate a kinetics entry suitable for an RMG-Java kinetics library.

rmgpy.chemkin.writeThermoEntry(species, elementCounts=None, verbose=True)

Return a string representation of the NASA model readable by Chemkin. To use this method you must have exactly two NASA polynomials in your model, and you must use the seven-coefficient forms for each.

rmgpy.chemkin.markDuplicateReactions(reactions)

For a given list of reactions, mark all of the duplicate reactions as understood by Chemkin.

This is pretty slow (quadratic in size of reactions list) so only call it if you’re really worried you may have undetected duplicate reactions.