Index: LMDZ6/branches/Ocean_skin/libf/phylmd/phyetat0_get_mod.F90
===================================================================
--- LMDZ6/branches/Ocean_skin/libf/phylmd/phyetat0_get_mod.F90	(revision 4369)
+++ LMDZ6/branches/Ocean_skin/libf/phylmd/phyetat0_get_mod.F90	(revision 4369)
@@ -0,0 +1,143 @@
+MODULE phyetat0_get_mod
+
+  PRIVATE
+  PUBLIC :: phyetat0_get, phyetat0_srf
+
+  INTERFACE phyetat0_get
+    MODULE PROCEDURE phyetat0_get10, phyetat0_get20, phyetat0_get11, phyetat0_get21
+  END INTERFACE phyetat0_get
+  INTERFACE phyetat0_srf
+    MODULE PROCEDURE phyetat0_srf20, phyetat0_srf30, phyetat0_srf21, phyetat0_srf31
+  END INTERFACE phyetat0_srf
+
+CONTAINS
+
+!==============================================================================
+LOGICAL FUNCTION phyetat0_get10(field, name, descr, default) RESULT(lFound)
+! Read a field. Check whether reading succeded and use default value if not.
+  IMPLICIT NONE
+  REAL,             INTENT(INOUT) :: field(:) ! klon
+  CHARACTER(LEN=*), INTENT(IN)    :: name
+  CHARACTER(LEN=*), INTENT(IN)    :: descr
+  REAL,             INTENT(IN)    :: default
+!------------------------------------------------------------------------------
+  REAL :: fld(SIZE(field),1)
+  lFound = phyetat0_get21(fld, [name], descr, default); field = fld(:,1)
+END FUNCTION phyetat0_get10
+!==============================================================================
+LOGICAL FUNCTION phyetat0_get20(field, name, descr, default) RESULT(lFound)
+! Same as phyetat0_get11, field on multiple levels.
+  IMPLICIT NONE
+  REAL,             INTENT(INOUT) :: field(:,:) ! klon, nlev
+  CHARACTER(LEN=*), INTENT(IN)    :: name
+  CHARACTER(LEN=*), INTENT(IN)    :: descr
+  REAL,             INTENT(IN)    :: default
+!-----------------------------------------------------------------------------
+  lFound = phyetat0_get21(field, [name], descr, default)
+END FUNCTION phyetat0_get20
+!==============================================================================
+LOGICAL FUNCTION phyetat0_get11(field, name, descr, default) RESULT(lFound)
+! Same as phyetat0_get11, multiple names.
+  IMPLICIT NONE
+  REAL,             INTENT(INOUT) :: field(:) ! klon
+  CHARACTER(LEN=*), INTENT(IN)    :: name(:)
+  CHARACTER(LEN=*), INTENT(IN)    :: descr
+  REAL,             INTENT(IN)    :: default
+!-----------------------------------------------------------------------------
+  REAL :: fld(SIZE(field),1)
+  lFound = phyetat0_get21(fld, name, descr, default); field = fld(:,1)
+END FUNCTION phyetat0_get11
+!==============================================================================
+LOGICAL FUNCTION phyetat0_get21(field, name, descr, default, tname) RESULT(lFound)
+! Same as phyetat0_get11, field on multiple levels, multiple names.
+  USE iostart,           ONLY: get_field
+  USE print_control_mod, ONLY: lunout
+  IMPLICIT NONE
+  REAL,             INTENT(INOUT) :: field(:,:) ! klon, nlev
+  CHARACTER(LEN=*), INTENT(IN)    :: name(:)
+  CHARACTER(LEN=*), INTENT(IN)    :: descr
+  REAL,             INTENT(IN)    :: default
+  CHARACTER(LEN=*), OPTIONAL, INTENT(OUT) :: tname
+!-----------------------------------------------------------------------------
+  CHARACTER(LEN=LEN(name)) :: tnam
+  INTEGER :: i
+  DO i = 1, SIZE(name)
+    CALL get_field(TRIM(name(i)), field, lFound)
+    IF(lFound) EXIT
+    WRITE(lunout,*) "phyetat0: Missing field <",TRIM(name(i)),"> "
+  END DO
+  IF(.NOT.lFound) THEN
+    WRITE(lunout,*) "Slightly distorted start ; continuing."
+    field(:,:) = default
+    tnam = name(1)
+  ELSE
+    tnam = name(i)
+  END IF
+  WRITE(lunout,'(2(a,ES14.7))') 'phyetat0: '//TRIM(tnam)//' ('//TRIM(descr)//') min/max=', &
+    MINval(field),' ',MAXval(field)
+  IF(PRESENT(tname)) tname = tnam
+END FUNCTION phyetat0_get21
+!==============================================================================
+LOGICAL FUNCTION phyetat0_srf20(field, name, descr, default) RESULT(lFound)
+! Read a field per sub-surface.
+! Check whether reading succeded and use default value if not.
+  IMPLICIT NONE
+  REAL,             INTENT(INOUT) :: field(:,:)
+  CHARACTER(LEN=*), INTENT(IN)    :: name
+  CHARACTER(LEN=*), INTENT(IN)    :: descr
+  REAL,             INTENT(IN)    :: default
+!-----------------------------------------------------------------------------
+  REAL :: fld(SIZE(field,1),1,SIZE(field,2))
+  lFound = phyetat0_srf31(fld, [name], descr, default); field = fld(:,1,:)
+END FUNCTION phyetat0_srf20
+
+!==============================================================================
+LOGICAL FUNCTION phyetat0_srf30(field, name, descr, default) RESULT(lFound)
+! Same as phyetat0_sfr11, multiple names tested one after the other.
+  IMPLICIT NONE
+  REAL,             INTENT(INOUT) :: field(:,:,:)
+  CHARACTER(LEN=*), INTENT(IN)    :: name
+  CHARACTER(LEN=*), INTENT(IN)    :: descr
+  REAL,             INTENT(IN)    :: default
+!-----------------------------------------------------------------------------
+  lFound = phyetat0_srf31(field, [name], descr, default)
+END FUNCTION phyetat0_srf30
+
+!==============================================================================
+LOGICAL FUNCTION phyetat0_srf21(field, name, descr, default) RESULT(lFound)
+! Same as phyetat0_sfr11, field on multiple levels.
+  IMPLICIT NONE
+  REAL,             INTENT(INOUT) :: field(:,:)
+  CHARACTER(LEN=*), INTENT(IN)    :: name(:)
+  CHARACTER(LEN=*), INTENT(IN)    :: descr
+  REAL,             INTENT(IN)    :: default
+!-----------------------------------------------------------------------------
+  REAL :: fld(SIZE(field,1),1,SIZE(field,2))
+  lFound = phyetat0_srf31(fld, name, descr, default); field = fld(:,1,:)
+END FUNCTION phyetat0_srf21
+
+!==============================================================================
+LOGICAL FUNCTION phyetat0_srf31(field, name, descr, default) RESULT(lFound)
+! Same as phyetat0_sfr11, field on multiple levels, multiple names tested one after the other.
+  USE iostart,           ONLY: get_field
+  USE print_control_mod, ONLY: lunout
+  USE strings_mod,       ONLY: int2str, maxlen
+  IMPLICIT NONE
+  REAL,             INTENT(INOUT) :: field(:,:,:)
+  CHARACTER(LEN=*), INTENT(IN)    :: name(:)
+  CHARACTER(LEN=*), INTENT(IN)    :: descr
+  REAL,             INTENT(IN)    :: default
+!-----------------------------------------------------------------------------
+  INTEGER :: nsrf, i
+  CHARACTER(LEN=maxlen) :: nam(SIZE(name)), tname, des
+  IF(SIZE(field,3)>99) CALL abort_physic("phyetat0", "Too much sub-cells", 1)
+  DO nsrf = 1, SIZE(field,3)
+    DO i = 1, SIZE(name); nam(i) = TRIM(name(i))//TRIM(int2str(nsrf,2)); END DO
+    des = TRIM(descr)//" srf:"//int2str(nsrf,2)
+    lFound = phyetat0_get21(field(:,:,nsrf), nam, TRIM(des), default, tname)
+  END DO
+  WRITE(lunout,'(2(a,ES14.7))') 'phyetat0: '//TRIM(tname)//' ('//TRIM(descr)//') min/max=', &
+    MINval(field),' ',MAXval(field)
+END FUNCTION phyetat0_srf31
+
+END MODULE phyetat0_get_mod
Index: LMDZ6/branches/Ocean_skin/libf/phylmd/phyetat0_mod.F90
===================================================================
--- LMDZ6/branches/Ocean_skin/libf/phylmd/phyetat0_mod.F90	(revision 4368)
+++ LMDZ6/branches/Ocean_skin/libf/phylmd/phyetat0_mod.F90	(revision 4369)
@@ -4,12 +4,5 @@
 
   PRIVATE
-  PUBLIC :: phyetat0, phyetat0_get, phyetat0_srf
-
-  INTERFACE phyetat0_get
-    MODULE PROCEDURE phyetat0_get10, phyetat0_get20, phyetat0_get11, phyetat0_get21
-  END INTERFACE phyetat0_get
-  INTERFACE phyetat0_srf
-    MODULE PROCEDURE phyetat0_srf20, phyetat0_srf30, phyetat0_srf21, phyetat0_srf31
-  END INTERFACE phyetat0_srf
+  PUBLIC :: phyetat0
 
 CONTAINS
@@ -23,4 +16,5 @@
   USE pbl_surface_mod,  ONLY : pbl_surface_init
   USE surface_data,     ONLY : type_ocean, version_ocean
+  USE phyetat0_get_mod, ONLY : phyetat0_get, phyetat0_srf
   USE phys_state_var_mod, ONLY : ancien_ok, clwcon, detr_therm, phys_tstep, &
        qsol, fevap, z0m, z0h, agesno, &
@@ -611,132 +605,4 @@
 END SUBROUTINE phyetat0
 
-!==============================================================================
-LOGICAL FUNCTION phyetat0_get10(field, name, descr, default) RESULT(lFound)
-! Read a field. Check whether reading succeded and use default value if not.
-  IMPLICIT NONE
-  REAL,             INTENT(INOUT) :: field(:) ! klon
-  CHARACTER(LEN=*), INTENT(IN)    :: name
-  CHARACTER(LEN=*), INTENT(IN)    :: descr
-  REAL,             INTENT(IN)    :: default
-!------------------------------------------------------------------------------
-  REAL :: fld(SIZE(field),1)
-  lFound = phyetat0_get21(fld, [name], descr, default); field = fld(:,1)
-END FUNCTION phyetat0_get10
-!==============================================================================
-LOGICAL FUNCTION phyetat0_get20(field, name, descr, default) RESULT(lFound)
-! Same as phyetat0_get11, field on multiple levels.
-  IMPLICIT NONE
-  REAL,             INTENT(INOUT) :: field(:,:) ! klon, nlev
-  CHARACTER(LEN=*), INTENT(IN)    :: name
-  CHARACTER(LEN=*), INTENT(IN)    :: descr
-  REAL,             INTENT(IN)    :: default
-!-----------------------------------------------------------------------------
-  lFound = phyetat0_get21(field, [name], descr, default)
-END FUNCTION phyetat0_get20
-!==============================================================================
-LOGICAL FUNCTION phyetat0_get11(field, name, descr, default) RESULT(lFound)
-! Same as phyetat0_get11, multiple names.
-  IMPLICIT NONE
-  REAL,             INTENT(INOUT) :: field(:) ! klon
-  CHARACTER(LEN=*), INTENT(IN)    :: name(:)
-  CHARACTER(LEN=*), INTENT(IN)    :: descr
-  REAL,             INTENT(IN)    :: default
-!-----------------------------------------------------------------------------
-  REAL :: fld(SIZE(field),1)
-  lFound = phyetat0_get21(fld, name, descr, default); field = fld(:,1)
-END FUNCTION phyetat0_get11
-!==============================================================================
-LOGICAL FUNCTION phyetat0_get21(field, name, descr, default, tname) RESULT(lFound)
-! Same as phyetat0_get11, field on multiple levels, multiple names.
-  USE iostart,           ONLY: get_field
-  USE print_control_mod, ONLY: lunout
-  IMPLICIT NONE
-  REAL,             INTENT(INOUT) :: field(:,:) ! klon, nlev
-  CHARACTER(LEN=*), INTENT(IN)    :: name(:)
-  CHARACTER(LEN=*), INTENT(IN)    :: descr
-  REAL,             INTENT(IN)    :: default
-  CHARACTER(LEN=*), OPTIONAL, INTENT(OUT) :: tname
-!-----------------------------------------------------------------------------
-  CHARACTER(LEN=LEN(name)) :: tnam
-  INTEGER :: i
-  DO i = 1, SIZE(name)
-    CALL get_field(TRIM(name(i)), field, lFound)
-    IF(lFound) EXIT
-    WRITE(lunout,*) "phyetat0: Missing field <",TRIM(name(i)),"> "
-  END DO
-  IF(.NOT.lFound) THEN
-    WRITE(lunout,*) "Slightly distorted start ; continuing."
-    field(:,:) = default
-    tnam = name(1)
-  ELSE
-    tnam = name(i)
-  END IF
-  WRITE(lunout,'(2(a,ES14.7))') 'phyetat0: '//TRIM(tnam)//' ('//TRIM(descr)//') min/max=', &
-    MINval(field),' ',MAXval(field)
-  IF(PRESENT(tname)) tname = tnam
-END FUNCTION phyetat0_get21
-!==============================================================================
-LOGICAL FUNCTION phyetat0_srf20(field, name, descr, default) RESULT(lFound)
-! Read a field per sub-surface.
-! Check whether reading succeded and use default value if not.
-  IMPLICIT NONE
-  REAL,             INTENT(INOUT) :: field(:,:)
-  CHARACTER(LEN=*), INTENT(IN)    :: name
-  CHARACTER(LEN=*), INTENT(IN)    :: descr
-  REAL,             INTENT(IN)    :: default
-!-----------------------------------------------------------------------------
-  REAL :: fld(SIZE(field,1),1,SIZE(field,2))
-  lFound = phyetat0_srf31(fld, [name], descr, default); field = fld(:,1,:)
-END FUNCTION phyetat0_srf20
-
-!==============================================================================
-LOGICAL FUNCTION phyetat0_srf30(field, name, descr, default) RESULT(lFound)
-! Same as phyetat0_sfr11, multiple names tested one after the other.
-  IMPLICIT NONE
-  REAL,             INTENT(INOUT) :: field(:,:,:)
-  CHARACTER(LEN=*), INTENT(IN)    :: name
-  CHARACTER(LEN=*), INTENT(IN)    :: descr
-  REAL,             INTENT(IN)    :: default
-!-----------------------------------------------------------------------------
-  lFound = phyetat0_srf31(field, [name], descr, default)
-END FUNCTION phyetat0_srf30
-
-!==============================================================================
-LOGICAL FUNCTION phyetat0_srf21(field, name, descr, default) RESULT(lFound)
-! Same as phyetat0_sfr11, field on multiple levels.
-  IMPLICIT NONE
-  REAL,             INTENT(INOUT) :: field(:,:)
-  CHARACTER(LEN=*), INTENT(IN)    :: name(:)
-  CHARACTER(LEN=*), INTENT(IN)    :: descr
-  REAL,             INTENT(IN)    :: default
-!-----------------------------------------------------------------------------
-  REAL :: fld(SIZE(field,1),1,SIZE(field,2))
-  lFound = phyetat0_srf31(fld, name, descr, default); field = fld(:,1,:)
-END FUNCTION phyetat0_srf21
-
-!==============================================================================
-LOGICAL FUNCTION phyetat0_srf31(field, name, descr, default) RESULT(lFound)
-! Same as phyetat0_sfr11, field on multiple levels, multiple names tested one after the other.
-  USE iostart,           ONLY: get_field
-  USE print_control_mod, ONLY: lunout
-  USE strings_mod,       ONLY: int2str, maxlen
-  IMPLICIT NONE
-  REAL,             INTENT(INOUT) :: field(:,:,:)
-  CHARACTER(LEN=*), INTENT(IN)    :: name(:)
-  CHARACTER(LEN=*), INTENT(IN)    :: descr
-  REAL,             INTENT(IN)    :: default
-!-----------------------------------------------------------------------------
-  INTEGER :: nsrf, i
-  CHARACTER(LEN=maxlen) :: nam(SIZE(name)), tname, des
-  IF(SIZE(field,3)>99) CALL abort_physic("phyetat0", "Too much sub-cells", 1)
-  DO nsrf = 1, SIZE(field,3)
-    DO i = 1, SIZE(name); nam(i) = TRIM(name(i))//TRIM(int2str(nsrf,2)); END DO
-    des = TRIM(descr)//" srf:"//int2str(nsrf,2)
-    lFound = phyetat0_get21(field(:,:,nsrf), nam, TRIM(des), default, tname)
-  END DO
-  WRITE(lunout,'(2(a,ES14.7))') 'phyetat0: '//TRIM(tname)//' ('//TRIM(descr)//') min/max=', &
-    MINval(field),' ',MAXval(field)
-END FUNCTION phyetat0_srf31
-
 END MODULE phyetat0_mod
 
Index: LMDZ6/branches/Ocean_skin/libf/phylmd/physiq_mod.F90
===================================================================
--- LMDZ6/branches/Ocean_skin/libf/phylmd/physiq_mod.F90	(revision 4368)
+++ LMDZ6/branches/Ocean_skin/libf/phylmd/physiq_mod.F90	(revision 4369)
@@ -34,11 +34,10 @@
     USE FLOTT_GWD_rando_m, only: FLOTT_GWD_rando
     USE fonte_neige_mod, ONLY  : fonte_neige_get_vars
-    USE geometry_mod, ONLY: cell_area, latitude_deg, longitude_deg, longitude,latitude, &
-         boundslon,boundslat, dx, dy, ind_cell_glo
+    USE geometry_mod, ONLY: cell_area, latitude_deg, longitude_deg
     USE ioipsl, only: histbeg, histvert, histdef, histend, histsync, &
          histwrite, ju2ymds, ymds2ju, getin
     USE ioipsl_getin_p_mod, ONLY : getin_p
     USE indice_sol_mod
-    USE infotrac_phy, ONLY: nqtot, nbtr, nqo, tracers, types_trac, nqCO2
+    USE infotrac_phy, ONLY: nqtot, nbtr, nqo, tracers, types_trac
     USE readTracFiles_mod, ONLY: addPhase
     USE strings_mod,  ONLY: strIdx
@@ -70,12 +69,10 @@
     USE regr_horiz_time_climoz_m, ONLY: regr_horiz_time_climoz
     USE regr_pr_time_av_m, only: regr_pr_time_av
-    USE surface_data,     ONLY : type_ocean, ok_veget, landice_opt
-    USE time_phylmdz_mod, only: annee_ref, current_time, day_ini, day_ref, &
-          day_step_phy, itau_phy, pdtphys, raz_date, start_time, update_time, ndays
+    USE surface_data,     ONLY : type_ocean, ok_veget
+    USE time_phylmdz_mod, only: current_time, itau_phy, pdtphys, raz_date, update_time
     USE tracinca_mod, ONLY: config_inca
     USE tropopause_m,     ONLY: dyn_tropopause
     USE ice_sursat_mod,  ONLY: flight_init, airplane
     USE vampir
-    USE VERTICAL_LAYERS_MOD, ONLY: aps,bps, ap, bp
     USE write_field_phy
 #ifdef CPP_XIOS
@@ -102,8 +99,16 @@
 
 
+#ifdef INCA
+    USE geometry_mod,      ONLY: longitude, latitude, boundslon, boundslat, ind_cell_glo
+    USE time_phylmdz_mod,  ONLY: ndays
+    USE infotrac_phy,      ONLY: nqCO2
+#endif
 #ifdef REPROBUS
-    USE CHEM_REP, ONLY : Init_chem_rep_xjour, &
-         d_q_rep,d_ql_rep,d_qi_rep,ptrop,ttrop, &
-         ztrop, gravit,itroprep, Z1,Z2,fac,B
+    USE chem_rep, ONLY: Init_chem_rep_xjour, d_q_rep, d_ql_rep, d_qi_rep, &
+                        ptrop, ttrop, ztrop, gravit, itroprep, Z1, Z2, fac, B
+#endif
+#if defined INCA || defined REPROBUS
+    USE time_phylmdz_mod,    ONLY: annee_ref, day_ini, day_ref, start_time
+    USE vertical_layers_mod, ONLY: aps, bps, ap, bp
 #endif
 
@@ -111,5 +116,5 @@
 #ifdef CPP_RRTM
     USE YOERAD, ONLY : NRADLP
-    USE YOESW, ONLY : RSUN
+!    USE YOESW, ONLY : RSUN
 #endif
 
@@ -147,6 +152,6 @@
        d_t_ajsb,d_q_ajsb, &
        d_t_ajs,d_q_ajs,d_u_ajs,d_v_ajs, &
-       d_t_ajs_w,d_q_ajs_w, &
-       d_t_ajs_x,d_q_ajs_x, &
+!       d_t_ajs_w,d_q_ajs_w, &
+!       d_t_ajs_x,d_q_ajs_x, &
        !
        d_t_eva,d_q_eva,d_ql_eva,d_qi_eva, &
@@ -161,5 +166,5 @@
        d_ts, &
        !
-       d_t_oli,d_u_oli,d_v_oli, &
+!       d_t_oli,d_u_oli,d_v_oli, &
        d_t_oro,d_u_oro,d_v_oro, &
        d_t_oro_gw,d_u_oro_gw,d_v_oro_gw, &
@@ -492,8 +497,4 @@
     REAL dtadd(klon,klev)
 
-!#ifdef CPP_XIOS
-!    TYPE(xios_context), SAVE :: g_ctx
-!#endif
-
 #ifndef CPP_XIOS
     REAL, SAVE :: missing_val=nf90_fill_real
@@ -522,5 +523,4 @@
     !
     !
-    INTEGER debug
     INTEGER n
     !ym      INTEGER npoints
@@ -579,5 +579,5 @@
     ! Upmost level reached by deep convection and related variable (jyg)
     !
-    INTEGER izero
+!    INTEGER izero
     INTEGER k_upper_cv
     !------------------------------------------------------------------
@@ -749,5 +749,4 @@
     REAL beta_prec_fisrt(klon,klev) ! taux de conv de l'eau cond (fisrt)
     ! RomP <<<
-    REAL          :: calday
 
     !IM cf FH pour Tiedtke 080604
@@ -846,7 +845,4 @@
     REAL conv_t(klon,klev) ! convergence de la temperature(K/s)
     !
-#ifdef INCA
-    REAL zxsnow_dummy(klon)
-#endif
     REAL zsav_tsol(klon)
     !
@@ -863,5 +859,5 @@
     real zqsat(klon,klev)
     !
-    INTEGER i, k, iq, j, nsrf, ll, l, itr
+    INTEGER i, k, iq, nsrf, l, itr
     !
     REAL t_coup
@@ -1179,4 +1175,5 @@
 
 #ifdef INCA
+    REAL :: calday, zxsnow_dummy(klon)
     ! set de variables utilisees pour l'initialisation des valeurs provenant de INCA
     REAL, DIMENSION(klon,klev,naero_grp,nbands) :: init_tauinca
@@ -1225,8 +1222,4 @@
 #ifdef CPP_XIOS
 ! switch to XIOS LMDZ physics context 
-!!!!$OMP MASTER
-!!!!    WRITE(*,*)'PHYSICS XIOS Context :', g_ctx
-!!!!    CALL wxios_set_context()
-!!!!$OMP END MASTER
     IF (.NOT. debut .AND. is_omp_master) THEN
        CALL wxios_set_context()
@@ -1302,6 +1295,4 @@
        CALL strataer_init
 #endif
-
-       !!CALL flight_init
 
        print*, '================================================='
@@ -2221,12 +2212,4 @@
       ENDIF
     ENDIF
-! switch to XIOS LMDZ physics context just in case
-!$OMP MASTER
-!!!!#ifdef CPP_XIOS
-!!!!    WRITE(*,*)'PHYSICS XIOS Context :', g_ctx
-!!!!    CALL xios_set_current_context(g_ctx)
-!!!!#endif
-!$OMP END MASTER
-
     !
     !
@@ -5189,16 +5172,15 @@
     ENDDO
     !
-    IF (nqtot > nqo) THEN
-       itr = 0
-       DO iq = 1, nqtot
-          IF(.NOT.tracers(iq)%isInPhysics) CYCLE
-          itr = itr+1
-          DO  k = 1, klev
-             DO  i = 1, klon
-                d_qx(i,k,iq) = ( tr_seri(i,k,itr) - qx(i,k,iq) ) / phys_tstep
-             ENDDO
+    ! DC: All iterations are cycled if nqtot==nqo, so no nqtot>nqo condition required
+    itr = 0
+    DO iq = 1, nqtot
+       IF(.NOT.tracers(iq)%isInPhysics) CYCLE
+       itr = itr+1
+       DO  k = 1, klev
+          DO  i = 1, klon
+             d_qx(i,k,iq) = ( tr_seri(i,k,itr) - qx(i,k,iq) ) / phys_tstep
           ENDDO
        ENDDO
-    ENDIF
+    ENDDO
     !
     !IM rajout diagnostiques bilan KP pour analyse MJO par Jun-Ichi Yano
