Index: trunk/LMDZ.PLUTO/libf/phypluto/callcorrk_pluto_mod.F90
===================================================================
--- trunk/LMDZ.PLUTO/libf/phypluto/callcorrk_pluto_mod.F90	(revision 3500)
+++ trunk/LMDZ.PLUTO/libf/phypluto/callcorrk_pluto_mod.F90	(revision 3501)
@@ -240,7 +240,8 @@
          if (aerohaze) then
 
-           print*,'aerohaze: starting suaer_corrk'
-           call suaer_corrk       ! set up aerosol optical properties
-           print*,'ending suaer_corrk'
+           ! AF24: TODO check duplicate suaer_corrk called from physiq_mod
+          !  print*,'aerohaze: starting suaer_corrk'
+          !  call suaer_corrk       ! set up aerosol optical properties
+          !  print*,'ending suaer_corrk'
 
            !--------------------------------------------------
@@ -256,8 +257,6 @@
            end do !iaer=1,naerkind.
            if (haze_radproffix) then
-                if (haze_radproffix) then
-                    call haze_reffrad_fix(ngrid,nlayer,zzlay, &
-                        reffrad,nueffrad)
-                endif
+              call haze_reffrad_fix(ngrid,nlayer,zzlay, &
+                  reffrad,nueffrad)
               print*, 'haze_radproffix=T : fixed profile for haze rad'
            else
Index: trunk/LMDZ.PLUTO/libf/phypluto/physiq_mod.F90
===================================================================
--- trunk/LMDZ.PLUTO/libf/phypluto/physiq_mod.F90	(revision 3500)
+++ trunk/LMDZ.PLUTO/libf/phypluto/physiq_mod.F90	(revision 3501)
@@ -2103,7 +2103,7 @@
            ENDDO
          ENDIF
-       endif
-
-       if (carbox) then
+      endif
+
+      if (carbox) then
          IF (fast) then
            DO ig=1,ngrid
@@ -2122,61 +2122,47 @@
           ENDDO
          ENDIF
-       endif
-
-       zrho_haze(:,:)=0.
-       zdqrho_photprec(:,:)=0.
-       IF (haze.and.aerohaze) then
-        DO ig=1,ngrid
-         DO l=1,nlayer
-                zrho_haze(ig,l)=zq(ig,l,igcm_haze)*rho(ig,l)
-                zdqrho_photprec(ig,l)=zdqphot_prec(ig,l)*rho(ig,l)
-             ENDDO
+      endif
+
+      zrho_haze(:,:)=0.
+      zdqrho_photprec(:,:)=0.
+      IF (haze.and.aerohaze) then
+         DO ig=1,ngrid
+            DO l=1,nlayer
+               zrho_haze(ig,l)=zq(ig,l,igcm_haze)*rho(ig,l)
+               zdqrho_photprec(ig,l)=zdqphot_prec(ig,l)*rho(ig,l)
+            ENDDO
          ENDDO
        ENDIF
 
-       IF (fasthaze) then
-        DO ig=1,ngrid
-           qcol(ig,igcm_haze)=zq(ig,1,igcm_haze)*pplev(ig,1)/g
-           qcol(ig,igcm_prec_haze)=zq(ig,1,igcm_prec_haze)*pplev(ig,1)/g
-        ENDDO
-       ENDIF
+      IF (fasthaze) then
+         DO ig=1,ngrid
+            qcol(ig,igcm_haze)=zq(ig,1,igcm_haze)*pplev(ig,1)/g
+            qcol(ig,igcm_prec_haze)=zq(ig,1,igcm_prec_haze)*pplev(ig,1)/g
+         ENDDO
+      ENDIF
 
  !     Info about Ls, declin...
-       IF (fast) THEN
+      IF (fast) THEN
          if (is_master) write(*,*),'Ls=',zls*180./pi,' dec=',declin*180./pi
          if (is_master) write(*,*),'zday=',zday,' ps=',globave
-        IF (lastcall) then
-         if (is_master) write(*,*),'lastcall'
-        ENDIF
-       ELSE
+         IF (lastcall) then
+            if (is_master) write(*,*),'lastcall'
+         ENDIF
+      ELSE
          if (is_master) write(*,*),'Ls=',zls*180./pi,'decli=',declin*180./pi,'zday=',zday
-       ENDIF
-
-       lecttsoil=0 ! default value for lecttsoil
-       call getin_p("lecttsoil",lecttsoil)
-       IF (lastcall.and.(ngrid.EQ.1).and.(lecttsoil.eq.1)) THEN
-       ! save tsoil temperature profile for 1D profile
-          OPEN(13,file='proftsoil.out',form='formatted')
-          DO i=1,nsoilmx
-             write(13,*) tsoil(1,i)
-          ENDDO
-          CLOSE(13)
-       ENDIF
-
+      ENDIF
+
+      lecttsoil=0 ! default value for lecttsoil
+      call getin_p("lecttsoil",lecttsoil)
+      IF (lastcall.and.(ngrid.EQ.1).and.(lecttsoil.eq.1)) THEN
+      ! save tsoil temperature profile for 1D profile
+         OPEN(13,file='proftsoil.out',form='formatted')
+         DO i=1,nsoilmx
+            write(13,*) tsoil(1,i)
+         ENDDO
+         CLOSE(13)
+      ENDIF
 
       if (is_master) print*,'--> Ls =',zls*180./pi
-
-
-!----------------------------------------------------------------------
-!        Writing NetCDF file  "RESTARTFI" at the end of the run
-!----------------------------------------------------------------------
-
-!        Note: 'restartfi' is stored just before dynamics are stored
-!              in 'restart'. Between now and the writting of 'restart',
-!              there will have been the itau=itau+1 instruction and
-!              a reset of 'time' (lastacll = .true. when itau+1= itaufin)
-!              thus we store for time=time+dtvr
-
-
 
       if(lastcall) then
@@ -2230,11 +2216,11 @@
             ! Finally ensure conservation of qsurf
             DO iq=1,nq
-              call globalaverage2d(ngrid,qsurf(:,iq),globaveice(iq))
-              call globalaverage2d(ngrid,qsurfpal(:,iq), &
+               call globalaverage2d(ngrid,qsurf(:,iq),globaveice(iq))
+               call globalaverage2d(ngrid,qsurfpal(:,iq), &
                                              globavenewice(iq))
-              IF (globavenewice(iq).gt.0.) THEN
-                 qsurfpal(:,iq)=qsurfpal(:,iq)* &
+               IF (globavenewice(iq).gt.0.) THEN
+                  qsurfpal(:,iq)=qsurfpal(:,iq)* &
                                    globaveice(iq)/globavenewice(iq)
-              ENDIF
+               ENDIF
             ENDDO
 
@@ -2243,27 +2229,24 @@
             !phisfipal(ig)=phisfi(ig)
 
-
             if (kbo.or.triton) then !  case of Triton : we do not change the orbital parameters
-
-              pdaypal=pday ! no increment of pdaypal to keep same evolution of the subsolar point
-              eccpal=1.-periastr/((periastr+apoastr)/2.)    !no change of ecc
-              peri_daypal=peri_day ! no change
-              oblipal=obliquit     ! no change
-              tpalnew=tpal
-              adjustnew=adjust
+               pdaypal=pday ! no increment of pdaypal to keep same evolution of the subsolar point
+               eccpal=1.-periastr/((periastr+apoastr)/2.)    !no change of ecc
+               peri_daypal=peri_day ! no change
+               oblipal=obliquit     ! no change
+               tpalnew=tpal
+               adjustnew=adjust
 
             else  ! Pluto
-              ! update new pday and tpal (Myr) to be set in startfi controle
-              pdaypal=int(day_ini+paleoyears*365.25/6.3872)
-              tpalnew=tpal+paleoyears*1.e-6  ! Myrs
-
-              ! update new N2 ice adjustment (not tested yet on Pluto)
-              adjustnew=adjust
-
-              ! update milankovitch parameters : obliquity,Lsp,ecc
-              call calcmilank(tpalnew,oblipal,peri_daypal,eccpal)
-              !peri_daypal=peri_day
-              !eccpal=0.009
-
+               ! update new pday and tpal (Myr) to be set in startfi controle
+               pdaypal=int(day_ini+paleoyears*365.25/6.3872)
+               tpalnew=tpal+paleoyears*1.e-6  ! Myrs
+
+               ! update new N2 ice adjustment (not tested yet on Pluto)
+               adjustnew=adjust
+
+               ! update milankovitch parameters : obliquity,Lsp,ecc
+               call calcmilank(tpalnew,oblipal,peri_daypal,eccpal)
+               !peri_daypal=peri_day
+               !eccpal=0.009
             endif
 
@@ -2271,32 +2254,38 @@
             if (is_master) write(*,*) "Paleo eccpal=",eccpal,"  tpal=",tpalnew
 
+!----------------------------------------------------------------------
+!        Writing NetCDF file  "RESTARTFI" at the end of the run
+!----------------------------------------------------------------------
+!        Note: 'restartfi' is stored just before dynamics are stored
+!              in 'restart'. Between now and the writing of 'restart',
+!              there will have been the itau=itau+1 instruction and
+!              a reset of 'time' (lastacll = .true. when itau+1= itaufin)
+!              thus we store for time=time+dtvr
 
 #ifndef MESOSCALE
              ! create restartfi
-         if (ngrid.ne.1) then
-            !TODO: import this routine from pluto.old
-            ! call physdem1pal("restartfi.nc",long,lati,nsoilmx,nq, &
-            !      ptimestep,pdaypal, &
-            !      ztime_fin,tsurf,tsoil,emis,q2,qsurfpal, &
-            !      cell_area,albedodat,inertiedat,zmea,zstd,zsig, &
-            !      zgam,zthe,oblipal,eccpal,tpalnew,adjustnew,phisfipal,  &
-            !      peri_daypal)
-         endif
-      else ! 'paleo'
-
-         if (ngrid.ne.1) then
-            write(*,*)'PHYSIQ: for physdem ztime_fin =',ztime_fin
-
-            call physdem1("restartfi.nc",nsoilmx,ngrid,nlayer,nq, &
-                          ptimestep,ztime_fin,                    &
-                          tsurf,tsoil,emis,q2,qsurf_hist)
-         endif
+            if (ngrid.ne.1) then
+               print*, "physdem1pal not yet implemented"
+               stop
+               !TODO: import this routine from pluto.old
+               ! call physdem1pal("restartfi.nc",long,lati,nsoilmx,nq, &
+               !      ptimestep,pdaypal, &
+               !      ztime_fin,tsurf,tsoil,emis,q2,qsurfpal, &
+               !      cell_area,albedodat,inertiedat,zmea,zstd,zsig, &
+               !      zgam,zthe,oblipal,eccpal,tpalnew,adjustnew,phisfipal,  &
+               !      peri_daypal)
+            endif
+         else ! 'paleo'
+
+            if (ngrid.ne.1) then
+               write(*,*)'PHYSIQ: for physdem ztime_fin =',ztime_fin
+
+               call physdem1("restartfi.nc",nsoilmx,ngrid,nlayer,nq, &
+                           ptimestep,ztime_fin,                    &
+                           tsurf,tsoil,emis,q2,qsurf_hist)
+            endif
 #endif
-      endif ! end of 'paleo'
-         ! if(ok_slab_ocean) then
-         !    call ocean_slab_final!(tslab, seaice)
-         ! end if
-
-    endif ! end of 'lastcall'
+         endif ! end of 'paleo'
+      endif ! end of 'lastcall'
 
 
@@ -2309,68 +2298,62 @@
 
 
-         call wstats(ngrid,"ps","Surface pressure","Pa",2,ps)
-         call wstats(ngrid,"tsurf","Surface temperature","K",2,tsurf)
-         call wstats(ngrid,"fluxsurf_lw",                               &
-                     "Thermal IR radiative flux to surface","W.m-2",2,  &
-                     fluxsurf_lw)
-         call wstats(ngrid,"fluxtop_lw",                                &
-                     "Thermal IR radiative flux to space","W.m-2",2,    &
-                     fluxtop_lw)
-
-!            call wstats(ngrid,"fluxsurf_sw",                               &
-!                        "Solar radiative flux to surface","W.m-2",2,       &
-!                         fluxsurf_sw_tot)
-!            call wstats(ngrid,"fluxtop_sw",                                &
-!                        "Solar radiative flux to space","W.m-2",2,         &
-!                        fluxtop_sw_tot)
-
-
-         call wstats(ngrid,"ISR","incoming stellar rad.","W m-2",2,fluxtop_dn)
-         call wstats(ngrid,"ASR","absorbed stellar rad.","W m-2",2,fluxabs_sw)
-         call wstats(ngrid,"OLR","outgoing longwave rad.","W m-2",2,fluxtop_lw)
-         !call wstats(ngrid,"ALB","Surface albedo"," ",2,albedo_equivalent)
-         !call wstats(ngrid,"ALB_1st","First Band Surface albedo"," ",2,albedo(:,1))
-         call wstats(ngrid,"p","Pressure","Pa",3,pplay)
-         call wstats(ngrid,"emis","Emissivity","",2,emis)
-         call wstats(ngrid,"temp","Atmospheric temperature","K",3,zt)
-         call wstats(ngrid,"u","Zonal (East-West) wind","m.s-1",3,zu)
-         call wstats(ngrid,"v","Meridional (North-South) wind","m.s-1",3,zv)
-         call wstats(ngrid,"w","Vertical (down-up) wind","m.s-1",3,pw)
-         call wstats(ngrid,"q2","Boundary layer eddy kinetic energy","m2.s-2",3,q2)
-
-         if (tracer) then
-            do iq=1,nq
-               call wstats(ngrid,noms(iq),noms(iq),'kg/kg',3,zq(1,1,iq))
-               call wstats(ngrid,trim(noms(iq))//'_surf',trim(noms(iq))//'_surf',  &
-                           'kg m^-2',2,qsurf(1,iq) )
-               call wstats(ngrid,trim(noms(iq))//'_col',trim(noms(iq))//'_col',    &
-                          'kg m^-2',2,qcol(1,iq) )
-
-!              call wstats(ngrid,trim(noms(iq))//'_reff',                          &
-!                          trim(noms(iq))//'_reff',                                   &
-!                          'm',3,reffrad(1,1,iq))
-
-            end do
-
-         endif ! end of 'tracer'
-
-         !AF24: deleted slab ocean and water
-
-         if(lastcall.and.callstats) then
-            write (*,*) "Writing stats..."
-            call mkstats(ierr)
-         endif
-
+      call wstats(ngrid,"ps","Surface pressure","Pa",2,ps)
+      call wstats(ngrid,"tsurf","Surface temperature","K",2,tsurf)
+      call wstats(ngrid,"fluxsurf_lw",                               &
+                  "Thermal IR radiative flux to surface","W.m-2",2,  &
+                  fluxsurf_lw)
+      call wstats(ngrid,"fluxtop_lw",                                &
+                  "Thermal IR radiative flux to space","W.m-2",2,    &
+                  fluxtop_lw)
+
+      ! call wstats(ngrid,"fluxsurf_sw",                               &
+      !             "Solar radiative flux to surface","W.m-2",2,       &
+      !             fluxsurf_sw_tot)
+      ! call wstats(ngrid,"fluxtop_sw",                                &
+      !             "Solar radiative flux to space","W.m-2",2,         &
+      !             fluxtop_sw_tot)
+
+      call wstats(ngrid,"ISR","incoming stellar rad.","W m-2",2,fluxtop_dn)
+      call wstats(ngrid,"ASR","absorbed stellar rad.","W m-2",2,fluxabs_sw)
+      call wstats(ngrid,"OLR","outgoing longwave rad.","W m-2",2,fluxtop_lw)
+      ! call wstats(ngrid,"ALB","Surface albedo"," ",2,albedo_equivalent)
+      ! call wstats(ngrid,"ALB_1st","First Band Surface albedo"," ",2,albedo(:,1))
+      call wstats(ngrid,"p","Pressure","Pa",3,pplay)
+      call wstats(ngrid,"emis","Emissivity","",2,emis)
+      call wstats(ngrid,"temp","Atmospheric temperature","K",3,zt)
+      call wstats(ngrid,"u","Zonal (East-West) wind","m.s-1",3,zu)
+      call wstats(ngrid,"v","Meridional (North-South) wind","m.s-1",3,zv)
+      call wstats(ngrid,"w","Vertical (down-up) wind","m.s-1",3,pw)
+      call wstats(ngrid,"q2","Boundary layer eddy kinetic energy","m2.s-2",3,q2)
+
+      if (tracer) then
+         do iq=1,nq
+            call wstats(ngrid,noms(iq),noms(iq),'kg/kg',3,zq(1,1,iq))
+            call wstats(ngrid,trim(noms(iq))//'_surf',trim(noms(iq))//'_surf',&
+                        'kg m^-2',2,qsurf(1,iq) )
+            call wstats(ngrid,trim(noms(iq))//'_col',trim(noms(iq))//'_col',  &
+                        'kg m^-2',2,qcol(1,iq) )
+            call wstats(ngrid,trim(noms(iq))//'_reff',trim(noms(iq))//'_reff',&
+                        'm',3,reffrad(1,1,iq))
+         end do
+
+      endif ! end of 'tracer'
+
+      if(lastcall.and.callstats) then
+         write (*,*) "Writing stats..."
+         call mkstats(ierr)
+      endif
 
 #ifndef MESOSCALE
 
-!-----------------------------------------------------------------------------------------------------
-!           OUTPUT in netcdf file "DIAGFI.NC", containing any variable for diagnostic
+!------------------------------------------------------------------------------
+!           OUTPUT in netcdf file "DIAGFI.NC",
+!           containing any variable for diagnostic
 !
 !             Note 1 : output with  period "ecritphy", set in "run.def"
-!
-!             Note 2 : writediagfi can also be called from any other subroutine for any variable,
-!                      but its preferable to keep all the calls in one place ...
-!-----------------------------------------------------------------------------------------------------
+!             Note 2 : writediagfi can also be called from any other subroutine
+!                      for any variable, but its preferable to keep all the
+!                      calls in one place ...
+!------------------------------------------------------------------------------
 
       call writediagfi(ngrid,"Ls","solar longitude","deg",0,zls*180./pi)
@@ -2454,26 +2437,26 @@
       endif ! end of 'enertest'
 
-        ! Diagnostics of optical thickness
-        ! Warning this is exp(-tau), I let you postproc with -log to have tau itself - JVO 19
-        if (diagdtau) then
-          do nw=1,L_NSPECTV
-            write(str2,'(i2.2)') nw
-            call writediagfi(ngrid,'dtauv'//str2,'Layer optical thickness attenuation in VI band '//str2,'',1,int_dtauv(:,nlayer:1:-1,nw))
-          enddo
-          do nw=1,L_NSPECTI
-            write(str2,'(i2.2)') nw
-            call writediagfi(ngrid,'dtaui'//str2,'Layer optical thickness attenuation in IR band '//str2,'',1,int_dtaui(:,nlayer:1:-1,nw))
-          enddo
-        endif
-
-        ! Temporary inclusions for heating diagnostics.
-        call writediagfi(ngrid,"zdtsw","SW heating","T s-1",3,zdtsw)
-        call writediagfi(ngrid,"zdtlw","LW heating","T s-1",3,zdtlw)
-        call writediagfi(ngrid,"dtrad","radiative heating","K s-1",3,dtrad)
-        call writediagfi(ngrid,"zdtdyn","Dyn. heating","T s-1",3,zdtdyn)
-
-        ! For Debugging.
-        !call writediagfi(ngrid,'rnat','Terrain type',' ',2,real(rnat))
-        !call writediagfi(ngrid,'pphi','Geopotential',' ',3,pphi)
+         ! Diagnostics of optical thickness
+         ! Warning this is exp(-tau), I let you postproc with -log to have tau itself - JVO 19
+         if (diagdtau) then
+            do nw=1,L_NSPECTV
+               write(str2,'(i2.2)') nw
+               call writediagfi(ngrid,'dtauv'//str2,'Layer optical thickness attenuation in VI band '//str2,'',1,int_dtauv(:,nlayer:1:-1,nw))
+            enddo
+            do nw=1,L_NSPECTI
+               write(str2,'(i2.2)') nw
+               call writediagfi(ngrid,'dtaui'//str2,'Layer optical thickness attenuation in IR band '//str2,'',1,int_dtaui(:,nlayer:1:-1,nw))
+            enddo
+         endif
+
+         ! Temporary inclusions for heating diagnostics.
+         call writediagfi(ngrid,"zdtsw","SW heating","T s-1",3,zdtsw)
+         call writediagfi(ngrid,"zdtlw","LW heating","T s-1",3,zdtlw)
+         call writediagfi(ngrid,"dtrad","radiative heating","K s-1",3,dtrad)
+         call writediagfi(ngrid,"zdtdyn","Dyn. heating","T s-1",3,zdtdyn)
+
+         ! For Debugging.
+         !call writediagfi(ngrid,'rnat','Terrain type',' ',2,real(rnat))
+         !call writediagfi(ngrid,'pphi','Geopotential',' ',3,pphi)
 
       ! Output tracers.
@@ -2525,11 +2508,11 @@
             call writediagfi(ngrid,"zdqadj_ch4","zdqadj ch4","",&
                            3,zdqadj(:,:,igcm_ch4_gas))
-             if (sedimentation) then
+            if (sedimentation) then
                call writediagfi(ngrid,"zdqsed_ch4","zdqsed ch4","",&
                               3,zdqsed(:,:,igcm_ch4_gas))
                call writediagfi(ngrid,"zdqssed_ch4","zdqssed ch4","",&
                               2,zdqssed(:,igcm_ch4_gas))
-             endif
-             if (metcloud.and.(.not.fast)) then
+            endif
+            if (metcloud.and.(.not.fast)) then
                call writediagfi(ngrid,"zdtch4cloud","ch4 cloud","T s-1",&
                            3,zdtch4cloud)
Index: trunk/LMDZ.PLUTO/libf/phypluto/suaer_corrk.F90
===================================================================
--- trunk/LMDZ.PLUTO/libf/phypluto/suaer_corrk.F90	(revision 3500)
+++ trunk/LMDZ.PLUTO/libf/phypluto/suaer_corrk.F90	(revision 3501)
@@ -131,7 +131,8 @@
       allocate(file_id(naerkind,2))
 
-      if (noaero) then
-        print*, 'naerkind= 0'
-      endif
+      ! if (noaero) then
+      !   print*, 'naerkind= 0'
+      !   naerkind=0
+      ! endif
 
 
@@ -218,5 +219,5 @@
                write(*,*)' http://www.lmd.jussieu.fr/',&
                '~lmdz/planets/LMDZ.GENERIC/datagcm/'
-               CALL ABORT
+               call abort_physic("suaer_corrk",'Problem with optical properties file',1)
             ENDIF
 
Index: trunk/LMDZ.PLUTO/libf/phypluto/xios_output_mod.F90
===================================================================
--- trunk/LMDZ.PLUTO/libf/phypluto/xios_output_mod.F90	(revision 3500)
+++ trunk/LMDZ.PLUTO/libf/phypluto/xios_output_mod.F90	(revision 3501)
@@ -2,10 +2,10 @@
 
  IMPLICIT NONE
- 
+
  INTEGER,PRIVATE,SAVE :: time_it=0 ! store number of iterations with calls to XIOS since start
 ! does not need to be threadprivate; managed by omp master
 
  CHARACTER(LEN=*), PARAMETER :: context_id= "LMDZ" ! same as in context_lmdz_physics.xml
- 
+
 #ifdef CPP_XIOS
 
@@ -13,5 +13,5 @@
     MODULE PROCEDURE histwrite0d_xios,histwrite2d_xios,histwrite3d_xios!,histwrite1d_xios
  END INTERFACE
- 
+
 
 CONTAINS
@@ -36,5 +36,5 @@
   USE wxios, ONLY: wxios_domain_param, wxios_domain_param_unstructured, wxios_closedef
   IMPLICIT NONE
-  
+
   REAL,INTENT(IN) :: day ! Number of elapsed sols since reference Ls=0.
   REAL,INTENT(IN) :: timeofday ! "Universal time", given as fraction of sol (e.g.: 0.5 for noon).
@@ -46,10 +46,10 @@
   REAL,INTENT(IN) :: wnoi(:) ! Array of wavenumbers at the spectral interval centers for the infrared.
   real,intent(in) :: wnov (:) !Array of wavenumbers at the spectral interval centers for the visible.
-  
+
   INTEGER :: data_ibegin, data_iend
   TYPE(xios_duration) :: timestep
   TYPE(xios_date) :: time_origin
   TYPE(xios_date) :: start_date
-  
+
 !$OMP BARRIER
 !$OMP MASTER
@@ -74,5 +74,5 @@
 !    IF (mpi_rank == 0) THEN
 !        data_ibegin = 0
-!    ELSE 
+!    ELSE
 !        data_ibegin = ii_begin - 1
 !    END IF
@@ -129,5 +129,5 @@
     !NB: it would make more sense to define months and their length in the
     ! xml files and not to have them hard coded here.... to be improved...
-    
+
     ! time origin of the simulation (default: 1st year/1st month/1st day, Ls=0)
     time_origin=xios_date(1,1,1,0,0,0)
@@ -151,5 +151,5 @@
 !$OMP END MASTER
 !$OMP BARRIER
-  
+
   END SUBROUTINE initialize_xios_output
 
@@ -159,10 +159,10 @@
   USE xios
   IMPLICIT NONE
-!$OMP BARRIER    
+!$OMP BARRIER
 !$OMP MASTER
     CALL xios_context_finalize
-!$OMP END MASTER    
-!$OMP BARRIER    
-  
+!$OMP END MASTER
+!$OMP BARRIER
+
   END SUBROUTINE finalize_xios_output
 
@@ -176,5 +176,5 @@
     time_it=time_it+1
     CALL xios_update_calendar(time_it)
-!$OMP END MASTER    
+!$OMP END MASTER
   END SUBROUTINE update_xios_timestep
 
@@ -189,5 +189,5 @@
     CALL xios_get_handle(context_id,ctx_hdl)
     CALL xios_set_current_context(ctx_hdl)
-!$OMP END MASTER    
+!$OMP END MASTER
   END SUBROUTINE set_xios_context
 
@@ -198,16 +198,16 @@
   USE print_control_mod, ONLY: prt_level, lunout
   IMPLICIT NONE
-  
+
     CHARACTER(LEN=*), INTENT(IN) :: field_name
     REAL, INTENT(IN) :: field
-    
+
     IF (prt_level >= 10) WRITE(lunout,*)'Begin histrwrite0d_xios ',trim(field_name)
-    
+
 !$OMP MASTER
     CALL xios_send_field(field_name,field)
 !$OMP END MASTER
-    
+
     IF (prt_level >= 10) WRITE(lunout,*)'End histrwrite0d_xios ',trim(field_name)
-    
+
   END SUBROUTINE histwrite0d_xios
 
@@ -226,11 +226,11 @@
     CHARACTER(LEN=*), INTENT(IN) :: field_name
     REAL, DIMENSION(:), INTENT(IN) :: field
-      
+
     REAL,DIMENSION(klon_mpi) :: buffer_omp
     REAL :: Field2d(nbp_lon,jj_nb)
 
     IF (prt_level >= 10) WRITE(lunout,*)'Begin histrwrite2d_xios ',trim(field_name)
-    if ((size(field) .eq. L_NSPECTI) .or. (size(field) .eq. L_NSPECTV)) then 
-!$OMP MASTER 
+    if ((size(field) .eq. L_NSPECTI) .or. (size(field) .eq. L_NSPECTV)) then
+!$OMP MASTER
       ! only for spectral stuff: IR_Bandwidth and VI_Bandwidth
       call xios_send_field(field_name,field)
@@ -239,11 +239,11 @@
     endif
     IF (SIZE(field)/=klon) CALL abort_physic('iophy::histwrite2d_xios','Field first DIMENSION not equal to klon',1)
-    
-    CALL Gather_omp(field,buffer_omp)    
+
+    CALL Gather_omp(field,buffer_omp)
 !$OMP MASTER
     CALL grid1Dto2D_mpi(buffer_omp,Field2d)
-    
+
     CALL xios_send_field(field_name, Field2d)
-!$OMP END MASTER   
+!$OMP END MASTER
 
     IF (prt_level >= 10) WRITE(lunout,*)'End histrwrite2d_xios ',trim(field_name)
@@ -281,5 +281,5 @@
 
     CALL xios_send_field(field_name, Field3d(:,:,1:nlev))
-!$OMP END MASTER   
+!$OMP END MASTER
 
     IF (prt_level >= 10) write(lunout,*)'End histrwrite3d_xios ',trim(field_name)
