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 3780)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/create_kpp_module.C	(revision 3789)
@@ -17,4 +17,7 @@
 //-----------------
 //$Id: create_kpp_module.C 3453 2018-10-30 13:21:51Z forkel $
+// Added vector switch Kacc,Krej,IERRV, Commented add_line for istatf,    (05.03.2019, forkel)
+//      added ,pe after ierr_u,         
+//
 // Added create_set_cs and cs_mech and get_mechanismname in module_header (05.03.2019, forkel)
 //
@@ -436,8 +439,9 @@
    mz_kpp.add_line("                                                                 "); 
    mz_kpp.add_line("                                                                 "); 
-   mz_kpp.add_line("  integer, dimension(VL_dim)   :: Kacc,Krej                       "); 
-   mz_kpp.add_line("  integer, dimension(VL_dim)   :: IERRV                           "); 
+   if(kpp_switches.is_vector()) {
+      mz_kpp.add_line("  integer, dimension(VL_dim)   :: Kacc,Krej                       "); 
+      mz_kpp.add_line("  integer, dimension(VL_dim)   :: IERRV                           "); 
+   }
    mz_kpp.add_line("  logical                     :: data_loaded = .false.             "); 
-
    in.close();
 
@@ -535,5 +539,5 @@
    kppi.add_line("  integer, dimension(20)                 :: istatus_u               ");
    kppi.add_line("  integer                                :: ierr_u                  ");
-   kppi.add_line("  integer                                :: istatf                  ");
+// kppi.add_line("  integer                                :: istatf                  ");
    kppi.add_line("  integer                                :: vl_dim_lo               ");
    kppi.add_line("                                                                    ");
@@ -599,5 +603,5 @@
    } else {
      kppi.add_line("   IF (PRESENT(l_debug) .AND. PRESENT(PE)) THEN                       ");
-     kppi.add_line("      IF (l_debug) CALL error_output(Conc(is,:),ierr_u, PE)           ");
+     kppi.add_line("      IF (l_debug) CALL error_output(Conc(is,:),ierr_u,pe)            ");
      kppi.add_line("   ENDIF                                                              ");
      kppi.add_line("                                                                      ");
Index: palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/expand_decomp.C
===================================================================
--- palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/expand_decomp.C	(revision 3780)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/expand_decomp.C	(revision 3789)
@@ -17,5 +17,9 @@
 // $Id: expand_decomp.C 3327 2018-10-09 19:55:00Z forkel $
 //
-// initial version                                  (Nov. 2016, ketelsen)
+// Added switch for de-indexing == 2 (W is not needed then)       (08.03.2019, forkel)
+// commented add_line for 'INTEGER  :: k, kk, j, jj' which 
+// only needed for de-indexing == 0
+//
+// initial version                                                (Nov. 2016, ketelsen)
 
 
@@ -197,6 +201,11 @@
   de.add_line ("    INTEGER  :: IER                                                   ");
 //  de.add_line ("    REAL ( kind=dp ) :: JVS (:), W ( NVAR ), a                        ");
-  de.add_line ("    REAL ( kind=dp ) :: JVS ( LU_NONZERO ), W ( NVAR ), a             ");
-  de.add_line ("    INTEGER  :: k, kk, j, jj                                          ");
+  if( kpp_switches.de_indexing () == 2 ) {
+     de.add_line ("    REAL ( kind=dp ) :: JVS ( LU_NONZERO ), a                         ");
+  } else {
+     de.add_line ("    REAL ( kind=dp ) :: JVS ( LU_NONZERO ), W ( NVAR ), a             ");
+  }
+//  Commented, k, kk, j, jj are only required if de_indexing == 0, which is not handled here
+//     de.add_line ("    INTEGER  :: k, kk, j, jj                                          ");
   de.add_line ("                                                                      ");
   de.add_line ("    a = 0.                                                            ");
Index: palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/fortran_file.C
===================================================================
--- palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/fortran_file.C	(revision 3780)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/fortran_file.C	(revision 3789)
@@ -19,4 +19,6 @@
 //$Id: 
 //
+// removal of unnecessary variables (Ntotal, TSTART)                        (08.03.2019 forkel)
+// 
 // Added vector switch and creation of dimension statement (rev. 3260, 18.09.2018, ketelsen)
 // 
@@ -167,4 +169,12 @@
     }
 
+//  Remove Ntotal since it is unused
+
+    if(ip->get_token(3) == "Ntotal") {
+      lo_line.insert(0,"!DELETE ");
+    cout << lo_line << endl;
+    }
+
+
 
     ip->set_line(lo_line);
@@ -390,4 +400,12 @@
 
     if(ip->get_token_number_from_string("RTOLS") > 0) {
+    cout << lo_line << endl;
+      lo_line.insert(0,"!DELETE ");
+    cout << lo_line << endl;
+    }
+
+//  Remove    TSTART
+
+    if(ip->get_token_number_from_string("TSTART") > 0) {
     cout << lo_line << endl;
       lo_line.insert(0,"!DELETE ");
Index: palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/fortran_file_vec.C
===================================================================
--- palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/fortran_file_vec.C	(revision 3780)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/fortran_file_vec.C	(revision 3789)
@@ -17,4 +17,6 @@
 //-----------------------
 //$Id: fortran_file_vec.C 3327 2018-10-09 19:55:00Z forkel $
+// Added vector switch for INTEGER         :: j,k                       (08.03.2019, forkel)
+//
 // Line 112: do k=is,ie bydo k=1,vl; line 156 ff: replaced index k by j (18.09.2018, ketelsen)
 //
@@ -169,5 +171,9 @@
   lo_line = ip->get_line() ;
   lo_line.erase();
-  lo_line = "  INTEGER         :: j,k";
+  if(kpp_switches.is_vector() ) {
+    lo_line = " INTEGER         :: j,k";
+  } else {
+    lo_line = " INTEGER         :: k";
+  }
   ip->set_line(lo_line);
 
Index: palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/templates/initialize_kpp_ctrl_template.f90
===================================================================
--- palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/templates/initialize_kpp_ctrl_template.f90	(revision 3780)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/templates/initialize_kpp_ctrl_template.f90	(revision 3789)
@@ -91,5 +91,5 @@
   REAL(dp), DIMENSION(:),INTENT(IN) :: C
 
-  write(6,*) 'ERROR in chem_gasphase_mod ',ierr,C(1)
+  write(6,*) 'ERROR in chem_gasphase_mod ',ierr,C(1),PE
 
 
