Index: /branches/petra/changelog.txt
===================================================================
--- /branches/petra/changelog.txt	(revision 36)
+++ /branches/petra/changelog.txt	(revision 36)
@@ -0,0 +1,34 @@
+Changes applied to checkout of branch petra (rev 33 = rev31 in trunk)
+======================================================================
+
+Remove x permission from 56 text files
+
+Convert 2 text files form DOS to Unix format
+
+concoutput.f90:
+
+Reinitialization of grid
+- convert loops to f90 array assignments (there were even unnecessary multiple loops for creceptor(i,ks)=0. over kp=1,maxpointspec_act, and loops in wrong order!)
+- add reinitialisation of wetgridunc and drygridunc if new variable ldep_incr true
+
+concoutput_nest.f90:
+
+Reinitialization of grid
+- convert loops to f90 array assignments (there were even unnecessary multiple loops for creceptor(i,ks)=0. over kp=1,maxpointspec_act, and loops in wrong order!)
+- add reinitialisation of wetgridunc and drygridunc if new variable ldep_incr true
+- remove reinitalisation of creceptor, this is alread done in concoutput.f90
+
+readcommand.f90, skplin.f90, com_mod.f90:
+
+- add ldep_incr to namelist command in readcommand.f90, intialise as false
+- read ldep_incr normally but catch exception if not present, then use default
+- for this purpose catch EOF also in skplin.f90
+- in readcommand.f90, add spaces for logical operators
+- in com_mod.f90, add ldep_incr, and make all variable names lowercase, add GNU
+
+FLEXPART.f90, readpaths.f90: eliminate pathname from calling readpaths, it is 
+already in module com. Eliminate commented formal argument from readpaths.f90
+
+par_mod.f90: nxhsift=0 also for ECMWF, seems to be needed
+
+writeheader_text.f90, writeheader.f90, writeheader_nest.f90: introduce version string length output, enclose character output in quotes in text output, change name of header_text files to *.txt
Index: /branches/petra/options/COMMAND
===================================================================
--- /branches/petra/options/COMMAND	(revision 35)
+++ /branches/petra/options/COMMAND	(revision 36)
@@ -105,4 +105,8 @@
     0
     SURF_ONLY        IF THIS IS SET TO 1, OUTPUT IS WRITTEN ONLY OUT FOR LOWEST LAYER
+
+25. _                4x, logical
+    .false.          
+    LDEP_INCR        IF .TRUE., INCREMENTAL DEPOSITION, ELSE ACCUMULATED DEPOSITION (=DEFAULT)
 
 
Index: /branches/petra/options/COMMAND.alternative
===================================================================
--- /branches/petra/options/COMMAND.alternative	(revision 35)
+++ /branches/petra/options/COMMAND.alternative	(revision 36)
@@ -31,4 +31,5 @@
 2               LINIT_COND        INITIAL COND. FOR BW RUNS: 0=NO,1=MASS UNIT,2=MASS MIXING RATIO UNIT
 0               SURF_ONLY         IF THIS IS SET TO 1, OUTPUT IS WRITTEN ONLY OUT FOR LOWEST LAYER
+.f.             LDEP_INCR         IF .TRUE., INCREMENTAL DEPOSITION, ELSE ACCUMULATED DEPOSITION (=DEFAULT)
 
 
Index: /branches/petra/options/COMMAND.reference
===================================================================
--- /branches/petra/options/COMMAND.reference	(revision 35)
+++ /branches/petra/options/COMMAND.reference	(revision 36)
@@ -11,9 +11,9 @@
 
 2. ________ ______   3X, I8, 1X, I6
-   20110310 000000
+   20111210 000000
    YYYYMMDD HHMISS   BEGINNING DATE OF SIMULATION
 
 3. ________ ______   3X, I8, 1X, I6
-   20110310 120000
+   20111210 120000
    YYYYMMDD HHMISS   ENDING DATE OF SIMULATION
 
@@ -105,4 +105,8 @@
     0
     SURF_ONLY        IF THIS IS SET TO 1, OUTPUT IS WRITTEN ONLY OUT FOR LOWEST LAYER
+
+25. _                4x, logical
+    .false.          
+    LDEP_INCR        IF .TRUE., INCREMENTAL DEPOSITION, ELSE ACCUMULATED DEPOSITION (=DEFAULT)
 
 
Index: /branches/petra/options/surfdata.t
===================================================================
--- /branches/petra/options/surfdata.t	(revision 35)
+++ /branches/petra/options/surfdata.t	(revision 36)
Index: /branches/petra/src/FLEXPART.f90
===================================================================
--- /branches/petra/src/FLEXPART.f90	(revision 35)
+++ /branches/petra/src/FLEXPART.f90	(revision 36)
@@ -1,4 +1,4 @@
 !**********************************************************************
-! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010         *
+! Copyright 1998-2015                                                 *
 ! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa,             *
 ! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann   *
@@ -66,5 +66,5 @@
 
   ! FLEXPART version string
-  flexversion='Version 9.2 beta (2014-07-01)'
+  flexversion='Version 9.2_beta.r34 (2015-02-12)'
   verbosity=0
 
@@ -119,5 +119,5 @@
     write(*,*) 'call readpaths'
   endif 
-  call readpaths(pathfile)
+  call readpaths
  
   if (verbosity.gt.1) then !show clock info 
Index: /branches/petra/src/advance.f90
===================================================================
--- /branches/petra/src/advance.f90	(revision 35)
+++ /branches/petra/src/advance.f90	(revision 36)
@@ -1,4 +1,4 @@
 !**********************************************************************
-! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010         *
+! Copyright 1998-2015                                                 *
 ! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa,             *
 ! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann   *
@@ -61,5 +61,6 @@
   !  8 April 2000: Deep convection parameterization                            *
   !                                                                            *
-  !  May 2002: Petterssen scheme introduced                                    *
+  !  May 2002: Petterssen scheme introduced  
+  !  PS, 2/2015: fix mixture of real and dp in call to funtion mod
   !                                                                            *
   !*****************************************************************************
@@ -707,8 +708,8 @@
 
   if ( yt.lt.0. ) then
-    xt=mod(xt+180.,360.)
+    xt=mod(xt+180._dp,360._dp)
     yt=-yt
   else if ( yt.gt.real(nymin1) ) then
-    xt=mod(xt+180.,360.)
+    xt=mod(xt+180._dp,360._dp)
     yt=2*real(nymin1)-yt
   endif
@@ -877,8 +878,8 @@
 
   if ( yt.lt.0. ) then
-    xt=mod(xt+180.,360.)
+    xt=mod(xt+180._dp,360._dp)
     yt=-yt
   else if ( yt.gt.real(nymin1) ) then
-    xt=mod(xt+180.,360.)
+    xt=mod(xt+180._dp,360._dp)
     yt=2*real(nymin1)-yt
   endif
Index: /branches/petra/src/com_mod.f90
===================================================================
--- /branches/petra/src/com_mod.f90	(revision 35)
+++ /branches/petra/src/com_mod.f90	(revision 36)
@@ -1,2 +1,25 @@
+!**********************************************************************
+! Copyright 1998-2015                                                 *
+! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa,             *
+! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann   *
+!                                                                     *
+! This file is part of FLEXPART.                                      *
+!                                                                     *
+! FLEXPART is free software: you can redistribute it and/or modify    *
+! it under the terms of the GNU General Public License as published by*
+! the Free Software Foundation, either version 3 of the License, or   *
+! (at your option) any later version.                                 *
+!                                                                     *
+! FLEXPART is distributed in the hope that it will be useful,         *
+! but WITHOUT ANY WARRANTY; without even the implied warranty of      *
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the       *
+! GNU General Public License for more details.                        *
+!                                                                     *
+! You should have received a copy of the GNU General Public License   *
+! along with FLEXPART.  If not, see <http://www.gnu.org/licenses/>.   *
+!**********************************************************************
+
+module com_mod
+
 !*******************************************************************************
 !        Include file for particle diffusion model FLEXPART                    *
@@ -7,9 +30,8 @@
 !        June 1996                                                             *
 !                                                                              *
-!        Last update:15 August 2013 IP                                         *
+!        Modifications: 15 August 2013 IP, 
+!        2/2015 PS, add incremental deposition switch
 !                                                                              *
 !*******************************************************************************
-
-module com_mod
 
   use par_mod, only: dp, numpath, maxnests, maxageclass, maxspec, ni, &
@@ -69,5 +91,5 @@
   integer :: mquasilag,nested_output,ind_source,ind_receptor
   integer :: ind_rel,ind_samp,ioutputforeachrelease,linit_cond,surf_only
-  logical :: turbswitch
+  logical :: turbswitch, ldep_incr
 
   ! ctl      factor, by which time step must be smaller than Lagrangian time scale
@@ -98,4 +120,5 @@
   ! nested_output: 0 no, 1 yes
   ! turbswitch              determines how the Markov chain is formulated
+  ! ldep_incr: .true. incremental deposition, .false. accumulated deposition
 
   ! ind_rel and ind_samp  are used within the code to change between mass and mass-mix (see readcommand.f)
@@ -136,5 +159,5 @@
   character :: compoint(1001)*45
   integer :: numpoint
-  !sec, now dynamically allocated:
+  !SE, now dynamically allocated:
   ! ireleasestart(maxpoint),ireleaseend(maxpoint)
   !      real xpoint1(maxpoint),ypoint1(maxpoint)
@@ -155,5 +178,5 @@
   real :: rgs(maxspec,5,numclass),rlu(maxspec,5,numclass)
   real :: rm(maxspec),dryvel(maxspec),kao(maxspec),ohreact(maxspec)
-  ! se  it is possible to associate a species with a second one to make transfer from gas to aerosol
+  ! SE  it is possible to associate a species with a second one to make transfer from gas to aerosol
   integer :: spec_ass(maxspec)
 
@@ -549,5 +572,5 @@
   real :: dxoutn,dyoutn,outlon0n,outlat0n,xoutshiftn,youtshiftn
   !real outheight(maxzgrid),outheighthalf(maxzgrid)
-  logical :: DEP,DRYDEP,DRYDEPSPEC(maxspec),WETDEP,OHREA,ASSSPEC
+  logical :: dep,drydep,drydepspec(maxspec),wetdep,ohrea,assspec
 
   ! numxgrid,numygrid       number of grid points in x,y-direction
@@ -562,10 +585,10 @@
   ! outheight [m]           upper levels of the output grid
   ! outheighthalf [m]       half (middle) levels of the output grid cells
-  ! DEP                     .true., if either dry or wet depos. is switched on
-  ! DRYDEP                  .true., if dry deposition is switched on
-  ! DRYDEPSPEC              .true., if dry deposition is switched on for that species
-  ! WETDEP                  .true., if wet deposition is switched on
-  ! OHREA                   .true., if OH reaction is switched on
-  ! ASSSPEC                 .true., if there are two species asscoiated
+  ! dep                     .true., if either dry or wet depos. is switched on
+  ! drydep                  .true., if dry deposition is switched on
+  ! drydepspec              .true., if dry deposition is switched on for that species
+  ! wetdep                  .true., if wet deposition is switched on
+  ! ohrea                   .true., if oh reaction is switched on
+  ! assspec                 .true., if there are two species asscoiated
   !                    (i.e. transfer of mass between these two occurs
 
Index: /branches/petra/src/concoutput.f90
===================================================================
--- /branches/petra/src/concoutput.f90	(revision 35)
+++ /branches/petra/src/concoutput.f90	(revision 36)
@@ -1,4 +1,4 @@
 !**********************************************************************
-! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010         *
+! Copyright 1998-2015                                                 *
 ! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa,             *
 ! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann   *
@@ -47,4 +47,6 @@
   !                                                                            *
   !     2008 new sparse matrix format                                          *
+  !     PS, 2/2015: option to produce incremental deposition output 
+  !                 access= -> position=
   !                                                                            *
   !*****************************************************************************
@@ -108,5 +110,5 @@
   write(adate,'(i8.8)') jjjjmmdd
   write(atime,'(i6.6)') ihmmss
-  open(unitdates,file=path(2)(1:length(2))//'dates', ACCESS='APPEND')
+  open(unitdates,file=path(2)(1:length(2))//'dates', position='append')
   write(unitdates,'(a)') adate//atime
   close(unitdates)  
@@ -588,23 +590,10 @@
   !*************************
 
-  do ks=1,nspec
-  do kp=1,maxpointspec_act
-    do i=1,numreceptor
-      creceptor(i,ks)=0.
-    end do
-    do jy=0,numygrid-1
-      do ix=0,numxgrid-1
-        do l=1,nclassunc
-          do nage=1,nageclass
-            do kz=1,numzgrid
-              gridunc(ix,jy,kz,ks,kp,l,nage)=0.
-            end do
-          end do
-        end do
-      end do
-    end do
-  end do
-  end do
-
-
+  creceptor=0.
+  gridunc=0.
+  if (ldep_incr) then ! incremental deposition output
+    wetgridunc=0.
+    drygridunc=0.
+  endif
+  
 end subroutine concoutput
Index: /branches/petra/src/concoutput_nest.f90
===================================================================
--- /branches/petra/src/concoutput_nest.f90	(revision 35)
+++ /branches/petra/src/concoutput_nest.f90	(revision 36)
@@ -1,4 +1,4 @@
 !**********************************************************************
-! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010         *
+! Copyright 1998-2015                                                 *
 ! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa,             *
 ! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann   *
@@ -45,4 +45,6 @@
   !                                                                            *
   !     2008 new sparse matrix format                                          *
+  !     PS, 2/2015: option to produce incremental deposition output 
+  !                 access= -> position=
   !                                                                            *
   !*****************************************************************************
@@ -112,17 +114,17 @@
 
 
-    if (ldirect.eq.1) then
-       do ks=1,nspec
-         do kp=1,maxpointspec_act
-           tot_mu(ks,kp)=1
-         end do
-       end do
-   else
-      do ks=1,nspec
-             do kp=1,maxpointspec_act
-               tot_mu(ks,kp)=xmass(kp,ks)
-             end do
-      end do
-    endif
+  if (ldirect.eq.1) then
+    do ks=1,nspec
+      do kp=1,maxpointspec_act
+        tot_mu(ks,kp)=1
+      end do
+    end do
+  else
+    do ks=1,nspec
+      do kp=1,maxpointspec_act
+        tot_mu(ks,kp)=xmass(kp,ks)
+      end do
+    end do
+  endif
 
 
@@ -162,25 +164,25 @@
   end do
 
-    do i=1,numreceptor
-      xl=xreceptor(i)
-      yl=yreceptor(i)
-      iix=max(min(nint(xl),nxmin1),0)
-      jjy=max(min(nint(yl),nymin1),0)
-      densityoutrecept(i)=rho(iix,jjy,1,2)
-    end do
-
-
-  ! Output is different for forward and backward simulations
-    do kz=1,numzgrid
-      do jy=0,numygridn-1
-        do ix=0,numxgridn-1
-          if (ldirect.eq.1) then
-            factor3d(ix,jy,kz)=1.e12/volumen(ix,jy,kz)/outnum
-          else
-            factor3d(ix,jy,kz)=real(abs(loutaver))/outnum
-          endif
-        end do
-      end do
-    end do
+  do i=1,numreceptor
+    xl=xreceptor(i)
+    yl=yreceptor(i)
+    iix=max(min(nint(xl),nxmin1),0)
+    jjy=max(min(nint(yl),nymin1),0)
+    densityoutrecept(i)=rho(iix,jjy,1,2)
+  end do
+
+
+! Output is different for forward and backward simulations
+  do kz=1,numzgrid
+    do jy=0,numygridn-1
+      do ix=0,numxgridn-1
+        if (ldirect.eq.1) then
+          factor3d(ix,jy,kz)=1.e12/volumen(ix,jy,kz)/outnum
+        else
+          factor3d(ix,jy,kz)=real(abs(loutaver))/outnum
+        endif
+      end do
+    end do
+  end do
 
   !*********************************************************************
@@ -191,178 +193,281 @@
   do ks=1,nspec
 
-  write(anspec,'(i3.3)') ks
-  if ((iout.eq.1).or.(iout.eq.3).or.(iout.eq.5)) then
-    if (ldirect.eq.1) then
-      open(unitoutgrid,file=path(2)(1:length(2))//'grid_conc_nest_' &
-           //adate// &
-           atime//'_'//anspec,form='unformatted')
-    else
-      open(unitoutgrid,file=path(2)(1:length(2))//'grid_time_nest_' &
-           //adate// &
-           atime//'_'//anspec,form='unformatted')
+    write(anspec,'(i3.3)') ks
+    if ((iout.eq.1).or.(iout.eq.3).or.(iout.eq.5)) then
+      if (ldirect.eq.1) then
+        open(unitoutgrid,file=path(2)(1:length(2))//'grid_conc_nest_' &
+             //adate// atime//'_'//anspec,form='unformatted')
+      else
+        open(unitoutgrid,file=path(2)(1:length(2))//'grid_time_nest_' &
+             //adate// atime//'_'//anspec,form='unformatted')
+      endif
+       write(unitoutgrid) itime
+     endif
+
+    if ((iout.eq.2).or.(iout.eq.3)) then      ! mixing ratio
+     open(unitoutgridppt,file=path(2)(1:length(2))//'grid_pptv_nest_' &
+          //adate// atime//'_'//anspec,form='unformatted')
+
+      write(unitoutgridppt) itime
     endif
-     write(unitoutgrid) itime
-   endif
-
-  if ((iout.eq.2).or.(iout.eq.3)) then      ! mixing ratio
-   open(unitoutgridppt,file=path(2)(1:length(2))//'grid_pptv_nest_' &
-        //adate// &
-        atime//'_'//anspec,form='unformatted')
-
-    write(unitoutgridppt) itime
-  endif
-
-  do kp=1,maxpointspec_act
-  do nage=1,nageclass
-
-    do jy=0,numygridn-1
-      do ix=0,numxgridn-1
-
-  ! WET DEPOSITION
-        if ((WETDEP).and.(ldirect.gt.0)) then
+
+    do kp=1,maxpointspec_act
+    do nage=1,nageclass
+
+      do jy=0,numygridn-1
+        do ix=0,numxgridn-1
+
+    ! WET DEPOSITION
+          if ((WETDEP).and.(ldirect.gt.0)) then
             do l=1,nclassunc
               auxgrid(l)=wetgriduncn(ix,jy,ks,kp,l,nage)
             end do
-            call mean(auxgrid,wetgrid(ix,jy), &
-                 wetgridsigma(ix,jy),nclassunc)
-  ! Multiply by number of classes to get total concentration
-            wetgrid(ix,jy)=wetgrid(ix,jy) &
-                 *nclassunc
-  ! Calculate standard deviation of the mean
-            wetgridsigma(ix,jy)= &
-                 wetgridsigma(ix,jy)* &
-                 sqrt(real(nclassunc))
-        endif
-
-  ! DRY DEPOSITION
-        if ((DRYDEP).and.(ldirect.gt.0)) then
+            call mean(auxgrid,wetgrid(ix,jy), wetgridsigma(ix,jy),nclassunc)
+    ! Multiply by number of classes to get total concentration
+            wetgrid(ix,jy)=wetgrid(ix,jy)*nclassunc
+    ! Calculate standard deviation of the mean
+            wetgridsigma(ix,jy)= wetgridsigma(ix,jy)* sqrt(real(nclassunc))
+          endif
+
+    ! DRY DEPOSITION
+          if ((DRYDEP).and.(ldirect.gt.0)) then
             do l=1,nclassunc
               auxgrid(l)=drygriduncn(ix,jy,ks,kp,l,nage)
             end do
-            call mean(auxgrid,drygrid(ix,jy), &
-                 drygridsigma(ix,jy),nclassunc)
-  ! Multiply by number of classes to get total concentration
-            drygrid(ix,jy)=drygrid(ix,jy)* &
-                 nclassunc
-  ! Calculate standard deviation of the mean
-            drygridsigma(ix,jy)= &
-                 drygridsigma(ix,jy)* &
-                 sqrt(real(nclassunc))
-        endif
-
-  ! CONCENTRATION OR MIXING RATIO
-        do kz=1,numzgrid
+            call mean(auxgrid,drygrid(ix,jy), drygridsigma(ix,jy),nclassunc)
+    ! Multiply by number of classes to get total concentration
+            drygrid(ix,jy)=drygrid(ix,jy)* nclassunc
+    ! Calculate standard deviation of the mean
+            drygridsigma(ix,jy)= drygridsigma(ix,jy)* sqrt(real(nclassunc))
+          endif
+
+    ! CONCENTRATION OR MIXING RATIO
+          do kz=1,numzgrid
             do l=1,nclassunc
               auxgrid(l)=griduncn(ix,jy,kz,ks,kp,l,nage)
             end do
-            call mean(auxgrid,grid(ix,jy,kz), &
-                 gridsigma(ix,jy,kz),nclassunc)
-  ! Multiply by number of classes to get total concentration
-            grid(ix,jy,kz)= &
-                 grid(ix,jy,kz)*nclassunc
-  ! Calculate standard deviation of the mean
-            gridsigma(ix,jy,kz)= &
-                 gridsigma(ix,jy,kz)* &
-                 sqrt(real(nclassunc))
+            call mean(auxgrid,grid(ix,jy,kz), gridsigma(ix,jy,kz),nclassunc)
+    ! Multiply by number of classes to get total concentration
+            grid(ix,jy,kz)= grid(ix,jy,kz)*nclassunc
+    ! Calculate standard deviation of the mean
+            gridsigma(ix,jy,kz)= gridsigma(ix,jy,kz)* sqrt(real(nclassunc))
+          end do
         end do
       end do
-    end do
-
-
-  !*******************************************************************
-  ! Generate output: may be in concentration (ng/m3) or in mixing
-  ! ratio (ppt) or both
-  ! Output the position and the values alternated multiplied by
-  ! 1 or -1, first line is number of values, number of positions
-  ! For backward simulations, the unit is seconds, stored in grid_time
-  !*******************************************************************
-
-  ! Concentration output
-  !*********************
-  if ((iout.eq.1).or.(iout.eq.3).or.(iout.eq.5)) then
-
-  ! Wet deposition
-         sp_count_i=0
-         sp_count_r=0
-         sp_fact=-1.
-         sp_zer=.true.
-         if ((ldirect.eq.1).and.(WETDEP)) then
-         do jy=0,numygridn-1
-            do ix=0,numxgridn-1
-  !oncentraion greater zero
-              if (wetgrid(ix,jy).gt.smallnum) then
-                 if (sp_zer.eqv..true.) then ! first non zero value
-                    sp_count_i=sp_count_i+1
-                    sparse_dump_i(sp_count_i)=ix+jy*numxgridn
-                    sp_zer=.false.
-                    sp_fact=sp_fact*(-1.)
-                 endif
-                 sp_count_r=sp_count_r+1
-                 sparse_dump_r(sp_count_r)= &
-                      sp_fact*1.e12*wetgrid(ix,jy)/arean(ix,jy)
+
+
+    !*******************************************************************
+    ! Generate output: may be in concentration (ng/m3) or in mixing
+    ! ratio (ppt) or both
+    ! Output the position and the values alternated multiplied by
+    ! 1 or -1, first line is number of values, number of positions
+    ! For backward simulations, the unit is seconds, stored in grid_time
+    !*******************************************************************
+
+    ! Concentration output
+    !*********************
+    if ((iout.eq.1).or.(iout.eq.3).or.(iout.eq.5)) then
+
+    ! Wet deposition
+      sp_count_i=0
+      sp_count_r=0
+      sp_fact=-1.
+      sp_zer=.true.
+      if ((ldirect.eq.1).and.(WETDEP)) then
+      do jy=0,numygridn-1
+        do ix=0,numxgridn-1
+    ! concentration greater zero
+          if (wetgrid(ix,jy).gt.smallnum) then
+            if (sp_zer.eqv..true.) then ! first non zero value
+              sp_count_i=sp_count_i+1
+              sparse_dump_i(sp_count_i)=ix+jy*numxgridn
+              sp_zer=.false.
+              sp_fact=sp_fact*(-1.)
+            endif
+            sp_count_r=sp_count_r+1
+            sparse_dump_r(sp_count_r)= sp_fact*1.e12*wetgrid(ix,jy)/arean(ix,jy)
   !                sparse_dump_u(sp_count_r)=
   !+                1.e12*wetgridsigma(ix,jy,ks,kp,nage)/area(ix,jy)
+          else ! concentration is zero
+            sp_zer=.true.
+          endif
+       end do
+      end do
+      else
+        sp_count_i=0
+        sp_count_r=0
+      endif
+      write(unitoutgrid) sp_count_i
+      write(unitoutgrid) (sparse_dump_i(i),i=1,sp_count_i)
+      write(unitoutgrid) sp_count_r
+      write(unitoutgrid) (sparse_dump_r(i),i=1,sp_count_r)
+    !       write(unitoutgrid) sp_count_u
+    !       write(unitoutgrid) (sparse_dump_u(i),i=1,sp_count_r)
+
+    ! Dry deposition
+      sp_count_i=0
+      sp_count_r=0
+      sp_fact=-1.
+      sp_zer=.true.
+      if ((ldirect.eq.1).and.(DRYDEP)) then
+       do jy=0,numygridn-1
+         do ix=0,numxgridn-1
+           if (drygrid(ix,jy).gt.smallnum) then
+             if (sp_zer.eqv..true.) then ! first non zero value
+                sp_count_i=sp_count_i+1
+                sparse_dump_i(sp_count_i)=ix+jy*numxgridn
+                sp_zer=.false.
+                sp_fact=sp_fact*(-1.)
+             endif
+             sp_count_r=sp_count_r+1
+             sparse_dump_r(sp_count_r)= sp_fact* &
+                  1.e12*drygrid(ix,jy)/arean(ix,jy)
+  !                sparse_dump_u(sp_count_r)=
+  !+                1.e12*drygridsigma(ix,jy,ks,kp,nage)/area(ix,jy)
+           else ! concentration is zero
+             sp_zer=.true.
+           endif
+         end do
+       end do
+      else
+        sp_count_i=0
+        sp_count_r=0
+      endif
+      write(unitoutgrid) sp_count_i
+      write(unitoutgrid) (sparse_dump_i(i),i=1,sp_count_i)
+      write(unitoutgrid) sp_count_r
+      write(unitoutgrid) (sparse_dump_r(i),i=1,sp_count_r)
+    !       write(*,*) sp_count_u
+    !       write(unitoutgrid) (sparse_dump_u(i),i=1,sp_count_r)
+
+
+
+    ! Concentrations
+      sp_count_i=0
+      sp_count_r=0
+      sp_fact=-1.
+      sp_zer=.true.
+      do kz=1,numzgrid
+        do jy=0,numygridn-1
+          do ix=0,numxgridn-1
+            if (grid(ix,jy,kz).gt.smallnum) then
+              if (sp_zer.eqv..true.) then ! first non zero value
+                sp_count_i=sp_count_i+1
+                sparse_dump_i(sp_count_i)= &
+                      ix+jy*numxgridn+kz*numxgridn*numygridn
+                sp_zer=.false.
+                sp_fact=sp_fact*(-1.)
+              endif
+              sp_count_r=sp_count_r+1
+              sparse_dump_r(sp_count_r)= sp_fact* grid(ix,jy,kz)* &
+                     factor3d(ix,jy,kz)/tot_mu(ks,kp)
+  !                 if ((factor(ix,jy,kz)/tot_mu(ks,kp)).eq.0)
+  !    +              write (*,*) factor(ix,jy,kz),tot_mu(ks,kp),ks,kp
+  !                sparse_dump_u(sp_count_r)=
+  !+               ,gridsigma(ix,jy,kz,ks,kp,nage)*
+  !+               factor(ix,jy,kz)/tot_mu(ks,kp)
+            else ! concentration is zero
+              sp_zer=.true.
+            endif
+          end do
+        end do
+      end do
+      write(unitoutgrid) sp_count_i
+      write(unitoutgrid) (sparse_dump_i(i),i=1,sp_count_i)
+      write(unitoutgrid) sp_count_r
+      write(unitoutgrid) (sparse_dump_r(i),i=1,sp_count_r)
+    !       write(unitoutgrid) sp_count_u
+    !       write(unitoutgrid) (sparse_dump_u(i),i=1,sp_count_r)
+
+
+
+      endif !  concentration output
+
+    ! Mixing ratio output
+    !********************
+
+      if ((iout.eq.2).or.(iout.eq.3)) then      ! mixing ratio
+
+      ! Wet deposition
+        sp_count_i=0
+        sp_count_r=0
+        sp_fact=-1.
+        sp_zer=.true.
+        if ((ldirect.eq.1).and.(WETDEP)) then
+          do jy=0,numygridn-1
+            do ix=0,numxgridn-1
+              if (wetgrid(ix,jy).gt.smallnum) then
+                if (sp_zer.eqv..true.) then ! first non zero value
+                  sp_count_i=sp_count_i+1
+                  sparse_dump_i(sp_count_i)= ix+jy*numxgridn
+                  sp_zer=.false.
+                  sp_fact=sp_fact*(-1.)
+                endif
+                sp_count_r=sp_count_r+1
+                sparse_dump_r(sp_count_r)= sp_fact* &
+                   1.e12*wetgrid(ix,jy)/arean(ix,jy)
+    !                sparse_dump_u(sp_count_r)=
+    !    +            ,1.e12*wetgridsigma(ix,jy,ks,kp,nage)/area(ix,jy)
               else ! concentration is zero
-                  sp_zer=.true.
+                sp_zer=.true.
               endif
             end do
-         end do
-         else
-            sp_count_i=0
-            sp_count_r=0
-         endif
-         write(unitoutgrid) sp_count_i
-         write(unitoutgrid) (sparse_dump_i(i),i=1,sp_count_i)
-         write(unitoutgrid) sp_count_r
-         write(unitoutgrid) (sparse_dump_r(i),i=1,sp_count_r)
-  !       write(unitoutgrid) sp_count_u
-  !       write(unitoutgrid) (sparse_dump_u(i),i=1,sp_count_r)
-
-  ! Dry deposition
-         sp_count_i=0
-         sp_count_r=0
-         sp_fact=-1.
-         sp_zer=.true.
-         if ((ldirect.eq.1).and.(DRYDEP)) then
+          end do
+        else
+          sp_count_i=0
+          sp_count_r=0
+        endif
+        write(unitoutgridppt) sp_count_i
+        write(unitoutgridppt) (sparse_dump_i(i),i=1,sp_count_i)
+        write(unitoutgridppt) sp_count_r
+        write(unitoutgridppt) (sparse_dump_r(i),i=1,sp_count_r)
+    !       write(unitoutgridppt) sp_count_u
+    !       write(unitoutgridppt) (sparse_dump_u(i),i=1,sp_count_r)
+
+
+      ! Dry deposition
+        sp_count_i=0
+        sp_count_r=0
+        sp_fact=-1.
+        sp_zer=.true.
+        if ((ldirect.eq.1).and.(DRYDEP)) then
           do jy=0,numygridn-1
             do ix=0,numxgridn-1
               if (drygrid(ix,jy).gt.smallnum) then
-                 if (sp_zer.eqv..true.) then ! first non zero value
-                    sp_count_i=sp_count_i+1
-                    sparse_dump_i(sp_count_i)=ix+jy*numxgridn
-                    sp_zer=.false.
-                    sp_fact=sp_fact*(-1.)
-                 endif
-                 sp_count_r=sp_count_r+1
-                 sparse_dump_r(sp_count_r)= &
-                      sp_fact* &
-                      1.e12*drygrid(ix,jy)/arean(ix,jy)
-  !                sparse_dump_u(sp_count_r)=
-  !+                1.e12*drygridsigma(ix,jy,ks,kp,nage)/area(ix,jy)
+                if (sp_zer.eqv..true.) then ! first non zero value
+                  sp_count_i=sp_count_i+1
+                  sparse_dump_i(sp_count_i)= ix+jy*numxgridn
+                  sp_zer=.false.
+                  sp_fact=sp_fact*(-1)
+                endif
+                sp_count_r=sp_count_r+1
+                sparse_dump_r(sp_count_r)= sp_fact* &
+                     1.e12*drygrid(ix,jy)/arean(ix,jy)
+    !                sparse_dump_u(sp_count_r)=
+    !    +            ,1.e12*drygridsigma(ix,jy,ks,kp,nage)/area(ix,jy)
               else ! concentration is zero
-                  sp_zer=.true.
+                sp_zer=.true.
               endif
             end do
           end do
-         else
-            sp_count_i=0
-            sp_count_r=0
-         endif
-         write(unitoutgrid) sp_count_i
-         write(unitoutgrid) (sparse_dump_i(i),i=1,sp_count_i)
-         write(unitoutgrid) sp_count_r
-         write(unitoutgrid) (sparse_dump_r(i),i=1,sp_count_r)
-  !       write(*,*) sp_count_u
-  !       write(unitoutgrid) (sparse_dump_u(i),i=1,sp_count_r)
-
-
-
-  ! Concentrations
-         sp_count_i=0
-         sp_count_r=0
-         sp_fact=-1.
-         sp_zer=.true.
-          do kz=1,numzgrid
-            do jy=0,numygridn-1
+        else
+          sp_count_i=0
+          sp_count_r=0
+        endif
+        write(unitoutgridppt) sp_count_i
+        write(unitoutgridppt) (sparse_dump_i(i),i=1,sp_count_i)
+        write(unitoutgridppt) sp_count_r
+        write(unitoutgridppt) (sparse_dump_r(i),i=1,sp_count_r)
+    !       write(unitoutgridppt) sp_count_u
+    !       write(unitoutgridppt) (sparse_dump_u(i),i=1,sp_count_r)
+
+
+      ! Mixing ratios
+        sp_count_i=0
+        sp_count_r=0
+        sp_fact=-1.
+        sp_zer=.true.
+        do kz=1,numzgrid
+           do jy=0,numygridn-1
               do ix=0,numxgridn-1
                 if (grid(ix,jy,kz).gt.smallnum) then
@@ -370,161 +475,33 @@
                     sp_count_i=sp_count_i+1
                     sparse_dump_i(sp_count_i)= &
-                         ix+jy*numxgridn+kz*numxgridn*numygridn
-                    sp_zer=.false.
-                    sp_fact=sp_fact*(-1.)
-                   endif
-                   sp_count_r=sp_count_r+1
-                   sparse_dump_r(sp_count_r)= &
-                        sp_fact* &
-                        grid(ix,jy,kz)* &
-                        factor3d(ix,jy,kz)/tot_mu(ks,kp)
-  !                 if ((factor(ix,jy,kz)/tot_mu(ks,kp)).eq.0)
-  !    +              write (*,*) factor(ix,jy,kz),tot_mu(ks,kp),ks,kp
-  !                sparse_dump_u(sp_count_r)=
-  !+               ,gridsigma(ix,jy,kz,ks,kp,nage)*
-  !+               factor(ix,jy,kz)/tot_mu(ks,kp)
-              else ! concentration is zero
-                  sp_zer=.true.
-              endif
-              end do
-            end do
-          end do
-         write(unitoutgrid) sp_count_i
-         write(unitoutgrid) (sparse_dump_i(i),i=1,sp_count_i)
-         write(unitoutgrid) sp_count_r
-         write(unitoutgrid) (sparse_dump_r(i),i=1,sp_count_r)
-  !       write(unitoutgrid) sp_count_u
-  !       write(unitoutgrid) (sparse_dump_u(i),i=1,sp_count_r)
-
-
-
-    endif !  concentration output
-
-  ! Mixing ratio output
-  !********************
-
-  if ((iout.eq.2).or.(iout.eq.3)) then      ! mixing ratio
-
-  ! Wet deposition
-         sp_count_i=0
-         sp_count_r=0
-         sp_fact=-1.
-         sp_zer=.true.
-         if ((ldirect.eq.1).and.(WETDEP)) then
-          do jy=0,numygridn-1
-            do ix=0,numxgridn-1
-                if (wetgrid(ix,jy).gt.smallnum) then
-                  if (sp_zer.eqv..true.) then ! first non zero value
-                    sp_count_i=sp_count_i+1
-                    sparse_dump_i(sp_count_i)= &
-                         ix+jy*numxgridn
+                        ix+jy*numxgridn+kz*numxgridn*numygridn
                     sp_zer=.false.
                     sp_fact=sp_fact*(-1.)
                  endif
                  sp_count_r=sp_count_r+1
-                 sparse_dump_r(sp_count_r)= &
-                      sp_fact* &
-                      1.e12*wetgrid(ix,jy)/arean(ix,jy)
-  !                sparse_dump_u(sp_count_r)=
-  !    +            ,1.e12*wetgridsigma(ix,jy,ks,kp,nage)/area(ix,jy)
-              else ! concentration is zero
-                  sp_zer=.true.
+                 sparse_dump_r(sp_count_r)= sp_fact* 1.e12*grid(ix,jy,kz) &
+                     /volumen(ix,jy,kz)/outnum* &
+                     weightair/weightmolar(ks)/densityoutgrid(ix,jy,kz)
+    !                sparse_dump_u(sp_count_r)=
+    !+              ,1.e12*gridsigma(ix,jy,kz,ks,kp,nage)/volume(ix,jy,kz)/
+    !+              outnum*weightair/weightmolar(ks)/
+    !+              densityoutgrid(ix,jy,kz)
+                else ! concentration is zero
+                sp_zer=.true.
               endif
             end do
           end do
-         else
-           sp_count_i=0
-           sp_count_r=0
-         endif
-         write(unitoutgridppt) sp_count_i
-         write(unitoutgridppt) (sparse_dump_i(i),i=1,sp_count_i)
-         write(unitoutgridppt) sp_count_r
-         write(unitoutgridppt) (sparse_dump_r(i),i=1,sp_count_r)
-  !       write(unitoutgridppt) sp_count_u
-  !       write(unitoutgridppt) (sparse_dump_u(i),i=1,sp_count_r)
-
-
-  ! Dry deposition
-         sp_count_i=0
-         sp_count_r=0
-         sp_fact=-1.
-         sp_zer=.true.
-         if ((ldirect.eq.1).and.(DRYDEP)) then
-          do jy=0,numygridn-1
-            do ix=0,numxgridn-1
-                if (drygrid(ix,jy).gt.smallnum) then
-                  if (sp_zer.eqv..true.) then ! first non zero value
-                    sp_count_i=sp_count_i+1
-                    sparse_dump_i(sp_count_i)= &
-                         ix+jy*numxgridn
-                    sp_zer=.false.
-                    sp_fact=sp_fact*(-1)
-                 endif
-                 sp_count_r=sp_count_r+1
-                 sparse_dump_r(sp_count_r)= &
-                      sp_fact* &
-                      1.e12*drygrid(ix,jy)/arean(ix,jy)
-  !                sparse_dump_u(sp_count_r)=
-  !    +            ,1.e12*drygridsigma(ix,jy,ks,kp,nage)/area(ix,jy)
-              else ! concentration is zero
-                  sp_zer=.true.
-              endif
-            end do
-          end do
-         else
-           sp_count_i=0
-           sp_count_r=0
-         endif
-         write(unitoutgridppt) sp_count_i
-         write(unitoutgridppt) (sparse_dump_i(i),i=1,sp_count_i)
-         write(unitoutgridppt) sp_count_r
-         write(unitoutgridppt) (sparse_dump_r(i),i=1,sp_count_r)
-  !       write(unitoutgridppt) sp_count_u
-  !       write(unitoutgridppt) (sparse_dump_u(i),i=1,sp_count_r)
-
-
-  ! Mixing ratios
-         sp_count_i=0
-         sp_count_r=0
-         sp_fact=-1.
-         sp_zer=.true.
-          do kz=1,numzgrid
-            do jy=0,numygridn-1
-              do ix=0,numxgridn-1
-                if (grid(ix,jy,kz).gt.smallnum) then
-                  if (sp_zer.eqv..true.) then ! first non zero value
-                    sp_count_i=sp_count_i+1
-                    sparse_dump_i(sp_count_i)= &
-                         ix+jy*numxgridn+kz*numxgridn*numygridn
-                    sp_zer=.false.
-                    sp_fact=sp_fact*(-1.)
-                 endif
-                 sp_count_r=sp_count_r+1
-                 sparse_dump_r(sp_count_r)= &
-                      sp_fact* &
-                      1.e12*grid(ix,jy,kz) &
-                      /volumen(ix,jy,kz)/outnum* &
-                      weightair/weightmolar(ks)/densityoutgrid(ix,jy,kz)
-  !                sparse_dump_u(sp_count_r)=
-  !+              ,1.e12*gridsigma(ix,jy,kz,ks,kp,nage)/volume(ix,jy,kz)/
-  !+              outnum*weightair/weightmolar(ks)/
-  !+              densityoutgrid(ix,jy,kz)
-              else ! concentration is zero
-                  sp_zer=.true.
-              endif
-              end do
-            end do
-          end do
-         write(unitoutgridppt) sp_count_i
-         write(unitoutgridppt) (sparse_dump_i(i),i=1,sp_count_i)
-         write(unitoutgridppt) sp_count_r
-         write(unitoutgridppt) (sparse_dump_r(i),i=1,sp_count_r)
-  !       write(unitoutgridppt) sp_count_u
-  !       write(unitoutgridppt) (sparse_dump_u(i),i=1,sp_count_r)
+        end do
+        write(unitoutgridppt) sp_count_i
+        write(unitoutgridppt) (sparse_dump_i(i),i=1,sp_count_i)
+        write(unitoutgridppt) sp_count_r
+        write(unitoutgridppt) (sparse_dump_r(i),i=1,sp_count_r)
+    !       write(unitoutgridppt) sp_count_u
+    !       write(unitoutgridppt) (sparse_dump_u(i),i=1,sp_count_r)
 
       endif ! output for ppt
 
-  end do
-  end do
+    end do
+    end do
 
     close(unitoutgridppt)
@@ -538,24 +515,9 @@
   !*************************
 
-  do ks=1,nspec
-  do kp=1,maxpointspec_act
-    do i=1,numreceptor
-      creceptor(i,ks)=0.
-    end do
-    do jy=0,numygridn-1
-      do ix=0,numxgridn-1
-        do l=1,nclassunc
-          do nage=1,nageclass
-            do kz=1,numzgrid
-              griduncn(ix,jy,kz,ks,kp,l,nage)=0.
-            end do
-          end do
-        end do
-      end do
-    end do
-  end do
-  end do
-
+  griduncn=0.
+  if (ldep_incr) then ! incremental deposition output
+    wetgriduncn=0.
+    drygriduncn=0.
+  endif
 
 end subroutine concoutput_nest
-
Index: /branches/petra/src/concoutput_surf.f90
===================================================================
--- /branches/petra/src/concoutput_surf.f90	(revision 35)
+++ /branches/petra/src/concoutput_surf.f90	(revision 36)
@@ -116,5 +116,5 @@
   !write(unitdates,'(a)') adate//atime
 
-    open(unitdates,file=path(2)(1:length(2))//'dates', ACCESS='APPEND')
+    open(unitdates,file=path(2)(1:length(2))//'dates', position='append')
       write(unitdates,'(a)') adate//atime
     close(unitdates)
Index: /branches/petra/src/par_mod.f90
===================================================================
--- /branches/petra/src/par_mod.f90	(revision 35)
+++ /branches/petra/src/par_mod.f90	(revision 36)
@@ -1,4 +1,4 @@
 !**********************************************************************
-! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010         *
+! Copyright 1998-2015                                                 *
 ! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa,             *
 ! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann   *
@@ -28,5 +28,7 @@
 !        1997                                                                  *
 !                                                                              *
-!        Last update 15 August 2013 IP                                         *
+!        15 August 2013, IP                                                    *
+!        2/2015, PS: nshift=0, unitheader_txt -> unitheader_rel
+!                                                                              *
 !                                                                              *
 !*******************************************************************************
@@ -128,5 +130,5 @@
   !integer,parameter :: nxmax=1201,nymax=235,nuvzmax=58,nwzmax=58,nzmax=58
 
-  integer,parameter :: nxshift=359 ! for ECMWF
+  integer,parameter :: nxshift= 0 !359 ! for ECMWF
   !integer,parameter :: nxshift=0     ! for GFS or FNL (XF)
 
@@ -259,5 +261,5 @@
   integer,parameter :: unitlsm=1, unitsurfdata=1, unitland=1, unitwesely=1
   integer,parameter :: unitOH=1
-  integer,parameter :: unitdates=94, unitheader=90,unitheader_txt=100, unitshortpart=95
+  integer,parameter :: unitdates=94, unitheader=90,unitheader_rel=100, unitshortpart=95
   integer,parameter :: unitboundcond=89
 
Index: /branches/petra/src/readcommand.f90
===================================================================
--- /branches/petra/src/readcommand.f90	(revision 35)
+++ /branches/petra/src/readcommand.f90	(revision 36)
@@ -1,4 +1,4 @@
 !**********************************************************************
-! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010         *
+! Copyright 1998-2015                                                 *
 ! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa,             *
 ! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann   *
@@ -29,6 +29,8 @@
   !                                                                            *
   !     18 May 1996                                                            *
-  !     HSO, 1 July 2014                                                       *
-  !     Added optional namelist input                                          *
+  !
+  !     HSO, 1 July 2014: Added optional namelist input
+  !     PS 2/2015: add ldep_incr as optional command input
+  !                make new parameters (last 3) optional for bwd compatibility
   !                                                                            *
   !*****************************************************************************
@@ -69,4 +71,6 @@
   ! mdomainfill          1 use domain-filling option, 0 not, 2 use strat. O3   *
   !                                                                            *
+  ! ldep_incr            .true.  for incremental, 
+  !                      .false. for accumulated deposition output (DEFAULT)
   ! Constants:                                                                 *
   ! unitcommand          unit connected to file COMMAND                        *
@@ -79,8 +83,8 @@
   implicit none
 
-  real(kind=dp) :: juldate
-  character(len=50) :: line
+  real (kind=dp) :: juldate
+  character (len=50) :: line
   logical :: old
-  integer :: readerror
+  integer :: ireaderror, icmdstat
 
   namelist /command/ &
@@ -110,35 +114,37 @@
   linit_cond, &
   lnetcdfout, &
-  surf_only    
-
-  ! Presetting namelist command
-  ldirect=0
-  ibdate=20000101
-  ibtime=0
-  iedate=20000102
-  ietime=0
-  loutstep=10800
-  loutaver=10800
-  loutsample=900
-  itsplit=999999999
-  lsynctime=900
-  ctl=-5.0
-  ifine=4
-  iout=3
-  ipout=0
-  lsubgrid=1
-  lconvection=1
-  lagespectra=0
-  ipin=1
-  ioutputforeachrelease=1
-  iflux=1
-  mdomainfill=0
-  ind_source=1
-  ind_receptor=1
-  mquasilag=0
-  nested_output=0
-  linit_cond=0
-  lnetcdfout=0
-  surf_only=0 
+  surf_only, &
+  ldep_incr
+
+  ! Set default values for namelist command
+  ldirect = 0
+  ibdate = 20000101
+  ibtime = 0
+  iedate = 20000102
+  ietime = 0
+  loutstep = 10800
+  loutaver = 10800
+  loutsample = 900
+  itsplit = 999999999
+  lsynctime = 900
+  ctl = -5.0
+  ifine = 4
+  iout = 3
+  ipout = 0
+  lsubgrid = 1
+  lconvection = 1
+  lagespectra = 0
+  ipin = 1
+  ioutputforeachrelease = 1
+  iflux = 1
+  mdomainfill = 0
+  ind_source = 1
+  ind_receptor = 1
+  mquasilag = 0
+  nested_output = 0
+  linit_cond = 0
+  lnetcdfout = 0
+  surf_only = 0 
+  ldep_incr = .false.
 
   ! Open the command file and read user options
@@ -148,9 +154,11 @@
 
   ! try namelist input (default)
-  read(unitcommand,command,iostat=readerror)
+  read(unitcommand,command,iostat=ireaderror)
   close(unitcommand)
 
   ! distinguish namelist from fixed text input
-  if ((readerror.ne.0).or.(ldirect.eq.0)) then ! parse as text file format
+  if ((ireaderror .ne. 0) .or. (ldirect .eq. 0)) then 
+    
+    ! parse as text file format
  
     open(unitcommand,file=path(1)(1:length(1))//'COMMAND',status='old', err=999)
@@ -225,7 +233,15 @@
     read(unitcommand,*) nested_output
     if (old) call skplin(3,unitcommand)
-    read(unitcommand,*) linit_cond
-    if (old) call skplin(3,unitcommand)
-    read(unitcommand,*) surf_only
+    read(unitcommand,*,iostat=icmdstat) linit_cond
+    if (icmdstat .gt. 0) &
+      print*, 'readcommand: linit_cond not read properly',icmdstat,linit_cond
+    if (old) call skplin(3,unitcommand)
+    read(unitcommand,*,iostat=icmdstat) surf_only
+    if (icmdstat .gt. 0) &
+      print*, 'readcommand: linit_cond not read properly',icmdstat,surf_only
+    if (old) call skplin(3,unitcommand)
+    read(unitcommand,*,iostat=icmdstat) ldep_incr
+    if (icmdstat .gt. 0) &
+      print*, 'readcommand: linit_cond not read properly',icmdstat, ldep_incr
     close(unitcommand)
 
@@ -233,5 +249,5 @@
 
   ! write command file in namelist format to output directory if requested
-  if (nmlout.eqv..true.) then
+  if (nmlout .eqv. .true.) then
     open(unitcommand,file=path(2)(1:length(2))//'COMMAND.namelist',err=1000)
     write(unitcommand,nml=command)
@@ -244,5 +260,5 @@
   !***************************************************************
 
-  if (ctl.ge.0.1) then
+  if (ctl .ge. 0.1) then
     turbswitch=.true.
   else
@@ -308,6 +324,6 @@
   !************************************************************************
 
-  if (ldirect.eq.1) linit_cond=0
-  if ((linit_cond.lt.0).or.(linit_cond.gt.2)) then
+  if (ldirect .eq. 1) linit_cond=0
+  if ((linit_cond .lt. 0) .or. (linit_cond .gt. 2)) then
     write(*,*) ' #### FLEXPART MODEL ERROR! INVALID OPTION    #### '
     write(*,*) ' #### FOR LINIT_COND IN FILE "COMMAND".       #### '
@@ -318,5 +334,5 @@
   !******************
 
-  if (iedate.lt.ibdate) then
+  if (iedate .lt. ibdate) then
     write(*,*) ' #### FLEXPART MODEL ERROR! BEGINNING DATE    #### '
     write(*,*) ' #### IS LARGER THAN ENDING DATE. CHANGE      #### '
@@ -324,6 +340,6 @@
     write(*,*) ' #### "COMMAND".                              #### '
     stop
-  else if (iedate.eq.ibdate) then
-    if (ietime.lt.ibtime) then
+  else if (iedate .eq. ibdate) then
+    if (ietime .lt. ibtime) then
     write(*,*) ' #### FLEXPART MODEL ERROR! BEGINNING TIME    #### '
     write(*,*) ' #### IS LARGER THAN ENDING TIME. CHANGE      #### '
@@ -338,5 +354,5 @@
   !************************************
 
-  if (ctl.gt.0.) then
+  if (ctl .gt. 0.) then
     method=1
     mintime=minstep
@@ -347,5 +363,5 @@
 
 !  check for netcdf output switch (use for non-namelist input only!)
-  if (iout.ge.8) then
+  if (iout .ge. 8) then
      lnetcdfout = 1
      iout = iout - 8
@@ -360,5 +376,5 @@
   !**********************************************************************
 
-  if ((iout.lt.1).or.(iout.gt.5)) then
+  if ((iout .lt. 1) .or.  (iout .gt. 5)) then
     write(*,*) ' #### FLEXPART MODEL ERROR! FILE COMMAND:     #### '
     write(*,*) ' #### IOUT MUST BE 1, 2, 3, 4, OR 5 FOR       #### '
@@ -369,6 +385,6 @@
 
   !AF check consistency between units and volume mixing ratio
-  if ( ((iout.eq.2).or.(iout.eq.3)).and. &
-       (ind_source.gt.1 .or.ind_receptor.gt.1) ) then
+  if ( ((iout .eq. 2) .or.  (iout .eq. 3)) .and.  &
+       (ind_source .gt. 1 .or. ind_receptor .gt. 1) ) then
     write(*,*) ' #### FLEXPART MODEL ERROR! FILE COMMAND:     #### '
     write(*,*) ' #### VOLUME MIXING RATIO ONLY SUPPORTED      #### '
@@ -381,5 +397,5 @@
   !*****************************************************************************
 
-  if ((ioutputforeachrelease.eq.1).and.(mquasilag.eq.1)) then
+  if ((ioutputforeachrelease .eq. 1) .and. (mquasilag .eq. 1)) then
       write(*,*) '#### FLEXPART MODEL ERROR! FILE COMMAND:     ####'
       write(*,*) '#### OUTPUTFOREACHRELEASE AND QUASILAGRANGIAN####'
@@ -392,5 +408,5 @@
   !*****************************************************************************
 
-  if ((ldirect.lt.0).and.(mquasilag.eq.1)) then
+  if ((ldirect .lt. 0) .and. (mquasilag .eq. 1)) then
       write(*,*) '#### FLEXPART MODEL ERROR! FILE COMMAND:     ####'
       write(*,*) '#### FOR BACKWARD RUNS, QUASILAGRANGIAN MODE ####'
@@ -404,5 +420,5 @@
   !*****************************************************************************
 
-  if ((ldirect.lt.0).and.(ioutputforeachrelease.eq.0)) then
+  if ((ldirect .lt. 0) .and. (ioutputforeachrelease .eq. 0)) then
       write(*,*) '#### FLEXPART MODEL ERROR! FILE COMMAND:     ####'
       write(*,*) '#### FOR BACKWARD RUNS, IOUTPUTFOREACHRLEASE ####'
@@ -416,5 +432,5 @@
   !*****************************************************************************
 
-  if ((mdomainfill.eq.1).and.(ioutputforeachrelease.eq.1)) then
+  if ((mdomainfill .eq. 1) .and. (ioutputforeachrelease .eq. 1)) then
       write(*,*) '#### FLEXPART MODEL ERROR! FILE COMMAND:     ####'
       write(*,*) '#### FOR DOMAIN FILLING RUNS OUTPUT FOR      ####'
@@ -429,6 +445,6 @@
   !*****************************************************************************
 
-  if (ldirect.lt.0) then
-    if ((iout.eq.2).or.(iout.eq.3)) then
+  if (ldirect .lt. 0) then
+    if ((iout .eq. 2) .or. (iout .eq. 3)) then
       write(*,*) '#### FLEXPART MODEL ERROR! FILE COMMAND:     ####'
       write(*,*) '#### FOR BACKWARD RUNS, IOUT MUST BE 1,4,OR 5####'
@@ -442,6 +458,6 @@
   !*****************************************************************************
 
-  if (mdomainfill.ge.1) then
-    if ((iout.eq.4).or.(iout.eq.5)) then
+  if (mdomainfill .ge. 1) then
+    if ((iout .eq. 4) .or. (iout .eq. 5)) then
       write(*,*) '#### FLEXPART MODEL ERROR! FILE COMMAND:     ####'
       write(*,*) '#### FOR DOMAIN-FILLING TRAJECTORY OPTION,   ####'
@@ -456,5 +472,5 @@
   !****************************************************************
 
-  if ((ipout.ne.0).and.(ipout.ne.1).and.(ipout.ne.2)) then
+  if ((ipout .ne. 0) .and. (ipout .ne. 1) .and. (ipout .ne. 2)) then
     write(*,*) ' #### FLEXPART MODEL ERROR! FILE COMMAND:     #### '
     write(*,*) ' #### IPOUT MUST BE 1, 2 OR 3!                #### '
@@ -462,5 +478,5 @@
   endif
 
-  if(lsubgrid.ne.1.and.verbosity.eq.0) then
+  if(lsubgrid .ne. 1 .and. verbosity .eq. 0) then
     write(*,*) '             ----------------               '
     write(*,*) ' INFORMATION: SUBGRIDSCALE TERRAIN EFFECT IS'
@@ -473,5 +489,5 @@
   !***********************************************************
 
-  if ((lconvection.ne.0).and.(lconvection.ne.1)) then
+  if ((lconvection .ne. 0) .and. (lconvection .ne. 1)) then
     write(*,*) ' #### FLEXPART MODEL ERROR! FILE COMMAND:     #### '
     write(*,*) ' #### LCONVECTION MUST BE SET TO EITHER 1 OR 0#### '
@@ -483,5 +499,5 @@
   !*************************************************************
 
-  if (lsynctime.gt.(idiffnorm/2)) then
+  if (lsynctime .gt. (idiffnorm/2)) then
     write(*,*) ' #### FLEXPART MODEL ERROR! SYNCHRONISATION   #### '
     write(*,*) ' #### TIME IS TOO LONG. MAKE IT SHORTER.      #### '
@@ -494,5 +510,5 @@
   !*****************************************************************************
 
-  if (loutaver.eq.0) then
+  if (loutaver .eq. 0) then
     write(*,*) ' #### FLEXPART MODEL ERROR! TIME AVERAGE OF   #### '
     write(*,*) ' #### CONCENTRATION FIELD OUTPUT MUST NOT BE  #### '
@@ -502,5 +518,5 @@
   endif
 
-  if (loutaver.gt.loutstep) then
+  if (loutaver .gt. loutstep) then
     write(*,*) ' #### FLEXPART MODEL ERROR! TIME AVERAGE OF   #### '
     write(*,*) ' #### CONCENTRATION FIELD OUTPUT MUST NOT BE  #### '
@@ -510,5 +526,5 @@
   endif
 
-  if (loutsample.gt.loutaver) then
+  if (loutsample .gt. loutaver) then
     write(*,*) ' #### FLEXPART MODEL ERROR! SAMPLING TIME OF  #### '
     write(*,*) ' #### CONCENTRATION FIELD OUTPUT MUST NOT BE  #### '
@@ -518,5 +534,5 @@
   endif
 
-  if (mod(loutaver,lsynctime).ne.0) then
+  if (mod(loutaver,lsynctime) .ne. 0) then
     write(*,*) ' #### FLEXPART MODEL ERROR! AVERAGING TIME OF #### '
     write(*,*) ' #### CONCENTRATION FIELD MUST BE A MULTIPLE  #### '
@@ -525,5 +541,5 @@
   endif
 
-  if ((loutaver/lsynctime).lt.2) then
+  if ((loutaver/lsynctime) .lt. 2) then
     write(*,*) ' #### FLEXPART MODEL ERROR! AVERAGING TIME OF #### '
     write(*,*) ' #### CONCENTRATION FIELD MUST BE AT LEAST    #### '
@@ -532,5 +548,5 @@
   endif
 
-  if (mod(loutstep,lsynctime).ne.0) then
+  if (mod(loutstep,lsynctime) .ne. 0) then
     write(*,*) ' #### FLEXPART MODEL ERROR! INTERVAL BETWEEN  #### '
     write(*,*) ' #### CONCENTRATION FIELDS MUST BE A MULTIPLE #### '
@@ -539,5 +555,5 @@
   endif
 
-  if ((loutstep/lsynctime).lt.2) then
+  if ((loutstep/lsynctime) .lt. 2) then
     write(*,*) ' #### FLEXPART MODEL ERROR! INTERVAL BETWEEN  #### '
     write(*,*) ' #### CONCENTRATION FIELDS MUST BE AT LEAST   #### '
@@ -546,5 +562,5 @@
   endif
 
-  if (mod(loutsample,lsynctime).ne.0) then
+  if (mod(loutsample,lsynctime) .ne. 0) then
     write(*,*) ' #### FLEXPART MODEL ERROR! SAMPLING TIME OF  #### '
     write(*,*) ' #### CONCENTRATION FIELD MUST BE A MULTIPLE  #### '
@@ -553,5 +569,5 @@
   endif
 
-  if (itsplit.lt.loutaver) then
+  if (itsplit .lt. loutaver) then
     write(*,*) ' #### FLEXPART MODEL ERROR! SPLITTING TIME FOR#### '
     write(*,*) ' #### PARTICLES IS TOO SHORT. PLEASE INCREASE #### '
@@ -560,5 +576,5 @@
   endif
 
-  if ((mquasilag.eq.1).and.(iout.ge.4)) then
+  if ((mquasilag .eq. 1) .and. (iout .ge. 4)) then
     write(*,*) ' #### FLEXPART MODEL ERROR! CONFLICTING       #### '
     write(*,*) ' #### OPTIONS: IF MQUASILAG=1, PLUME          #### '
@@ -571,9 +587,9 @@
 
   outstep=real(abs(loutstep))
-  if (ldirect.eq.1) then
+  if (ldirect .eq. 1) then
     bdate=juldate(ibdate,ibtime)
     edate=juldate(iedate,ietime)
     ideltas=nint((edate-bdate)*86400.)
-  else if (ldirect.eq.-1) then
+  else if (ldirect .eq. -1) then
     loutaver=-1*loutaver
     loutstep=-1*loutstep
Index: /branches/petra/src/readpaths.f90
===================================================================
--- /branches/petra/src/readpaths.f90	(revision 35)
+++ /branches/petra/src/readpaths.f90	(revision 36)
@@ -1,4 +1,4 @@
 !**********************************************************************
-! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010         *
+! Copyright 1998-2015                                                 *
 ! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa,             *
 ! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann   *
@@ -20,5 +20,5 @@
 !**********************************************************************
 
-subroutine readpaths !(pathfile)
+subroutine readpaths
 
   !*****************************************************************************
@@ -29,8 +29,7 @@
   !     Author: A. Stohl                                                       *
   !                                                                            *
-  !     1 February 1994                                                        *
-  !     last modified                                                          *
-  !     HS, 7.9.2012                                                           *
-  !     option to give pathnames file as command line option                   *
+  !     1 February 1994 
+  !                                                                            *
+  !     HS, 7.9.2012: option to give pathnames file as command line option     *
   !                                                                            *
   !*****************************************************************************
Index: /branches/petra/src/readreceptors.f90
===================================================================
--- /branches/petra/src/readreceptors.f90	(revision 35)
+++ /branches/petra/src/readreceptors.f90	(revision 36)
@@ -1,4 +1,4 @@
 !**********************************************************************
-! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010         *
+! Copyright 1998-2015                                                 *
 ! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa,             *
 ! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann   *
@@ -27,7 +27,8 @@
   !                                                                            *
   !     Author: A. Stohl                                                       *
-  !     1 August 1996                                                          *
-  !     HSO, 14 August 2013
-  !     Added optional namelist input
+  !     1 August 1996        
+  !                                                  *
+  !     HSO, 14 August 2013: Added optional namelist input
+  !     PS, 2/2015: access= -> position=
   !                                                                            *
   !*****************************************************************************
@@ -81,5 +82,5 @@
   ! prepare namelist output if requested
   if (nmlout.eqv..true.) then
-    open(unitreceptorout,file=path(2)(1:length(2))//'RECEPTORS.namelist',access='append',status='new',err=1000)
+    open(unitreceptorout,file=path(2)(1:length(2))//'RECEPTORS.namelist',position='append',status='new',err=1000)
   endif
 
Index: /branches/petra/src/readreleases.f90
===================================================================
--- /branches/petra/src/readreleases.f90	(revision 35)
+++ /branches/petra/src/readreleases.f90	(revision 36)
@@ -1,4 +1,4 @@
 !**********************************************************************
-! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010         *
+! Copyright 1998-2015                                                 *
 ! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa,             *
 ! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann   *
@@ -33,6 +33,7 @@
   !     Update: 29 January 2001                                                *
   !     Release altitude can be either in magl or masl                         *
-  !     HSO, 12 August 2013
-  !     Added optional namelist input
+  !     HSO, 12 August 2013: Added optional namelist input
+  !     PS, 2/2015: access= -> position=
+  !
   !                                                                            *
   !*****************************************************************************
@@ -126,5 +127,5 @@
   ! prepare namelist output if requested
   if (nmlout.eqv..true.) then
-    open(unitreleasesout,file=path(2)(1:length(2))//'RELEASES.namelist',access='append',status='new',err=1000)
+    open(unitreleasesout,file=path(2)(1:length(2))//'RELEASES.namelist',position='append',status='new',err=1000)
   endif
 
Index: /branches/petra/src/readspecies.f90
===================================================================
--- /branches/petra/src/readspecies.f90	(revision 35)
+++ /branches/petra/src/readspecies.f90	(revision 36)
@@ -1,4 +1,4 @@
 !**********************************************************************
-! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010         *
+! Copyright 1998-2015                                                 *
 ! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa,             *
 ! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann   *
@@ -34,6 +34,6 @@
   !   N. Kristiansen, 31.01.2013: Including parameters for in-cloud scavenging *
   !                                                                            *
-  !   HSO, 13 August 2013
-  !   added optional namelist input
+  !   HSO, 13 August 2013: added optional namelist input
+  !   PS, 2/2015: access= -> position=
   !                                                                            *
   !*****************************************************************************
@@ -271,5 +271,5 @@
   ! namelist output if requested
   if (nmlout.eqv..true.) then
-    open(unitspecies,file=path(2)(1:length(2))//'SPECIES_'//aspecnumb//'.namelist',access='append',status='new',err=1000)
+    open(unitspecies,file=path(2)(1:length(2))//'SPECIES_'//aspecnumb//'.namelist',position='append',status='new',err=1000)
     write(unitspecies,nml=species_params)
     close(unitspecies)
Index: /branches/petra/src/readwind.f90
===================================================================
--- /branches/petra/src/readwind.f90	(revision 35)
+++ /branches/petra/src/readwind.f90	(revision 36)
@@ -1,4 +1,4 @@
 !**********************************************************************
-! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010         *
+! Copyright 1998-2015                                                 *
 ! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa,             *
 ! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann   *
@@ -39,4 +39,6 @@
   !  Changes, Bernd C. Krueger, Feb. 2001:
   !   Variables tth and qvh (on eta coordinates) in common block
+  ! 2/2015, PS: add missing paramter iret in call to grib subr
+  !
   !**********************************************************************
   !                                                                     *
@@ -249,5 +251,5 @@
   call grib_get_int(igrib,'numberOfPointsAlongAMeridian',isec2(3),iret)
   call grib_check(iret,gribFunction,gribErrorMsg)
-  call grib_get_int(igrib,'numberOfVerticalCoordinateValues',isec2(12))
+  call grib_get_int(igrib,'numberOfVerticalCoordinateValues',isec2(12),iret)
   call grib_check(iret,gribFunction,gribErrorMsg)
   ! CHECK GRID SPECIFICATIONS
Index: /branches/petra/src/readwind_nests.f90
===================================================================
--- /branches/petra/src/readwind_nests.f90	(revision 35)
+++ /branches/petra/src/readwind_nests.f90	(revision 36)
@@ -1,4 +1,4 @@
 !**********************************************************************
-! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010         *
+! Copyright 1998-2015                                                 *
 ! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa,             *
 ! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann   *
@@ -38,4 +38,6 @@
   !  CHANGE: 11/01/2008, Harald Sodemann, GRIB1/2 input with ECMWF grib_api    *
   !  CHANGE: 03/12/2008, Harald Sodemann, update to f90 with ECMWF grib_api    *
+  ! 2/2015, PS: add missing paramter iret in call to grib subr
+  !
   !*****************************************************************************
 
@@ -240,5 +242,5 @@
   call grib_check(iret,gribFunction,gribErrorMsg)
   call grib_get_int(igrib,'numberOfVerticalCoordinateValues', &
-       isec2(12))
+       isec2(12),iret)
   call grib_check(iret,gribFunction,gribErrorMsg)
   ! CHECK GRID SPECIFICATIONS
Index: /branches/petra/src/skplin.f90
===================================================================
--- /branches/petra/src/skplin.f90	(revision 35)
+++ /branches/petra/src/skplin.f90	(revision 36)
@@ -1,4 +1,4 @@
 !**********************************************************************
-! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010         *
+! Copyright 1998-2015                                                 *
 ! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa,             *
 ! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann   *
@@ -21,5 +21,5 @@
 
 subroutine skplin(nlines,iunit)
-  !                    i      i
+  !                 i      i  
   !*****************************************************************************
   !                                                                            *
@@ -38,12 +38,16 @@
   !                                                                            *
   !*****************************************************************************
+  ! PS 2/2015: catch EOF condition so that we can 
+  ! have optional parameters at end of list for compatibility
 
+  
   implicit none
 
-  integer :: i,iunit, nlines
+  integer, intent(in)  :: nlines, iunit
+  integer :: i, icmdstat
 
   do i=1,nlines
-    read(iunit,*)
+    read(iunit,*,iostat=icmdstat)
   end do
-
+   
 end subroutine skplin
Index: /branches/petra/src/writeheader.f90
===================================================================
--- /branches/petra/src/writeheader.f90	(revision 35)
+++ /branches/petra/src/writeheader.f90	(revision 36)
@@ -1,4 +1,4 @@
 !**********************************************************************
-! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010         *
+! Copyright 1998-2015                                                 *
 ! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa,             *
 ! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann   *
@@ -33,4 +33,6 @@
   !     7 August 2002                                                          *
   !                                                                            *
+  !     2/2015, AP+PS: version string length written  
+  !     2/2015, PS: write out ldep_incr
   !*****************************************************************************
   !                                                                            *
@@ -67,7 +69,7 @@
 
   if (ldirect.eq.1) then
-    write(unitheader) ibdate,ibtime, trim(flexversion)
+    write(unitheader) ibdate,ibtime, len_trim(flexversion), trim(flexversion) 
   else
-    write(unitheader) iedate,ietime, trim(flexversion)
+    write(unitheader) iedate,ietime, len_trim(flexversion), trim(flexversion) 
   endif
 
@@ -80,6 +82,5 @@
   !***************************************
 
-  write(unitheader) outlon0,outlat0,numxgrid,numygrid, &
-       dxout,dyout
+  write(unitheader) outlon0,outlat0,numxgrid,numygrid,dxout,dyout
   write(unitheader) numzgrid,(outheight(i),i=1,numzgrid)
 
@@ -127,6 +128,5 @@
   !*****************************************
 
-  write(unitheader) method,lsubgrid,lconvection, &
-       ind_source,ind_receptor
+  write(unitheader) method,lsubgrid,lconvection, ind_source,ind_receptor
 
   ! Write age class information
@@ -142,4 +142,11 @@
     write(unitheader) (oroout(ix,jy),jy=0,numygrid-1)
   end do
+
+  ! Write deposition type 
+  !***********************
+  
+  write(unitheader) ldep_incr
+
+
   close(unitheader)
 
Index: /branches/petra/src/writeheader_nest.f90
===================================================================
--- /branches/petra/src/writeheader_nest.f90	(revision 35)
+++ /branches/petra/src/writeheader_nest.f90	(revision 36)
@@ -1,4 +1,4 @@
 !**********************************************************************
-! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010         *
+! Copyright 1998-2015                                                 *
 ! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa,             *
 ! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann   *
@@ -32,4 +32,6 @@
   !                                                                            *
   !     7 August 2002                                                          *
+  !                                                                            *
+  !     2/2015, AP+PS: version string length written  
   !                                                                            *
   !*****************************************************************************
@@ -67,7 +69,7 @@
 
   if (ldirect.eq.1) then
-    write(unitheader) ibdate,ibtime, trim(flexversion)
+    write(unitheader) ibdate,ibtime, len_trim(flexversion), trim(flexversion)
   else
-    write(unitheader) iedate,ietime, trim(flexversion)
+    write(unitheader) iedate,ietime, len_trim(flexversion), trim(flexversion)
   endif
 
Index: /branches/petra/src/writeheader_txt.f90
===================================================================
--- /branches/petra/src/writeheader_txt.f90	(revision 35)
+++ /branches/petra/src/writeheader_txt.f90	(revision 36)
@@ -1,4 +1,4 @@
 !**********************************************************************
-! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010         *
+! Copyright 1998-2015                                                 *
 ! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa,             *
 ! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann   *
@@ -32,5 +32,9 @@
   !                                                                            *
   !     7 August 2002                                                          *
-  !     modified IP 2013 for text output                                       *
+  !                                                                            *
+  !     2013, IP: IP, text            output                                   *
+  !     2/2015, PS: version string length written, enclose version string in '
+  !                 write out ldep_incr
+  ! 
   !*****************************************************************************
   !                                                                            *
@@ -59,7 +63,7 @@
   !************************
 
-  open(unitheader,file=path(2)(1:length(2))//'header_txt', &
+  open(unitheader,file=path(2)(1:length(2))//'header.txt', &
        form='formatted',err=998)
-  open(unitheader_txt,file=path(2)(1:length(2))//'header_txt_releases', &
+  open(unitheader_rel,file=path(2)(1:length(2))//'header_releases.txt', &
        form='formatted',err=998)
 
@@ -68,6 +72,6 @@
   !*****************************
   
-  write(unitheader,*) '# ibdate,ibtime, iedate, ietime, flexversion'
-  write(unitheader,*) ibdate, ibtime, iedate, ietime, trim(flexversion) !  'FLEXPART V9.0'
+  write(unitheader,*) '# ibdate,ibtime, iedate, ietime, len(flexversion), flexversion'
+  write(unitheader,*) ibdate, ibtime, iedate, ietime, len_trim(flexversion), "'"//trim(flexversion)//"'" !  'FLEXPART V9.0'
   !if (ldirect.eq.1) then
   !  write(unitheader,*) ibdate,ibtime,trim(flexversion) !  'FLEXPART V9.0'
@@ -87,6 +91,5 @@
   write(unitheader,*) '# information on grid setup    '
   write(unitheader,*) '#outlon0,outlat0,numxgrid,numygrid,dxout,dyout'
-  write(unitheader,*) outlon0,outlat0,numxgrid,numygrid, &
-       dxout,dyout  
+  write(unitheader,*) outlon0,outlat0,numxgrid,numygrid, dxout,dyout
   write(unitheader,*) '# numzgrid, outheight(.) '
   write(unitheader,*) numzgrid,(outheight(i),i=1,numzgrid)
@@ -119,25 +122,25 @@
 
 
-  write(unitheader_txt,*) '# information on release points'
-  write(unitheader_txt,*) '# numpoint'
-  write(unitheader_txt,*) numpoint
-  write(unitheader_txt,*) '# for numpoint:'
+  write(unitheader_rel,*) '# information on release points'
+  write(unitheader_rel,*) '# numpoint'
+  write(unitheader_rel,*) numpoint
+  write(unitheader_rel,*) '# for numpoint:'
   do i=1,numpoint
-    write(unitheader_txt,*) ireleasestart(i),ireleaseend(i),kindz(i)
+    write(unitheader_rel,*) ireleasestart(i),ireleaseend(i),kindz(i)
     xp1=xpoint1(i)*dx+xlon0
     yp1=ypoint1(i)*dy+ylat0
     xp2=xpoint2(i)*dx+xlon0
     yp2=ypoint2(i)*dy+ylat0
-    write(unitheader_txt,*) xp1,yp1,xp2,yp2,zpoint1(i),zpoint2(i)
-    write(unitheader_txt,*) npart(i),1
+    write(unitheader_rel,*) xp1,yp1,xp2,yp2,zpoint1(i),zpoint2(i)
+    write(unitheader_rel,*) npart(i),1
     if (numpoint.le.1000) then
-      write(unitheader_txt,*) compoint(i)
+      write(unitheader_rel,*) compoint(i)
     else
-      write(unitheader_txt,*) compoint(1001)
+      write(unitheader_rel,*) compoint(1001)
     endif
     do j=1,nspec
-      write(unitheader_txt,*) xmass(i,j)
-      write(unitheader_txt,*) xmass(i,j)
-      write(unitheader_txt,*) xmass(i,j)
+      write(unitheader_rel,*) xmass(i,j)
+      write(unitheader_rel,*) xmass(i,j)
+      write(unitheader_rel,*) xmass(i,j)
     end do
   end do
@@ -148,6 +151,5 @@
   write(unitheader,*) '# information on model switches'
   write(unitheader,*) '# method,lsubgrid,lconvection, ind_source,ind_receptor'
-  write(unitheader,*) method,lsubgrid,lconvection, &
-       ind_source,ind_receptor
+  write(unitheader,*) method,lsubgrid,lconvection,ind_source,ind_receptor
 
   ! Write age class information
@@ -160,16 +162,16 @@
   !Do not write topography to text output file. Keep it on the binary one
   !********************************
-
   !do ix=0,numxgrid-1
   !  write(unitheader,*) (oroout(ix,jy),jy=0,numygrid-1)
   !end do
 
-
+  ! Write deposition type 
+  !***********************
   
-
+  write(unitheader,*) '# information on incremental / accum. deposition'
+  write(unitheader,*) ldep_incr
 
   close(unitheader)
-  close(unitheader_txt)
-
+  close(unitheader_rel)
 
 !  open(unitheader,file=path(2)(1:length(2))//'header_nml', &
@@ -181,5 +183,6 @@
 
 
-998   write(*,*) ' #### FLEXPART MODEL ERROR!   THE FILE         #### '
+998 continue
+  write(*,*) ' #### FLEXPART MODEL ERROR!   THE FILE         #### '
   write(*,*) ' #### '//path(2)(1:length(2))//'header_txt'//' #### '
   write(*,*) ' #### CANNOT BE OPENED. IF A FILE WITH THIS    #### '
