Page tree
Skip to end of metadata
Go to start of metadata

For collaborators and new members

Our models are mostly based on standard Linux tools, so if you use Ubuntu (or other Linux) you should have most of the tools by default. In some cases you need to install extra packages using package manager (or Ubuntu Software Central, whichever you prefer to use).

Ubuntu is the easiest option for beginners.

INstall gfortran compiler and make


Windows is the most complicated option, and needs some extra work. You can select either one of the methods shown below:

One: Cygwin

Installing the Cygwin shell gives most of the Linux tools for Windows, and with a careful setup it is possible to run our models on Windows, too. A real Windows expert might be able to set up our models even without the Cygwin environment, but this has not been tried so far.

1. Download the resource file for 32-bit (setup-x86.exe) or 64-bit (setup-x86_64.exe) Windows in:

2. Double click setup-x86.exe or setup-x86_64.exe.

3. Install cygwin:
--> (1) Install from Internet
--> (2) select a root directory, I recommend to use the default one; All Users.
--> (3) Select where to store the installation files, which is not the root directory. I recommend to use the default one. If the directory does not exist, click 'yes' to create it.
--> (4) Direct Connection
--> (5) Select a site, the speed depends on your location. Using the first one is a good option.
--> (6) Select packages to install, leave it as default now and click 'Next'.
--> (7) 'Next'
--> (8) Wait installation.
--> (9) At least select 'Create icon on Desktop' to make life easier.
--> (10) Finish.

4. Install Fortran compiler:
--> (1) Click the setup file again.
--> (2) Follow the steps shown in 3 until (5).
--> (3) In 'Select package' window, search gcc-fortran, click 'Devel', then click 'Skip' before 'gcc-fortran: GNU Compiler Collection (Fortran).
--> (4) Next --> Next --> Finish.

5. Install make.
--> (1) Similar to 4, now search 'make', and 'Devel', then click 'Skip' before "make: The GNU version of the 'make' utility".
--> (2) Next --> Next --> Finish.

6. Install other packages you need. For example, the text editor 'vim'.

7. Double click 'Cygwin.bat' in the root directory, you will get a command line window. Try to type 'gfortran.exe' and return to make sure the command is installed. You should know that here you are in the directory of 'root directory/home/Administrator/'. Put all the Fortran files here to compile and run.

Two: Eclipse

Go to here to download current version of Eclipse IDE: according to your system. Run the Eclipse installer, select "Eclipse for Scientific Computing" and follow the instructions.


If you use Mac, we recommend first installing the Homebrew package manager. After that things will mostly be almost as easy as with Ubuntu. (Ubuntu package selection is wider, so in some cases Homebrew may not have a package, so a manual install is then the only option.)

Usually 'make' is already installed as a default. If you do not have 'make' installed, you can install 'Command Line Tools' in terminal by:

xcode-select --install

More detailed instruction can be found here:

Then you can select either one of the methods shown below:

One: Gfortran binaries

Download the Apple-style installer *.dmg for your Mac OS version from github ( Double click to install it.

Two: Eclipse

Go to here to download current version of Eclipse IDE: according to your system. Run the Eclipse installer, select "Eclipse for Scientific Computing" and follow the instructions.

Three: Other

You can also find other ways here ( to install gfortran compiler.


Usually you already have everything.

TIPs to debug kpp

1. All the lines read in from input files to KPP can be checked by printing out yyvsp before switch (yyn) in src/ Then you can know which line has problem.

2. If you want to deal with very long reaction coefficient rate, change in src/scan.y:

   char str[80];


   char str[500];

or other numbers you want instead of 500.


$ make distclean

$ make

This will define YYTYPE as a union with str[500] in the generated file src/

3. Always check if those kpp files contain illegal special characters, e.g. '^M'. 

  • if you are using Atom (as code editor), see if the files has non-unix line endings. In the bottom bar of the editor →  ← 'Mixed' or 'CRLF' means non-unix. Click on the text 'Mixed' and choose 'LF' as line ending. Save, ad you're good.

4. Sometimes you need to change some parameters and then make again to get kpp to work properly.


Recommended value

gdata.hMAX_EQNmaximum equation number50000
gdata.hMAX_SPECIESmaximum species number10000


Maximum length of the specie names

scan.hMAX_INLINEmaximum inline characters50000

5. How to use kpp to calculate reactions created by MCM.

(1) Download the kpp file (e.g., mcm.def) in MCM website ( with selected compounds.

(2) In mcm.def, there is one line showing ' = IGNORED', modify it to 'dummy = IGNORED'. And add this dummy to some equations below where should be O2, N2, H2O, M2 or something else.

O + O3 = dummy

OH + HO2 = dummy

(3) Create a mcm.kpp to specify general settings like:

#MODEL mcm
#LANGUAGE Fortran90
#INTEGRATOR rosenbrock
#DRIVER general

(4) Generate f90 files.

$ kpp mcm.kpp

(5) Modify mcm_Global.f90, mcm_Main.f90.

(6) Modify the make file.

(7) Compile Fortran code.

(8) Run the code.

  • No labels