Index: palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/bin/kpp4palm.ksh
===================================================================
--- palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/bin/kpp4palm.ksh	(revision 3681)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/bin/kpp4palm.ksh	(revision 3780)
@@ -40,4 +40,5 @@
 # -----------------
 # $Id$ 
+# forkel   05. March 2019: cs_mech and set_cm
 # forkel   30. Oktober 2018: Integrating contents of kp4_compress into chem_gasphase_mod.f90
 # forkel   25. September 2018: Added cat for $MECH to pass mechanism name to kpp4palm
@@ -276,4 +277,6 @@
   REAL(kind=dp) :: FAKT
 
+! CS_MECH for check of mechanism name with namelist
+  CHARACTER(LEN=30) :: CS_MECH
 #ENDINLINE
 EOF
@@ -285,4 +288,11 @@
 EOF
 
+# Store mechanism name for cs_mech
+cat  >> set_cm  <<  EOF
+
+! Set cs_mech for check with mechanism name from namelist
+    cs_mech = '$MECH'
+EOF
+
 # Run kpp
 
Index: palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/create_kpp_module.C
===================================================================
--- palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/create_kpp_module.C	(revision 3681)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/create_kpp_module.C	(revision 3780)
@@ -17,4 +17,6 @@
 //-----------------
 //$Id: create_kpp_module.C 3453 2018-10-30 13:21:51Z forkel $
+// Added create_set_cs and cs_mech and get_mechanismname in module_header (05.03.2019, forkel)
+//
 // exclude kco_compress from handling by global_variables2vector (30.10.2018, forkel)
 //
@@ -191,4 +193,7 @@
 
    generate_module_header();
+
+// create_set_cs
+   create_set_cs();
 
 // Create kpp_integrate subroutine (chem_gasphase_integrate) for skalar and vector mode
@@ -458,8 +463,49 @@
 }
 
+void create_kpp_module::create_set_cs() {
+   fortran_file          kppi;          
+   vector<Vvar>::iterator               iv;
+   string                               xline;
+     
+   string                          buf;
+   ifstream                        in;
+   program_line                    line;
+
+   kppi.set_name("get_mechanismname");
+   kppi.add_line("SUBROUTINE get_mechanismname                                        ");
+   kppi.add_line("                                                                    ");
+   kppi.add_line("  IMPLICIT NONE                                                     ");
+// Read mechanism from set_cm
+// Tis got an own own subroutine to aviod being called at each timestep
+
+   in.open("set_cm");
+   if( !in ) {
+      cout << "cannot open " << endl; my_abort("set_cm");
+   }
+
+   while ( 1 ) {
+     getline (in, buf);
+     if( in.eof() ) break;
+     if( in.bad() ) my_abort("ERROR_READ_4");
+     line.set_line(buf);
+     kppi.add_line(line);
+   }
+   in.close();
+
+   kppi.add_line("                                                                    ");
+   kppi.add_line("  return                                                            ");
+   kppi.add_line("END SUBROUTINE get_mechanismname                                    ");
+   kppi.add_line("                                                                    ");
+   kpp_subroutines.push_back(kppi);
+
+   return;
+}
+
+
 void create_kpp_module::create_kpp_integrate() {
    fortran_file          kppi;
    vector<Vvar>::iterator               iv;
-   string                               line;
+   string                               xline;
+
 
    kppi.set_name("chem_gasphase_integrate");
@@ -598,5 +644,5 @@
    kppi.add_line("                                                                    ");
    kppi.add_line("  return                                                            ");
-   kppi.add_line("END SUBROUTINE chem_gasphase_integrate                                        ");
+   kppi.add_line("END SUBROUTINE chem_gasphase_integrate                              ");
 
 //   e5_subroutines.push_back(kppi);
Index: palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/create_kpp_module.h
===================================================================
--- palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/create_kpp_module.h	(revision 3681)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/create_kpp_module.h	(revision 3780)
@@ -19,4 +19,5 @@
 // -----------------------
 // $Id$
+// forkel   22.02.2019: Added create_set_cs
 // ketelsen 18.09.2018: Removed create_fill_routine
 //
@@ -60,4 +61,5 @@
 
   void create_kpp_integrate();
+  void create_set_cs();
 
 public:
Index: palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/templates/module_header
===================================================================
--- palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/templates/module_header	(revision 3681)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/templates/module_header	(revision 3780)
@@ -61,4 +61,5 @@
 !         , REQ_MCFCT, IP_MAX, jname
 
+  PUBLIC :: cs_mech
   PUBLIC :: eqn_names,  phot_names, spc_names
   PUBLIC :: nmaxfixsteps
@@ -77,4 +78,5 @@
   PUBLIC :: chem_gasphase_integrate
   PUBLIC :: initialize_kpp_ctrl
+  PUBLIC :: get_mechanismname
 
 ! END OF MODULE HEADER TEMPLATE
