Index: palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/Makefile
===================================================================
--- palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/Makefile	(revision 3298)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/Makefile	(revision 3458)
@@ -28,5 +28,5 @@
 
 distclean: clean
-	rm -f $(bindir)/kp4.exe
+	rm -f $(bindir)/kpp4palm.exe
 
 # ----------------------------------------------
Index: palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/bin/kpp4palm.ksh
===================================================================
--- palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/bin/kpp4palm.ksh	(revision 3298)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/bin/kpp4palm.ksh	(revision 3458)
@@ -40,4 +40,5 @@
 # -----------------
 # $Id$ 
+# 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
 # ketelsen 18. September 2018: Added cat for '#INLINE F90_GLOBAL' 
@@ -121,11 +122,12 @@
       k)   KEEP="YES";;              # keep Working directory
 
-      o)   OUTDIR=$OPTARG;;          # Output directory of Generated Code
-
-      p)   PREFIX=$OPTARG;;          # Name Prefix
-
-      s)   KPP_SOLVER=$OPTARG;;      # Update sample f90 code in the def_MECH directory
-
-      u)   UPDT="YES";;              # keep Working directory
+      o)   OUTDIR=$OPTARG;;          # Output directory of Generated Code = 
+                                     # SOURCE directory (do not change)
+
+      p)   PREFIX=$OPTARG;;          # Name Prefix (chem_gasphase_mod, do not change)
+
+      s)   KPP_SOLVER=$OPTARG;;      # Chosen solver (only Rosebrock solvers work for vector mode)
+
+      u)   UPDT="YES";;              # update mechanisms/def_$MECH/chem_gasphase_mod.f90
 
       v)   MODE="vector";;           # Set to vector Mode
@@ -163,5 +165,8 @@
 
 KPP_FILE_LIST="Initialize Integrator LinearAlgebra Jacobian Function Rates Util"
-
+if [[ $MODE = "vector" ]]
+ then
+KPP_FILE_LIST="$KPP_FILE_LIST kp4_compress_subroutines"
+fi
 
 KPP_SUBROUTINE_LIST="Initialize"
@@ -189,4 +194,6 @@
    # get vector Solver 
    cp $BASE/templates/${KPP_SOLVER}_vec.f90 ${KPP_SOLVER}.f90
+   cp $BASE/templates/kp4_compress_header ${PREFIX}_kp4_compress_header.f90
+   cp $BASE/templates/kp4_compress_subroutines ${PREFIX}_kp4_compress_subroutines.f90
 fi
 
@@ -207,6 +214,8 @@
          KPP_SUBROUTINE_LIST="$KPP_SUBROUTINE_LIST Rosenbrock  FunTemplate JacTemplate"
         KPP_INTERFACE_IGNORE="WAXPY"
+
       else 
         KPP_SUBROUTINE_LIST="$KPP_SUBROUTINE_LIST FunTemplate JacTemplate"
+        KPP_SUBROUTINE_LIST="$KPP_SUBROUTINE_LIST kco_initialize kco_compress kco_finalize"
       fi;;
 
@@ -246,4 +255,8 @@
 
 KPP_INCLUDE_LIST="Parameters Global JacobianSP Monitor"
+if [[ $MODE = "vector" ]]
+ then
+KPP_INCLUDE_LIST="$KPP_INCLUDE_LIST kp4_compress_header"
+fi
 
 #Get definition Files
@@ -309,5 +322,5 @@
 done
 
-echo start kp4.exe with arguments
+echo start kpp4palm.exe with arguments
 echo $PREFIX $MODE $VLEN $DE_INDEX $DE_INDEX_FAST
 
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 3298)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/create_kpp_module.C	(revision 3458)
@@ -12,42 +12,45 @@
 //Current revisions:
 //------------------
-/ 
-/ 
+//
+//
 //Former revisions:
 //-----------------
-//$Id: create_kpp_module.C 2470 2017-09-14 13:56:42Z forkel $
-// forkel 25.09.2018:  added  automatic line with meechanism name (read mech_list)
-// forkel 20.09.2018:  added  vl_glo = size(tempi,1)
-// ketelsen 18.09.2018: Removed creation of fill_ Subroutine and creation of calls thereof
-//
-// forkel 12.09.2018: Fix in order not to loose the values of qvap and fakt
-//
-// forkel 03.09.2018: Bug fix: moved kppi.add_line("    CALL initialize after fakt = fakti(is)
-// forkel June 2018: added qvap and fakt, re-established original uppercase/lowercase 
-//                    Deleted definition of qvap,fakt in create_kpp_integrate again
-//
-// ketelsen July 2018: Changes for vector mode (edit_WAXPY, edit_FunTemplate, edit_JacTemplate, 
-//                            some cleanup of comments, various changes in create_kpp_integrate)
-//
-// forkel June 2018: Added qvap and fakt, re-established original uppercase/lowercase 
-//
-//
-/ 2017-09-14 13:56:42Z forkel $
-// Removed preprocessor directive __chem again 
-//
-// 2017-09-14 13:56:42Z forkel $
-//
+//$Id: create_kpp_module.C 3453 2018-10-30 13:21:51Z forkel $
+// exclude kco_compress from handling by global_variables2vector (30.10.2018, forkel)
+//
+// Added  automatic line with mechanism name (read mech_list) (25.09.2018, forkel)
+//
+// Added  vl_glo = size(tempi,1) (20.09.2018, forkel) 
+//
+// Removed creation of fill_ Subroutine and creation of calls thereof (18.09.2018, ketelsen)
+//
+// Fix in order not to loose the values of qvap and fakt (12.09.2018, forkel)
+//
+// Bug fixes: moved kppi.add_line("    CALL initialize after fakt = fakti(is)
+// Deleted definition of qvap,fakt in create_kpp_integrate again (03.09.2018, forkel)
+//
+// Changes for vector mode (edit_WAXPY, edit_FunTemplate, edit_JacTemplate, 
+// some cleanup of comments, various changes in create_kpp_integrate) (July 2018, ketelsen)
+//
+//
+// Added qvap and fakt                            (June 2018, forkel)
+// --> Change in module_header: qvap, fakt added  (June 2018, forkel)
+//
+// re-established original uppercase/lowercase     (June 2018, forkel)
+// --> Change in module_header: reset case in  Initialize, Integrate, and 
+//     Update_rconst                               (June 2018, forkel)
+//
+// Removed preprocessor directive __chem again (2017-09-14, forkel)
 // 
-//added phot
-//change of some output to lowercase with uppercase Fortran
-//
-// Nov 2016: Intial version of KP4 adapted to PALM (Klaus Ketelsen)
-//
-
+// Added phot                                                 (2017-09-14, forkel)
+// --> Change in module_header: Variables for photolyis added (2017-09-14, forkel)
+//
+// change of some output to lowercase with uppercase Fortran (2017, forkel)
+//
+// Intial version of KP4 adapted to PALM                      (Nov. 2016, ketelsen)
+//
 #include <stdio.h>
-//  mz_rs_20090111+
 // stdlib is necessary to define getenv:
 #include <stdlib.h>
-//  mz_rs_20090111-
 
 #include "create_kpp_module.h"
@@ -131,8 +134,10 @@
      }
 
-//   Change global variables to vector
+//   Change global variables to vector (except for kp4_compress, which has already the right form)
      
      for(it=kpp_subroutines.begin();it!=kpp_subroutines.end();it++) {
-       it->global_variables2vector (global_variable_list);
+       if(it->get_name() != "kco_compress" ) {
+         it->global_variables2vector (global_variable_list);
+       }
      }
 
@@ -162,6 +167,4 @@
        }
      }
-// cout << "## after Edit individual subroutines    " <<endl;
-
    }
 
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 3298)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/create_kpp_module.h	(revision 3458)
@@ -1,20 +1,26 @@
 #ifndef mecca
+#define mecca 1
+//
+// ############################################################################
+//
+//     create_mz_kpp_module
+//
+//     create scalar code from .f90 sources created by KPP to be used in MESSy
+//
+//     COPYRIGHT Klaus Ketelsen and MPI-CH   April 2007
+//
+// ############################################################################
+//
+//Current revisions:
+//------------------
+//
+//
+// Former revisions:
+// -----------------------
+// $Id$
 // ketelsen 18.09.2018: Removed create_fill_routine
-
-#include <iostream>
-#include <fstream>
-
-#include <string>
-#include <list>
-#include <vector>
-
-#include "fortran_file.h"
-#include "expand_decomp.h"
-
-// Class to create module which contains code generated by kpp.
-
-/ 
-/ 
-// ketelsen 18.09.2018: Removed create_fill_routine
+//
+// initial version                                  (Nov. 2016, ketelsen)
+//
 
 #include <iostream>
Index: palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/expand_decomp.C
===================================================================
--- palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/expand_decomp.C	(revision 3298)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/expand_decomp.C	(revision 3458)
@@ -9,4 +9,14 @@
 //
 // ############################################################################
+//Current revisions:
+//------------------
+//
+//
+// Former revisions:
+// -----------------------
+// $Id: expand_decomp.C 3327 2018-10-09 19:55:00Z forkel $
+//
+// initial version                                  (Nov. 2016, ketelsen)
+
 
 #include <fstream>
Index: palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/expand_decomp.h
===================================================================
--- palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/expand_decomp.h	(revision 3298)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/expand_decomp.h	(revision 3458)
@@ -11,4 +11,14 @@
 //
 // ############################################################################
+//Current revisions:
+//------------------
+//
+//
+// Former revisions:
+// -----------------------
+// $Id: expand_decomp.h 3327 2018-10-09 19:55:00Z forkel $
+//
+// initial version                                  (Nov. 2016, ketelsen)
+
 
 #include <iostream>
Index: palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/fortran_file.C
===================================================================
--- palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/fortran_file.C	(revision 3298)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/fortran_file.C	(revision 3458)
@@ -13,28 +13,23 @@
 //Current revisions:
 //------------------
-/ 
-/ 
+// 
+// 
 //Former revisions:
 //-----------------
-//$Id: fortran_file.C 2470 2017-09-14 13:56:42Z forkel $
-//  ketelsen 18.09.2018: (Rev 3260) added vector switch and creation of dimension statement
-//  forkel Sept.2018:  'fill_' routine applied to qvap and fakt
-//                      removal of unnecessary variables (LOOKAT, monitor etc. from Fortran code)
-//  forkel June 2018:  Moved adaption to PALM conventions to the end of the process
-//                     in order to make future use of vector code adaptations possible
-//  forkel 20.04.2018: Replace Roundoff = WLAMCH('E') by Roundoff = epsilon(one)
+//$Id: 
+//
+// Added vector switch and creation of dimension statement (rev. 3260, 18.09.2018, ketelsen)
 // 
+// removal of unnecessary variables (LOOKAT, monitor etc. from Fortran code) (Sept.2018, forkel)
 // 
+// Replace Roundoff = WLAMCH('E') by Roundoff = epsilon(one)   (20.04.2018, forkel)
 // 
-/ 2017-09-14 13:56:42Z forkel $
+// Moved adaption to PALM conventions to the end of the processing kpp output
+//  in order to make future use of vector code adaptations possible (June 2018, forkel)
+// 
+// changed KPP-generated code to lowercase with uppercase Fortran  expressions
+// added photolysis variables                               (2017-09-14, forkel)
 //
-// 
-//changed KPP-generated code to lowercase with uppercase Fortran  expressions
-//added photolysis variables
-//
-//
-//
-//
-// Nov 2016: Intial version of KP4 adapted to PALM (Klaus Ketelsen)
+// Initial version of KP4 adapted to PALM                   (Nov 2016, ketelsen)
 //
 
Index: palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/fortran_file.h
===================================================================
--- palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/fortran_file.h	(revision 3298)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/fortran_file.h	(revision 3458)
@@ -14,14 +14,14 @@
 //Current revisions:
 //------------------
-/ 
-/ 
-//Former revisions:
-//-----------------
-// Nov 2016: Intial version of KP4 adapted to PALM (Klaus Ketelsen)
-//  forkel Sept.2018:  added edit_Initialize
-//  forkel          :  added global_subtolower
 //
-/ Intial version of KP4
-
+//
+// Former revisions:
+// -----------------------
+// $Id: fortran_file.h 3327 2018-10-09 19:55:00Z forkel $
+//
+// added edit_Initialize                            (Sept.2018, forkel)
+//
+// added global_subtolower                          (forkel)
+// initial version                                  (Nov. 2016, ketelsen)
 
 #include <iostream>
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 3298)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/fortran_file_vec.C	(revision 3458)
@@ -9,21 +9,18 @@
 //
 // ############################################################################
+//
 //Current revisions:
 //------------------
-/ 
-/ 
+//
+//
 //Former revisions:
-//-----------------
-//$Id: fortran_file.C 2470 2017-09-14 13:56:42Z forkel $
-//  ketelsen 18.09.2018: Line 112: do k=is,ie bydo k=1,vl; line 156 ff: replaced index k by j
-//
-//  forkel Sept.2018:  added edit_Initialize
-//                     changed loop direction for update_rconst in edit_Update_RCONST
-/ 2017-09-14 13:56:42Z forkel $
-//
-//
-// Nov 2016: Intial version of KP4 adapted to PALM (Klaus Ketelsen)
-//
-
+//-----------------------
+//$Id: fortran_file_vec.C 3327 2018-10-09 19:55:00Z forkel $
+// Line 112: do k=is,ie bydo k=1,vl; line 156 ff: replaced index k by j (18.09.2018, ketelsen)
+//
+// added edit_Initialize, changed loop direction for update_rconst in edit_Update_RCONST (Sept. 2018, forkel)
+//
+// initial version       (Nov. 2016, ketelsen)
+//
 
 #include <fstream>
Index: palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/main.C
===================================================================
--- palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/main.C	(revision 3298)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/main.C	(revision 3458)
@@ -9,4 +9,15 @@
 //
 // ############################################################################
+//
+//Current revisions:
+//------------------
+//
+//
+// Former revisions:
+// -----------------------
+// $Id: main.C 3327 2018-10-09 19:55:00Z forkel $
+//
+// initial version       (Nov. 2016, ketelsen)
+//
 
 //  mz_rs_20090111+
Index: palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/program_line.C
===================================================================
--- palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/program_line.C	(revision 3298)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/program_line.C	(revision 3458)
@@ -9,4 +9,18 @@
 //
 // ############################################################################
+//
+//Current revisions:
+//------------------
+//
+//
+// Former revisions:
+// -----------------------
+// $Id: program_line.C 3327 2018-10-09 19:55:00Z forkel $
+//
+// global_subtolower     (June 2018, forkel)
+//
+// initial version       (Nov. 2016, ketelsen)
+//
+
 
 #include "program_line.h"
Index: palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/program_line.h
===================================================================
--- palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/program_line.h	(revision 3298)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/program_line.h	(revision 3458)
@@ -12,5 +12,15 @@
 // ############################################################################
 //
-// forkel June 2018: added    void   global_subtolower(string &line);
+//Current revisions:
+//------------------
+//
+//
+// Former revisions:
+// -----------------------
+// $Id: program_line.h 3327 2018-10-09 19:55:00Z forkel $
+//
+// added    void   global_subtolower(string &line); (June 2018, forkel)
+//
+// initial version                                  (Nov. 2016, ketelsen)
 
 #include <iostream>
Index: palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/utils.C
===================================================================
--- palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/utils.C	(revision 3298)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/utils.C	(revision 3458)
@@ -9,4 +9,15 @@
 //
 // ############################################################################
+//
+//Current revisions:
+//------------------
+//
+//
+// Former revisions:
+// -----------------------
+// $Id: utils.C 3327 2018-10-09 19:55:00Z forkel $
+//
+// initial version                                  (Nov. 2016, ketelsen)
+
 
 //  mz_rs_20090111+
Index: palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/utils.h
===================================================================
--- palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/utils.h	(revision 3298)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/utils.h	(revision 3458)
@@ -11,4 +11,15 @@
 //
 // ############################################################################
+//
+//Current revisions:
+//------------------
+//
+//
+// Former revisions:
+// -----------------------
+// $Id: utils.h 3327 2018-10-09 19:55:00Z forkel $
+//
+// initial version                                  (Nov. 2016, ketelsen)
+// 
 
 #include <string>
Index: palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/templates/Rosenbrock_vec.f90
===================================================================
--- palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/templates/Rosenbrock_vec.f90	(revision 3298)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/templates/Rosenbrock_vec.f90	(revision 3458)
@@ -2,4 +2,16 @@
 !       and can only be used with KP4.
 !
+!Current revisions:
+!------------------
+!
+!
+! Former revisions:
+! -----------------------
+! $Id$
+! commented USE kp4_compress                       (30.10.2018, forkel)
+!
+! initial version (Rev. 3185)                      (June 2018, ketelsen)
+!
+
 SUBROUTINE Rosenbrock(N,Y,Tstart,Tend, &
            AbsTol,RelTol,              &
@@ -358,6 +370,6 @@
 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-  USE kp4_compress,    ONLY: kco_initialize, kco_compress, &
-                             kco_finalize, cell_done
+! USE kp4_compress,    ONLY: kco_initialize, kco_compress, &
+!                            kco_finalize, cell_done
   IMPLICIT NONE
 
Index: palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/templates/kp4_compress_header
===================================================================
--- palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/templates/kp4_compress_header	(revision 3458)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/templates/kp4_compress_header	(revision 3458)
@@ -0,0 +1,34 @@
+!
+!
+!module kp4_compress
+!
+! Module to compress data for ros_Integrator using variable time step 
+! in vector mode. This module is not dependent on chemistry setup and
+! can be use for multiple chemistry setups in one job.
+!
+
+!     COPYRIGHT Klaus Ketelsen and MPI-CH              May 2007
+
+! implicit none
+! private
+! save
+
+! KPP DP - Double precision kind
+  INTEGER, PARAMETER :: ep = SELECTED_REAL_KIND(12,307)
+
+
+! variables
+  integer                                   :: kpoints
+  integer                                   :: kpoints_save
+  integer,dimension(:),allocatable,public   :: index_org
+  integer,dimension(:),allocatable          :: index_step
+  logical,dimension(:),allocatable,public   :: cell_done
+  logical,dimension(:),allocatable          :: done_check
+
+! Data arrays
+  real(kind=ep),dimension(:,:),allocatable  :: f_done
+  integer,      dimension(:),  allocatable  :: Kacc_done, Krej_done
+  integer,      dimension(:),  allocatable  :: ierr_done
+
+  logical  :: compress_done
+
Index: palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/templates/kp4_compress_subroutines
===================================================================
--- palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/templates/kp4_compress_subroutines	(revision 3458)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/templates/kp4_compress_subroutines	(revision 3458)
@@ -0,0 +1,172 @@
+
+CONTAINS
+! Public subroutines
+
+  SUBROUTINE kco_initialize (npoints_initial, f, IERR, Kacc, Krej)
+    implicit    none
+    integer,intent(IN)                                  :: npoints_initial
+    real(kind=ep),intent(IN),dimension(:,:)             :: f     !Only to get dimension for f_done
+    integer,intent(IN),dimension(:)                     :: IERR
+    integer,intent(IN),dimension(:)                     :: Kacc, Krej
+
+!-- local variables
+    integer                          :: jl
+
+    kpoints      = npoints_initial
+    kpoints_save = kpoints
+
+    allocate(index_org(kpoints))
+    allocate(done_check(kpoints))
+    allocate(index_step(kpoints))
+    allocate(cell_done(kpoints))
+    
+    allocate(f_done(size(f,1),size(f,2)))
+    allocate(Kacc_done(size(Kacc)))
+    allocate(Krej_done(size(Krej)))
+    allocate(ierr_done(size(ierr)))
+
+    cell_done     = .false.
+    done_check    = .false.
+
+    do jl=1,kpoints
+      index_org(jl) = jl
+    end do
+
+    compress_done = .FALSE.
+
+!    write(9,*) 'kco_initialize ',npoints_initial
+
+    return
+  end SUBROUTINE kco_initialize
+
+  SUBROUTINE kco_compress (n_points, T, H, Hnew, IERR, f, RCONST, FIX,     &
+                                   RejectLastH, RejectMoreH, Kacc, Krej)
+    implicit    none
+    integer,intent(INOUT)                       :: n_points
+    real(kind=ep),intent(INOUT),dimension(:)    :: T, H, Hnew
+    INTEGER,intent(INOUT),dimension(:)          :: IERR
+    real(kind=ep),intent(INOUT),dimension(:,:)  :: f
+    real(kind=ep),intent(INOUT),dimension(:,:)  :: RCONST, FIX
+    LOGICAL,intent(INOUT),dimension(:)          :: RejectLastH, RejectMoreH
+    integer,intent(INOUT),dimension(:)          :: Kacc, Krej
+
+!-- local variables
+    integer                          :: i,jl
+    integer                          :: ic
+
+!   Check, if converged variables exist
+
+!    write(9,*) 'kco_compress_1 ',cell_done(1:kpoints)
+
+    if(.not. any(cell_done(1:kpoints)))   return
+
+    compress_done = .TRUE.
+
+!   Move converged cells to original position
+
+    do i=1,size(f,2)
+!CDIR NODEP
+      do jl=1,kpoints
+        if(cell_done(jl))   then
+          f_done(index_org(jl),i) = f(jl,i) 
+        end if
+      end do
+    end do
+    
+    do jl=1,kpoints
+      if(cell_done(jl))   then
+        ierr_done(index_org(jl)) = ierr(jl) 
+        Kacc_done(index_org(jl)) = Kacc(jl) 
+        Krej_done(index_org(jl)) = Krej(jl) 
+      end if
+    end do
+
+!CDIR NODEP
+    do jl=1,kpoints
+      if(cell_done(jl))   then
+        done_check(index_org(jl)) = .true.
+      end if
+    end do
+
+!    write(9,*) 'done check ',kpoints,count(done_check)
+        
+!   Compute new index vector
+
+    ic = 0
+    do jl=1,kpoints
+      if(.not.cell_done(jl))   then
+        ic = ic+1
+        index_step(ic) = jl
+      end if
+    end do
+
+!    write(9,*) 'new number of points: ',ic,kpoints,count(done_check)
+
+!   Set new number of Points
+
+    kpoints  = ic
+    n_points = ic
+
+!   Compress arrays
+
+    index_org(1:ic) = index_org(index_step(1:ic))
+
+    do i=1,size(f,2)
+      f(1:ic,i) = f(index_step(1:ic),i)
+    end do
+
+!   compress argument list arrays
+
+    T(1:ic)           = T(index_step(1:ic))
+    IERR(1:ic)        = IERR(index_step(1:ic))
+    H(1:ic)           = H(index_step(1:ic))
+    Hnew(1:ic)        = Hnew(index_step(1:ic))
+
+    do i=1,size(RCONST,2)
+       RCONST(1:ic,i) = RCONST(index_step(1:ic),i)
+    end do
+
+    do i=1,size(FIX,2)
+       FIX(1:ic,i)    = FIX(index_step(1:ic),i)
+    end do
+
+    RejectLastH(1:ic) = RejectLastH(index_step(1:ic))
+    RejectMoreH(1:ic) = RejectMoreH(index_step(1:ic))
+    Kacc(1:ic)        = Kacc(index_step(1:ic))
+    Krej(1:ic)        = Krej(index_step(1:ic))
+    cell_done(1:ic)   = cell_done(index_step(1:ic))
+!    write(9,*) 'kco_compress_3 ',n_points
+
+    return
+  end SUBROUTINE kco_compress
+
+  SUBROUTINE kco_finalize ( f, IERR, Kacc, Krej)
+    implicit    none
+    real(kind=ep),intent(INOUT),dimension(:,:)   :: f 
+    integer,      intent(INOUT),dimension(:)     :: IERR, Kacc, Krej
+
+!    write(9,*) 'kco_finalize ',kpoints,kpoints_save
+
+    if(compress_done)  then
+       kpoints = kpoints_save
+
+       f(1:kpoints,:)  = f_done(1:kpoints,:)   ! mz_pj_20070903 (1:kpoints) added
+       ierr(1:kpoints) = ierr_done(1:kpoints)  ! mz_pj_20070903 ...
+       Kacc(1:kpoints) = Kacc_done(1:kpoints)  ! mz_pj_20070903 ...
+       Krej(1:kpoints) = Krej_done(1:kpoints)  ! mz_pj_20070903 ...
+    end if
+
+    deallocate(index_org)
+    deallocate(index_step)
+    deallocate(cell_done)
+    deallocate(done_check)
+
+    deallocate(f_done)
+    deallocate(ierr_done)
+    deallocate(Kacc_done)
+    deallocate(Krej_done)
+
+    return
+  end SUBROUTINE kco_finalize
+
+end module kp4_compress
Index: palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/templates/module_header
===================================================================
--- palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/templates/module_header	(revision 3298)
+++ palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/templates/module_header	(revision 3458)
@@ -40,25 +40,9 @@
 !--------------------------------------------------------------------------------!
 !
-! Current revisions:
-! ------------------
-! 
-! 
-! Former revisions:
-! -----------------
-! $Id: module_header 2460 2017-09-13 14:47:48Z forkel $
-! forkel June 2018: qvap, fakt added
-! forkel June 2018: reset case in  Initialize, Integrate, Update_rconst
-! 
-! 
-! 2460 2017-09-13 14:47:48Z forkel
 !
-! forkel Sept. 2017: Variables for photolyis added
+! MODULE HEADER TEMPLATE
 !
-!
-! Nov. 2016: Intial version (Klaus Ketelsen)
-!
-!------------------------------------------------------------------------------!
-!
-
+!  Initial version (Nov. 2016, ketelsen), for later modifications of module_header 
+!  see comments in kpp4palm/src/create_kpp_module.C
 
 ! Set kpp Double Precision to PALM Default Precision
