Installation¶
This section can be skipped if KPP is already installed on your system.
Download KPP from Github¶
Clone the KPP source code from the KPP Github repository:
$ cd $HOME
$ git clone https://github.com/KineticPreProcessor/KPP.git
This will create a folder named KPP in your home directory.
Define the KPP_HOME environment variable¶
Define the $KPP_HOME
environment variable to point to the
complete path where KPP is installed. Also, add the path of the KPP
executable to the $PATH
environment variable.
If you are using the Unix C-shell (aka csh), add
add these statements to your $HOME/.cshrc
file:
setenv KPP_HOME $HOME/kpp
setenv PATH ${PATH}:$KPP_HOME/bin
and then apply the settings with:
$ source $HOME/.cshrc
If, on the other hand, you are using the Unix bash shell,
add these statements to your $HOME/.bashrc
file:
export KPP_HOME=$HOME/kpp
export PATH=$PATH:$KPP_HOME/bin
and then apply the settings with:
$ source $HOME/.bashrc
Now if you type:
$ echo $PATH
You should see the $KPP_HOME/bin
folder placed at the end of
the PATH
variable.
Test if KPP dependencies are installed on your system¶
KPP depends on several other Unix packages. Before using KPP for the first time, test if these are installed on your system. If any of these packages are missing, you can install them with your system’s package manager (e.g. apt for Ubuntu, yum for Fedora, homebrew for MacOS, etc.), or with Spack.
gcc¶
KPP uses the GNU Compiler Collection (aka gcc) by default. A version of gcc comes pre-installed with most Linux or MacOS systems. To test if gcc is installed on your system, type:
$ gcc --version
This will display the version information, such as:
gcc (GCC) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
sed¶
The sed utility is used to search for and replace text in files. To test if sed has been installed, type:
$ which sed
This will print the path to sed on your system.
bison¶
The bison utility parses the chemical mechanism file into a computer-readable syntax. To test bison is installed, type:
$ which bison
This will print the path to bison on your system.
flex¶
The flex (the Fast Lexical Analyzer) creates a scanner that can recognize the syntax generated by bison. To test if flex is installed, type:
$ which flex
This will print the path to flex on your system.
Enter the path where the flex library (libfl.a
or
libfl.so
or ) is located into src/Makefile.defs
, e.g.
FLEX_LIB_DIR=/usr/lib
Build the KPP executable¶
Change to the KPP/src directory:
$ cd $KPP_HOME/src
To clean a previously-built KPP installation, delete the KPP object files and all the examples with:
$ make clean
To delete a previoulsy-built KPP executable as well, type:
$ make distclean
KPP will use gcc as the default compiler. If you would
like to use a different compiler (e.g. icc), then edit
src/Makefile.defs
to add your compiler name.
Create the KPP executable with:
$ make
You should see output similar to:
gcc -g -Wall -Wno-unused-function -I/usr/include -c code.c
gcc -g -Wall -Wno-unused-function -I/usr/include -c code_c.c
gcc -g -Wall -Wno-unused-function -I/usr/include -c code_f77.c
gcc -g -Wall -Wno-unused-function -I/usr/include -c code_f90.c
gcc -g -Wall -Wno-unused-function -I/usr/include -c code_matlab.c
gcc -g -Wall -Wno-unused-function -I/usr/include -c debug.c
gcc -g -Wall -Wno-unused-function -I/usr/include -c gen.c
gcc -g -Wall -Wno-unused-function -I/usr/include -c kpp.c
gcc -g -Wall -Wno-unused-function -I/usr/include -c lex.yy.c
gcc -g -Wall -Wno-unused-function -I/usr/include -c scanner.c
gcc -g -Wall -Wno-unused-function -I/usr/include -c scanutil.c
gcc -g -Wall -Wno-unused-function -I/usr/include -c y.tab.c
gcc -g -Wall -Wno-unused-function code.o code_c.o code_f77.o code_f90.o code_matlab.o debug.o gen.o kpp.o lex.yy.o scanner.o scanutil.o y.tab.o -L/usr/lib -lfl -o kpp
This will create the executable file $KPP_HOME/bin/kpp
.