Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Tools for creating and managing atmospheric chemistry mechanisms.

Project Description

This collection of python classes and routines facilitates the exploration, construction, and conversion of (gas-phase) chemical mechanisms (the system of differential equations that are solved in numerical models of atmospheric chemistry and transport). It consists of the following key elements:

1. The Compound class describing various physical and chemical properties of individual molecules or lumped substances and defining their names in various common chemistry schemes.

2. The speciesTable class which collects the compound information from all molecules and handles reading and writing this information from or to csv files.

3. The Reaction class describing gas-phase chemical reactants, products, product yields, the rate coefficient term(s) and optional tags, comments, and reaction labels.

4. The Mechanism class which contains a list of reactions and additional variables, comments, and other information and handles in- and output from and to various file formats (mech, csv, kpp, mozpp, racm).

Additional utilities allow computation of molecular weights based on the elemental composition of a molecule and queries of the Pubchem and Master Chemical Mechanism databases to obtain additional information about a compound (e.g. SMILES code, IUPAC name, etc.). There is even a rudimentary algebra class (mathTree) included, which allows scanning of mathematical expressions and factorisation.

The main purpose of this package is the interconversion of chemical mechanisms from one format to another, including the translation of species names from the namespace of one model to that of another model. It has been developed originally because of the author’s need to perform an intercomparison of various mechanisms with the help of a specific chemical boxmodel (CAABA/MECCA, see, but it may also be useful for other purposes, and the author will be grateful for feedback on various use cases as well as suggestions for improvement.

Conversion of a chemical mechanism is possible in only 4 lines of code:

from ac.gasphase.mechanism import Mechanism
    m = Mechanism.from_mech(inputfilename)

This will read a mechanism in the ‘mech’ format, translate all species names to the TM5 namespace and write out species and equations files for the Kinetic Preprocessor (KPP, see

It is also easily possible to test all reactions for mass conservation:


or to find out which reactions involve a specific reactant, say HO2:

rlist = m.find_reactions(['HO2'])
    for r in rlist:
        print r.to_mech()

A number of applications of the ac package are provided in the bin directory of this distribution.


Most of the functionality of the AtmosphericChemistry package requires only python standard libraries and numpy. However, if you want to use the pubchem or mcm_query routines to access compound information from internet databases, you will also need urllib, urllib2, lxml.html, json, time.


Martin G. Schultz, IEK-8, Forschungszentrum Juelich, Germany

A Acknowledgements

Matt Swain for providing the PubChemPy module which is included in this package for cross-referencing compound information in the master species table. Snehal Waychal for providing the mcm_query module and for packaging this up.

Release History

Release History

This version
History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
AtmosphericChemistry-0.1.0.tar.gz (119.0 kB) Copy SHA256 Checksum SHA256 Source Nov 18, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting