SUBROUTINE m7_interface &
  &( kidia, kfdia, klon, klev, ktracer,&  ! ECMWF IFS indices 
  &  papp1, paphp1,                    &  !   "   thermodynamics
  &  ptp1,                             &  !   "     "
  &  pqp1,                             &  !   "     " 
  &  paclc,                            &  !   "   cloud
  &  PTSPHY,                           &  !   "   time-step
  &  PCEN , PTENC,                     &  !   "   tracers and tendencies
  &  PAERODDF,                         &  !   "   2D flux diagnostics
  &  PAEROU1,PAEROU2,PAEROU3,PAEROU4,  &  !   various diagnostic fields
  &  PAEROU5,PAEROU6,PAEROU7,PAEROU8   ) 
  !
  !**** *m7_interface*  serves as interface between m7 and ECMWF IFS  
  !
  !      Authors:
  !      --------
  !      J. Feichter and J. Wilson                         may  1997
  !      Adopted to m7 by J. Feichter and E. Vignati       oct. 2000
  !      P. Stier                                               2001
  !
  !      Purpose:
  !      --------
  !      This routine serves as interface between ECMWF IFS and m7. 
  !
  !**    Interface:
  !      ----------
  !      *m7_interface*   is called from   *callpar*
  !
  !      Method:
  !      -------
  !      The interface takes the mixing ratios of the compounds (xtm1) at
  !      the time t-dt, adds the tendencies (xte) of the preceeding proceses,
  !      converts the units and hands them over to m7. 
  !      After the call of m7 the returning concentrations are reconverted
  !      to mixing ratios, the tendencies of the mixing ratios are calculated
  !      and handed over to the IFS.
  !
  !  Modifications:
  !  --------------
  !  20100101: JJMorcrette, Adaptation to ECMWF IFS 
  !     (i.e., JPRB, JPIM, a bit of DOCTOR naming, replacement of initializing modules 
  !     by modules plus set-up routines).     
  !     Main modification concerns the handling the aerosol arrays using the GFL.
  !     Instead of the original pointers, the 18 aerosol masses, the 7 aerosol number 
  !     concentrations, the 3 sulphur precursors are transported by the GFL. 
  !     To be consistent with the original ECHAM-M7 scheme, 4 gases are not advected but 
  !     are accessible as tracers, and 4 pseudo-tracers (not in the GFL) are used to 
  !     information on water vapour on the 4 modes corresponding to soluble constituents.
  !     The above defines the order in which the YAERO fields are filled when M7 is used.
  !     At the end, vertically integrated quantities are computed (as in M7's "xt_burden")
  !

USE PARKIND1  ,ONLY : JPIM     ,JPRB
USE YOMHOOK   ,ONLY : LHOOK    ,DR_HOOK

!  USE mo_geoloc,         ONLY: gboxarea_2d
!  USE mo_time_control,   ONLY: time_step_len
!  USE mo_convect_tables, ONLY: tlucuaw, jptlucu1, jptlucu2
!  USE mo_exception,      ONLY: finish
!  USE mo_doctor,         ONLY: NERR

USE YOMCST   , ONLY : RD    , RG    , RLSTT , RLVTT , RTT
!USE YOMLUN   , ONLY : NULOUT
USE YOM_YGFL  ,ONLY : NGHG, NGRG, NTRAC, NACTAERO

USE YOETHF   , ONLY : R2ES     ,R3LES    ,R3IES    ,R4LES    ,&
 & R4IES    ,R5LES    ,R5IES    ,R5ALVCP  ,R5ALSCP  ,&
 & RALVDCP  ,RALSDCP  ,RTWAT    ,RTICE    ,RTICECU  ,&
 & RTWAT_RTICE_R      ,RTWAT_RTICECU_R    ,RVTMP2

!USE YO_AERO_M7,ONLY : LSNUCL, LSCOAG, LSCOND, NNUCL  &
!  &                 , LMASS_DIAG     &
!  &                 , NAERMOD, NMOD  , NSS   , NSOL  , NGAS             &
!  &                 , ISO4NS , ISO4KS, ISO4AS, ISO4CS                   &
!  &                 ,          IBCKS , IBCAS , IBCCS , IBCKI            &
!  &                 ,          IOCKS , IOCAS , IOCCS , IOCKI            &
!  &                 ,                  ISSAS , ISSCS                    &
!  &                 ,                  IDUAS , IDUCS         , IDUAI, IDUCI &
!  &                 , INUCS  , IAITS , IACCS , ICOAS , IAITI , IACCI, ICOAI &
!  &                 , CRDIV  , SIGMA , SIGMALN                              &
!  &                 , CMR2RAS, CMR2MMR,CMEDR2MMEDR   , CMR2RAM      , RAM2CMR &
!  &                 , CMIN_AERML, CMIN_AERNL, CACCSO4, CRH              &
!  &                 , BK, AVO, RERG, R_KCAL                             &
!  &                 , DH2SO4 , DDUST , DBC   , DOC   , DNACL , DNA2SO4  &
!  &                 , DNAHSO4, DH2O  , WH2SO4, WH2O  , WSO4  , WSO2     &
!  &                 , WNA    , WCL   , WNACL , WNA2SO4,WNAHSO4          &
!  &                 , WVB    , GMB                                      & 
!  &                 , LOCOAGMASK   				        &
!  &                 , PM6RP_LON_LEV  , PCRTCST                          &
!  &                 , PRAS   , PAS                                      &
!  &                 , NDUST  , NSEASALT, NPIST, NEMISS, NTYPE           & 
!  &                 , CMODE  , CTYPE , RSULFATE2SULFUR		        &
!  &                 , RBB_WSOC_PERC  , RBGE_WSOC_PERC , ROM2OC	        &
!  &                 , RCMR_FF, RCMR_BB, RCMR_BG, RCMR_SK, RCMR_SA, RCMR_SC &
!  &                 , RFACSO2, RSO2TS                                   &
!  &                 , RM2N_BCKI_FF, RM2N_BCKI_BB,     RM2N_BCKS_BB      &
!  &                 , RM2N_OCKI_FF, RM2N_OCKI_BB, RM2N_OCKI_BG          &
!  &                 ,               RM2N_OCKS_BB, RM2N_OCKS_BG          &
!  &                 ,         RM2N_S4KS_SK, RM2N_S4AS_SA, RM2N_S4CS_SC


USE YO_AERO_M7, ONLY : lsnucl, lscoag , lscond , lmass_diag &
  & ,         naermod, nmod   , nss   , nsol  ,                 nm7aer &
  & , iso4ns, iso4ks , iso4as , iso4cs, ibcks , ibcas , ibccs , ibcki  & 
  & , iocks , iocas  , ioccs  , iocki , issas , isscs &
  & , iduas , iducs  , iduai  , iduci , inucs , iaits , iaccs , icoas  &
  & , iaiti , iacci  , icoai                                           &
  & , ctrac  

!-- original
!USE YO_AERO_M7, ONLY : lsnucl, lscoag , lscond , lmass_diag &
!  & , nnucl , naermod, nmod   , nss   , nsol  , ngas  , nsulf , nm7aer &
!  & , iso4ns, iso4ks , iso4as , iso4cs, ibcks , ibcas , ibccs , ibcki  & 
!  & , iocks , iocas  , ioccs  , iocki , issas , isscs &
!  & , iduas , iducs  , iduai  , iduci , inucs , iaits , iaccs , icoas  &
!  & , iaiti , iacci  , icoai  , crdiv , sigma , sigmaln &
!  & , cmr2ras, cmr2mmr, cmedr2mmedr, cmr2ram, ram2cmr, cmin_aerml, cmin_aernl &
!  & , caccso4, crh   , bk     , avo   , rerg  , r_kcal &
!  & , dh2so4, ddust  , dbc    , doc   , dnacl , dna2so4,dnahso4, dh2o  &
!  & , wh2so4, wh2o   , wso4   , wso2  , wna   , wcl    ,wnacl  &
!  & , wna2so4,wnahso4, critn  , fmax  , cLayerThickness,wvb   , gmb    &
!  & , locoagmask

USE YO_AERO_TRAC, ONLY :            idt_so2  , idt_so4              & ! mass mixing ratio dms, so2, so4
  &                    , idt_ms4ns, idt_ms4ks, idt_ms4as, idt_ms4cs & ! mass mixing ratio sulfate 
  &                    , idt_mbcki, idt_mbcks, idt_mbcas, idt_mbccs & ! mass mixing ratio black carbon
  &                    , idt_mocki, idt_mocks, idt_mocas, idt_moccs & ! mass mixing ratio organic carbon
  &                    , idt_mssas, idt_msscs                       & ! mass mixing ratio seasalt
  &                    , idt_mduai, idt_mduas, idt_mduci, idt_mducs & ! mass mixing ratio dust
  &                    , idt_mwans, idt_mwaks, idt_mwaas, idt_mwacs & ! mass mixing ratio aerosol water
  &                    , idt_nns  , idt_nki  , idt_nks  , idt_nai   & ! number mixing ratio      
  &                    , idt_nas  , idt_nci  , idt_ncs                ! number mixing ratio

!-- original
!USE YO_AERO_TRAC, ONLY : idt_dms  , idt_so2  , idt_so4              & ! mass mixing ratio dms, so2, so4
!  &                    , idt_oh   , idt_h2o2 , idt_o3   , idt_no2   & ! mass mixing ratio oh, h2o2, o3, no2 
!                                                                    & !   - currently prescribed offline
!  &                    , idt_ms4ns, idt_ms4ks, idt_ms4as, idt_ms4cs & ! mass mixing ratio sulfate 
!  &                    , idt_mbcki, idt_mbcks, idt_mbcas, idt_mbccs & ! mass mixing ratio black carbon
!  &                    , idt_mocki, idt_mocks, idt_mocas, idt_moccs & ! mass mixing ratio organic carbon
!  &                    , idt_mssas, idt_msscs                       & ! mass mixing ratio seasalt
!  &                    , idt_mduai, idt_mduas, idt_mduci, idt_mducs & ! mass mixing ratio dust
!  &                    , idt_mwans, idt_mwaks, idt_mwaas, idt_mwacs & ! mass mixing ratio aerosol water
!  &                    , idt_nns  , idt_nki  , idt_nks  , idt_nai   & ! number mixing ratio      
!  &                    , idt_nas  , idt_nci  , idt_ncs              & ! number mixing ratio
!  &                    , idt_cdnc , idt_icnc                          ! cloud and ice cristal number concentration


!!  USE mo_aero_mem,       ONLY: rdry, rwet, densaer, relhum
!!  USE mo_aero_massfix,   ONLY: xt_borrow


USE YOEAEROP  ,ONLY : ALF_SU, ALF_OM, ALF_DD, ALF_SS, ALF_BC 
USE YOEAERSNK ,ONLY : RRHTAB


  IMPLICIT NONE 

  !--- Parameter list:
  !
  !  zww = aerosol water content for each mode [kg(water) m-3(air)]
  !  zdz = layer thickness for conversions for diagnostics [m]
  !
  
  ! Parameters:

!!INTEGER(KIND=JPIM),INTENT(IN) :: kidia, kfdia, klon, klev, ktrac, krow
INTEGER(KIND=JPIM),INTENT(IN) :: kidia, kfdia, klon, klev, ktracer

REAL(KIND=JPRB),INTENT(IN) :: PTSPHY

REAL(KIND=JPRB),INTENT(IN) :: papp1(klon ,klev),         paclc(klon ,klev),&
  &                           ptp1(klon ,klev),          pqp1(klon ,klev)
!!  &                           ptm1(klon ,klev),          ptte(klon ,klev), &
!!  &                           pqm1(klon ,klev),          pqte(klon ,klev)

REAL(KIND=JPRB),INTENT(IN) :: paphp1(klon ,klev+1)

!REAL(KIND=JPRB),INTENT(INOUT) :: pxtm1(klon ,klev,ktrac)
!REAL(KIND=JPRB),INTENT(OUT):: pxtte(klon ,klev,ktrac)
REAL(KIND=JPRB),INTENT(INOUT) :: PCEN (klon ,klev,ktracer)
REAL(KIND=JPRB),INTENT(OUT)   :: PTENC(klon ,klev,ktracer)

REAL(KIND=JPRB),INTENT(INOUT) :: PAERODDF(klon,NACTAERO,8)
REAL(KIND=JPRB),INTENT(INOUT) :: PAEROU1(klon,klev), PAEROU2(klon,klev), PAEROU3(klon,klev), PAEROU4(klon,klev) 
REAL(KIND=JPRB),INTENT(INOUT) :: PAEROU5(klon,klev), PAEROU6(klon,klev), PAEROU7(klon,klev), PAEROU8(klon,klev)

REAL(KIND=JPRB) :: zxtm1(klon ,klev,nm7aer)
REAL(KIND=JPRB) :: zxtte(klon ,klev,nm7aer)
REAL(KIND=JPRB) :: zxtp1(klon ,klev,nm7aer), ztotmss(klon ,nm7aer)
REAL(KIND=JPRB) :: zfaerng(klon,klev+1,nm7aer)

  ! Streams and stream elements:

!REAL(KIND=JPRB),        POINTER :: rdry_p(:,:,:)
!REAL(KIND=JPRB),        POINTER :: rwet_p(:,:,:)
!REAL(KIND=JPRB),        POINTER :: densaer_p(:,:,:)

REAL(KIND=JPRB) :: zrdry(klon,klev,nmod)
REAL(KIND=JPRB) :: zrwet(klon,klev,nmod)
REAL(KIND=JPRB) :: zdensaer(klon,klev,nmod)

  ! Local variables:

INTEGER(KIND=JPIM) :: jl,jk,jmod,ilevp1, ISHFTAER, IAEM7BEG, IAEM7END, ISTO1, ISTO2, ITRACM7
INTEGER(KIND=JPIM) :: JAER, JTAB

REAL(KIND=JPRB) :: ztmst, zqtmst, zqp1, zqsp1, zqp1_amb

!! REAL(KIND=JPRB) :: ZALFA, ZCOR, ZEW, ZFOEEW, ZFOEEWI, ZFOEEWL, ZQMAX, ZQS, ZTARG
REAL(KIND=JPRB) :: ZALFA, ZCOR, ZFOEEW, ZFOEEWL, ZQMAX, ZQS, ZTARG

REAL(KIND=JPRB) :: zfac,                       zqfac,                   &
  &                zfacm,                      zqfacm,                  &
  &                zfacn,                      zqfacn,                  &
  &                zrhofacm,                   zqrhofacm,               &
  &                zrhofacn,                   zqrhofacn,               & 
  &                zrhofac,                    zqrhofac,                &
  &                zeps,                       zaclc

REAL(KIND=JPRB) :: zmass_pre(5),               zmass_post(5)

!!nodiag  REAL(KIND=JPRB) :: zgboxarea(klon )

REAL(KIND=JPRB) :: zgso4(klon ,klev),          zgso2(klon ,klev),       &
  &                ztp1(klon ,klev),           zrhoa(klon ,klev),       &
  &                zrelhum(klon ,klev),        zdpg(klon ,klev),        &
  &                zdz(klon ,klev)

REAL(KIND=JPRB) :: zaerml(klon ,klev,naermod), zaernl(klon ,klev,nmod), &
  &                zm6rp(klon ,klev,nmod),     zm6dry(klon ,klev,nsol), &
  &                zrhop(klon ,klev,nmod),     zww(klon ,klev,nmod)

INTEGER(KIND=JPIM) :: IRH(klon ,klev), IRHH(klon), IRRH, IWAVL
REAL(KIND=JPRB) :: ZOPDEPTH(klon ,8), ZOPTHICK(klon ,klev,8)

REAL(KIND=JPRB) :: ZALF_SU, ZALF_BC, ZALF_OM, ZALF_SS, ZALF_DD         


!LOGICAL :: lmass_diag, loabort(5)=.FALSE.
LOGICAL :: loabort(5)=.FALSE.

!!! #include "xt_borrow.intfb.h"
#include "m7_negat.intfb.h"
#include "m7.intfb.h"
!!! #include "abor1.intfb.h"
#include "m7_aero_prop.intfb.h"
#include "m7_sedimentation.intfb.h"


#include "fcttre.h"

REAL(KIND=JPRB) :: ZHOOK_HANDLE
!--------------------------------------------------------------------------
IF (LHOOK) CALL DR_HOOK('M7_INTERFACE',0,ZHOOK_HANDLE)

!*      0.5  PREPARATORY WORK
!            ----------------

ISHFTAER=0
DO JAER=1,NGHG
  ISHFTAER=ISHFTAER+1
ENDDO
DO JAER=1,NTRAC
  ISHFTAER=ISHFTAER+1
ENDDO
DO JAER=1,NGRG
  ISHFTAER=ISHFTAER+1
ENDDO
IAEM7BEG=ISHFTAER+1
IAEM7END=ISHFTAER+nm7aer

ITRACM7=naermod+nmod

ZXTM1(KIDIA:KFDIA, 1:KLEV, 1:nm7aer) = &
  &   PCEN (KIDIA:KFDIA, 1:KLEV, IAEM7BEG:IAEM7END)
ZXTTE(KIDIA:KFDIA, 1:KLEV, 1:nm7aer) = &
  &   PTENC(KIDIA:KFDIA, 1:KLEV, IAEM7BEG:IAEM7END)


  !--- 0. Initialisations: -----------------------------------------------

  zmass_pre  = 0._JPRB
  zmass_post = 0._JPRB

  ZQMAX = 0.5_JPRB

  ztmst  = PTSPHY
  zqtmst = 1._JPRB/PTSPHY

  zeps=1.E-10_JPRB

  ilevp1=klev+1

  !--- Mass conserving correction of negative tracer values:

!  CALL xt_borrow(kproma, klon ,  klev,  ilevp1, ktrac, krow, &
!    &            papp1,  paphp1,                             &
!    &            zxtm1,  zxtte                               )

  CALL m7_negat & 
    &( kidia , kfdia, klon  , klev, nm7aer, &
    &  PTSPHY, &
    &  ZXTM1 , ZXTTE, paphp1, &
    &  ZFAERNG &
    &)

ISTO1=1
ISTO2=ITRACM7
PAEROU7(kidia:kfdia,ISTO1:ISTO2)=ZFAERNG(kidia:kfdia,klev+1,1:ITRACM7)

  !--- 1. Calculate necessary parameters:---------------------------------

  !--- Factor to transform mass sulfur in kg into molecules per kg:

  zfacm  = 6.022e+20_JPRB/32._JPRB

  !--- Factor to transform kg into micro gram:

  zfac   = 1.e09_JPRB

  !--- Factor to transform N/m**3 into N/cm**3:

  zfacn  = 1.0e-06_JPRB

  zqfac  = 1.0_JPRB/zfac
  zqfacm = 1.0_JPRB/zfacm
  zqfacn = 1.0_JPRB/zfacn

  !--- 2) Calculate ambient properties: ----------------------------------

  DO jk=1,klev
     DO  jl=kidia,kfdia

!!        zqp1        =pqm1(jl,jk) +pqte(jl,jk) *ztmst
!!        ztp1(jl,jk) =ptm1(jl,jk) +ptte(jl,jk) *ztmst
        zqp1        =pqp1(jl,jk)
        ztp1(jl,jk) =ptp1(jl,jk)

        !--- 2.1) Calculate air density:
        !         (currently neglects volume occupied by liquid and ice water => physc)

        zrhoa(jl,jk)=papp1(jl,jk)/(ztp1(jl,jk)*rd*(1._JPRB+RVTMP2*zqp1))

        !--- 2.2) New calculation of the relative humidity:
        !         Only with respect to water.

!        it          = NINT(ztp1(jl,jk)*1000._JPRB)
!        it = MAX(MIN(it,jptlucu2),jptlucu1)
!
!        zqsp1       = tlucuaw(it)/papp1(jl,jk)
!        zqsp1       = MIN(zqsp1,0.5_JPRB)
!        zqsp1       = zqsp1/(1._JPRB-RVTMP2*zqsp1)

        ZTARG=ztp1(jl,jk)
        ZALFA = FOEALFA(ZTARG)

        ZFOEEWL = R2ES*EXP(R3LES*(ZTARG-RTT)/(ZTARG-R4LES))
!        ZFOEEWI = R2ES*EXP(R3IES*(ZTARG-RTT)/(ZTARG-R4IES))
!        ZFOEEW = ZALFA*ZFOEEWL+(1.0_JPRB-ZALFA)*ZFOEEWI
        ZFOEEW=ZFOEEWL   !   Only with respect to water.

        ZQS    = ZFOEEW/PAPP1(JL,JK)
        IF (ZQS > ZQMAX) THEN
          ZQS=ZQMAX
        ENDIF
        ZCOR = 1.0_JPRB/(1.0_JPRB-RVTMP2*ZQS)
        zqsp1= ZQS*ZCOR

        zaclc=MIN(paclc(jl,jk),1.0_JPRB-zeps)

        zqp1_amb=MAX( 0.0_JPRB , (zqp1-zqsp1*zaclc)/(1._JPRB-zaclc) )

        zrelhum(jl,jk)=zqp1_amb/zqsp1
!-- replaced from original M7
!	zrelhum(jl,jk)=zqp1 / zqsp1

        zrelhum(jl,jk)=MAX(0.0_JPRB,MIN(zrelhum(jl,jk),1.0_JPRB))

        !--- Air mass auxiliary variable:

        zdpg(jl,jk)=(paphp1(jl,jk+1)-paphp1(jl,jk))/rg

        !--- Layer thickness zdz=dp/(rho*rg) [m]:

        zdz(jl,jk)=zdpg(jl,jk)/zrhoa(jl,jk)

     ENDDO
!ham_ps:changed position to suppress loop-fusion on NEC-SX6
!!JJ     relhum(kidia:kfdia,jk,krow)=zrelhum(kidia:kfdia,jk)

  ENDDO

  !--- 3) Convert units and add the tendencies of preceeding proceses: ----
  !       Transform:
  !         - mass of sulfur species from [mass(S)/mass(air)]
  !           into [molecules/cm+3]
  !         - mass of all other species into micro-gram/cubic-meter
  !         - particle numbers are transformed from [N/kg(air)]
  !           into [N/cm+3]
  !
  !--- 3.1 Gases:

  DO jk=1,klev
     DO jl=kidia,kfdia

        !--- Calculate auxiliary factors:

        zrhofac =zrhoa(jl,jk)*zfac
        zrhofacm=zrhoa(jl,jk)*zfacm
        zrhofacn=zrhoa(jl,jk)*zfacn

        !--- 3.1 Gases:

        zgso2(jl,jk)=zrhofacm*(zxtm1(jl,jk,idt_so2)+zxtte(jl,jk,idt_so2)*ztmst)
        zgso4(jl,jk)=zrhofacm*(zxtm1(jl,jk,idt_so4)+zxtte(jl,jk,idt_so4)*ztmst)

        !--- 3.2 Particle mass:

        !--- 3.2.1) Sulfate mass:

        zaerml(jl,jk,iso4ns)=zrhofacm*(zxtm1(jl,jk,idt_ms4ns)+zxtte(jl,jk,idt_ms4ns)*ztmst)
        zaerml(jl,jk,iso4ks)=zrhofacm*(zxtm1(jl,jk,idt_ms4ks)+zxtte(jl,jk,idt_ms4ks)*ztmst)
        zaerml(jl,jk,iso4as)=zrhofacm*(zxtm1(jl,jk,idt_ms4as)+zxtte(jl,jk,idt_ms4as)*ztmst)
        zaerml(jl,jk,iso4cs)=zrhofacm*(zxtm1(jl,jk,idt_ms4cs)+zxtte(jl,jk,idt_ms4cs)*ztmst)
        
        !--- 3.2.2) Black Carbon:

        zaerml(jl,jk,ibcks)=zrhofac*(zxtm1(jl,jk,idt_mbcks)+zxtte(jl,jk,idt_mbcks)*ztmst)
        zaerml(jl,jk,ibcas)=zrhofac*(zxtm1(jl,jk,idt_mbcas)+zxtte(jl,jk,idt_mbcas)*ztmst)
        zaerml(jl,jk,ibccs)=zrhofac*(zxtm1(jl,jk,idt_mbccs)+zxtte(jl,jk,idt_mbccs)*ztmst)
        zaerml(jl,jk,ibcki)=zrhofac*(zxtm1(jl,jk,idt_mbcki)+zxtte(jl,jk,idt_mbcki)*ztmst)

        !--- 3.2.3) Organic Carbon:

        zaerml(jl,jk,iocks)=zrhofac*(zxtm1(jl,jk,idt_mocks)+zxtte(jl,jk,idt_mocks)*ztmst)
        zaerml(jl,jk,iocas)=zrhofac*(zxtm1(jl,jk,idt_mocas)+zxtte(jl,jk,idt_mocas)*ztmst)
        zaerml(jl,jk,ioccs)=zrhofac*(zxtm1(jl,jk,idt_moccs)+zxtte(jl,jk,idt_moccs)*ztmst)
        zaerml(jl,jk,iocki)=zrhofac*(zxtm1(jl,jk,idt_mocki)+zxtte(jl,jk,idt_mocki)*ztmst)

        !--- 3.2.4) Sea Salt:

        zaerml(jl,jk,issas)=zrhofac*(zxtm1(jl,jk,idt_mssas)+zxtte(jl,jk,idt_mssas)*ztmst)
        zaerml(jl,jk,isscs)=zrhofac*(zxtm1(jl,jk,idt_msscs)+zxtte(jl,jk,idt_msscs)*ztmst)

        !--- 3.2.5) Dust:

        zaerml(jl,jk,iduas)=zrhofac*(zxtm1(jl,jk,idt_mduas)+zxtte(jl,jk,idt_mduas)*ztmst)
        zaerml(jl,jk,iducs)=zrhofac*(zxtm1(jl,jk,idt_mducs)+zxtte(jl,jk,idt_mducs)*ztmst)
        zaerml(jl,jk,iduai)=zrhofac*(zxtm1(jl,jk,idt_mduai)+zxtte(jl,jk,idt_mduai)*ztmst)
        zaerml(jl,jk,iduci)=zrhofac*(zxtm1(jl,jk,idt_mduci)+zxtte(jl,jk,idt_mduci)*ztmst)

        !--- 3.3) Particle numbers:

        zaernl(jl,jk,inucs)=zrhofacn*(zxtm1(jl,jk,idt_nns)+zxtte(jl,jk,idt_nns)*ztmst)
        zaernl(jl,jk,iaits)=zrhofacn*(zxtm1(jl,jk,idt_nks)+zxtte(jl,jk,idt_nks)*ztmst)
        zaernl(jl,jk,iaccs)=zrhofacn*(zxtm1(jl,jk,idt_nas)+zxtte(jl,jk,idt_nas)*ztmst)
        zaernl(jl,jk,icoas)=zrhofacn*(zxtm1(jl,jk,idt_ncs)+zxtte(jl,jk,idt_ncs)*ztmst)
        zaernl(jl,jk,iaiti)=zrhofacn*(zxtm1(jl,jk,idt_nki)+zxtte(jl,jk,idt_nki)*ztmst)
        zaernl(jl,jk,iacci)=zrhofacn*(zxtm1(jl,jk,idt_nai)+zxtte(jl,jk,idt_nai)*ztmst)
        zaernl(jl,jk,icoai)=zrhofacn*(zxtm1(jl,jk,idt_nci)+zxtte(jl,jk,idt_nci)*ztmst)

     ENDDO
  ENDDO

  !--- Discard potential remaining negative values:

  zgso2(kidia:kfdia,:)=MAX(zgso2(kidia:kfdia,:),0._JPRB)
  zgso4(kidia:kfdia,:)=MAX(zgso4(kidia:kfdia,:),0._JPRB)

  zaerml(kidia:kfdia,:,:)=MAX(zaerml(kidia:kfdia,:,:),0._JPRB)
  zaernl(kidia:kfdia,:,:)=MAX(zaernl(kidia:kfdia,:,:),0._JPRB)

  !--- Sum total mass of all compounds for mass diagnostics:
        
!no_diag  IF(lmass_diag) CALL sum_mass(kidia, kfdia, klon, zmass_pre)


  !--- 4) Call of m7: -----------------------------------------------------

  CALL m7(kidia, kfdia,   klon,   klev,   &  ! ECMWF indices
    &     papp1, zrelhum, ztp1,   zdz,    &  !   "   thermodynamics
    &     zgso4, zgso2,   zaerml, zaernl, &  !  M7   tracers
    &     zm6rp, zm6dry,  zrhop,  zww      ) !   "   aerosol properties 

  !--- 5) Reconvert masses and numbers into mixing ratios, other ----------
  !       quantities to SI units and calculate the tendencies (xtte):
  !

  DO jk=1,klev
     DO jl=kidia,kfdia

        zqrhofac=zqfac/zrhoa(jl,jk)
        zqrhofacm=zqfacm/zrhoa(jl,jk)
        zqrhofacn=zqfacn/zrhoa(jl,jk)

        !--- 5.1 Gases:

        zxtte(jl,jk,idt_so2)=(zgso2(jl,jk)*zqrhofacm-zxtm1(jl,jk,idt_so2))*zqtmst
        zxtte(jl,jk,idt_so4)=(zgso4(jl,jk)*zqrhofacm-zxtm1(jl,jk,idt_so4))*zqtmst

        !--- 5.2) Particle mass:
        
        !--- 5.2.1) Sulfate mass:
        
        zxtte(jl,jk,idt_ms4ns)=(zaerml(jl,jk,iso4ns)*zqrhofacm-zxtm1(jl,jk,idt_ms4ns))*zqtmst
        zxtte(jl,jk,idt_ms4ks)=(zaerml(jl,jk,iso4ks)*zqrhofacm-zxtm1(jl,jk,idt_ms4ks))*zqtmst
        zxtte(jl,jk,idt_ms4as)=(zaerml(jl,jk,iso4as)*zqrhofacm-zxtm1(jl,jk,idt_ms4as))*zqtmst
        zxtte(jl,jk,idt_ms4cs)=(zaerml(jl,jk,iso4cs)*zqrhofacm-zxtm1(jl,jk,idt_ms4cs))*zqtmst

        !--- 5.2.2) Black Carbon:

        zxtte(jl,jk,idt_mbcks)=(zaerml(jl,jk,ibcks)*zqrhofac-zxtm1(jl,jk,idt_mbcks))*zqtmst
        zxtte(jl,jk,idt_mbcas)=(zaerml(jl,jk,ibcas)*zqrhofac-zxtm1(jl,jk,idt_mbcas))*zqtmst
        zxtte(jl,jk,idt_mbccs)=(zaerml(jl,jk,ibccs)*zqrhofac-zxtm1(jl,jk,idt_mbccs))*zqtmst
        zxtte(jl,jk,idt_mbcki)=(zaerml(jl,jk,ibcki)*zqrhofac-zxtm1(jl,jk,idt_mbcki))*zqtmst

        !--- 5.2.3) Organic Carbon:

        zxtte(jl,jk,idt_mocks)=(zaerml(jl,jk,iocks)*zqrhofac-zxtm1(jl,jk,idt_mocks))*zqtmst
        zxtte(jl,jk,idt_mocas)=(zaerml(jl,jk,iocas)*zqrhofac-zxtm1(jl,jk,idt_mocas))*zqtmst
        zxtte(jl,jk,idt_moccs)=(zaerml(jl,jk,ioccs)*zqrhofac-zxtm1(jl,jk,idt_moccs))*zqtmst
        zxtte(jl,jk,idt_mocki)=(zaerml(jl,jk,iocki)*zqrhofac-zxtm1(jl,jk,idt_mocki))*zqtmst

        !--- 5.2.4) Sea Salt:

        zxtte(jl,jk,idt_mssas)=(zaerml(jl,jk,issas)*zqrhofac-zxtm1(jl,jk,idt_mssas))*zqtmst
        zxtte(jl,jk,idt_msscs)=(zaerml(jl,jk,isscs)*zqrhofac-zxtm1(jl,jk,idt_msscs))*zqtmst

        !--- 5.2.5) Dust:

        zxtte(jl,jk,idt_mduas)=(zaerml(jl,jk,iduas)*zqrhofac-zxtm1(jl,jk,idt_mduas))*zqtmst
        zxtte(jl,jk,idt_mducs)=(zaerml(jl,jk,iducs)*zqrhofac-zxtm1(jl,jk,idt_mducs))*zqtmst
        zxtte(jl,jk,idt_mduai)=(zaerml(jl,jk,iduai)*zqrhofac-zxtm1(jl,jk,idt_mduai))*zqtmst
        zxtte(jl,jk,idt_mduci)=(zaerml(jl,jk,iduci)*zqrhofac-zxtm1(jl,jk,idt_mduci))*zqtmst

        !--- 5.3 Particle numbers:

        zxtte(jl,jk,idt_nns)=(zaernl(jl,jk,inucs)*zqrhofacn-zxtm1(jl,jk,idt_nns))*zqtmst
        zxtte(jl,jk,idt_nks)=(zaernl(jl,jk,iaits)*zqrhofacn-zxtm1(jl,jk,idt_nks))*zqtmst
        zxtte(jl,jk,idt_nas)=(zaernl(jl,jk,iaccs)*zqrhofacn-zxtm1(jl,jk,idt_nas))*zqtmst
        zxtte(jl,jk,idt_ncs)=(zaernl(jl,jk,icoas)*zqrhofacn-zxtm1(jl,jk,idt_ncs))*zqtmst
        zxtte(jl,jk,idt_nki)=(zaernl(jl,jk,iaiti)*zqrhofacn-zxtm1(jl,jk,idt_nki))*zqtmst
        zxtte(jl,jk,idt_nai)=(zaernl(jl,jk,iacci)*zqrhofacn-zxtm1(jl,jk,idt_nai))*zqtmst
        zxtte(jl,jk,idt_nci)=(zaernl(jl,jk,icoai)*zqrhofacn-zxtm1(jl,jk,idt_nci))*zqtmst

     ENDDO
  ENDDO

  !--- 6) Convert M7 quantities to SI units and store in streams:

!  DO jmod=1, nmod
!
!     rdry_p    => rdry(jmod)%ptr
!     rwet_p    => rwet(jmod)%ptr
!     densaer_p => densaer(jmod)%ptr
!
!     !--- Mean mode density from [g/cm3] to [kg/m3]:
!     
!     densaer_p(kidia:kfdia,:,krow)=zrhop(kidia:kfdia,:,jmod)*1.E3_JPRB
!
!     !--- Ambient Count Median Radius from [cm] to [m]:
!
!     rwet_p(kidia:kfdia,:,krow)=zm6rp(kidia:kfdia,:,jmod)/100._JPRB
!
!     !--- Dry Count Median Radius from [cm] to [m]:
!
!     IF (nmod <=nsol) THEN 
!        rdry_p(kidia:kfdia,:,krow)=zm6dry(kidia:kfdia,:,jmod)/100._JPRB
!     ELSE
!        rdry_p(kidia:kfdia,:,krow)=zm6rp(kidia:kfdia,:,jmod)/100._JPRB
!     ENDIF
!
!  ENDDO


  DO jmod=1, nmod 
     !--- Mean mode density from [g/cm3] to [kg/m3]:
     
     zdensaer(kidia:kfdia,:,jmod)=zrhop(kidia:kfdia,:,jmod)*1.E3_JPRB

     !--- Ambient Count Median Radius from [cm] to [m]:

     zrwet(kidia:kfdia,:,jmod)=zm6rp(kidia:kfdia,:,jmod)/100._JPRB

     !--- Dry Count Median Radius from [cm] to [m]:

     IF (nmod <=nsol) THEN 
        zrdry(kidia:kfdia,:,jmod)=zm6dry(kidia:kfdia,:,jmod)/100._JPRB
     ELSE
        zrdry(kidia:kfdia,:,jmod)=zm6rp(kidia:kfdia,:,jmod)/100._JPRB
     ENDIF

  ENDDO

  !--- Store diagnostic aerosol properties in pseudo-tracers:

  zxtm1(kidia:kfdia,:,idt_mwans)=zww(kidia:kfdia,:,1)/zrhoa(kidia:kfdia,:)
  zxtm1(kidia:kfdia,:,idt_mwaks)=zww(kidia:kfdia,:,2)/zrhoa(kidia:kfdia,:)
  zxtm1(kidia:kfdia,:,idt_mwaas)=zww(kidia:kfdia,:,3)/zrhoa(kidia:kfdia,:)
  zxtm1(kidia:kfdia,:,idt_mwacs)=zww(kidia:kfdia,:,4)/zrhoa(kidia:kfdia,:)


!-------------------------------------------------------------------------------

!*      7.   APPLY SEDIMENTATION
!            -------------------

  CALL m7_aero_prop &
    &( KIDIA   , KFDIA , KLON, KLEV, & ! ECMWF indices
    &  zxtm1   , zxtte ,             & !   "   tracers
    &  zdensaer, zrwet ,             & !
    &  PTSPHY                        &
    &)

  CALL m7_sedimentation &
    &( KIDIA   , KFDIA , KLON, KLEV, & ! ECMWF indices
    &  zxtm1   , zxtte ,             & !   "   tracers
    &  ptp1    ,                     & !   "   temperature
    &  pqp1    ,                     & !   "   humidity
    &  papp1   , paphp1,             & !   "   pressure (full/half levels)
    &  zrhoa   , zdensaer, zrwet,    & !
    &  PTSPHY  , PAERODDF            &
    &)

ISTO1=30+1
ISTO2=30+ITRACM7
PAEROU7(kidia:kfdia,ISTO1:ISTO2)=PAERODDF(kidia:kfdia,1:ITRACM7,3)

!-------------------------------------------------------------------------------

!*      8.   APPLY MASS/NUMBER CONSERVING CORRECTION OF NEGATIVE AEROSOL VALUES
!            ------------------------------------------------------------------

!  CALL m7_negat & 
!    &( kidia , kfdia, klon  , klev, nm7aer, &
!    &  PTSPHY, &
!    &  ZXTM1 , ZXTTE, paphp1, &
!    &  ZFAERNG &
!    &)

!-------------------------------------------------------------------------------

!*      9.   PUT BACK THE M7 INFORMATION IN THE RELEVANT GFL FIELDS
!            ------------------------------------------------------

PCEN (KIDIA:KFDIA, 1:KLEV, IAEM7BEG:IAEM7END) = ZXTM1(KIDIA:KFDIA, 1:KLEV, 1:nm7aer)
PTENC(KIDIA:KFDIA, 1:KLEV, IAEM7BEG:IAEM7END) = ZXTTE(KIDIA:KFDIA, 1:KLEV, 1:nm7aer)



  !--- 7.1) Perform mass conservation check: 

lmass_diag=.false.
!  IF(lmass_diag) THEN
!
!     !--- Sum total mass of all compounds for mass diagnostics:
!
!!no_diag     CALL sum_mass(zmass_post)
!
!     !--- Perform mass conservation check:
!
!     DO jc=1, 5
!
!        IF( ABS(zmass_pre(jc)-zmass_post(jc)) > 0.100_JPRB*ABS(MAX(zmass_pre(jc),zmass_post(jc)))) THEN
!
!           WRITE(NULERR,*) 'm7_interface: m7 violates the mass conservation for compound number = ', jc, ">10%"
!
!           IF (MAX(zmass_pre(jc),zmass_post(jc)) >0._JPRB) THEN
!              WRITE(NULERR,*) '              change in mass : ', &
!                            (zmass_post(jc)-zmass_pre(jc))/MAX(zmass_pre(jc),zmass_post(jc))*100._JPRB,"%"
!           ELSE
!              WRITE(NULERR,*) '              change in mass : ', &
!                            zmass_post(jc)-zmass_pre(jc)
!           ENDIF
!
!           loabort(jc)=.TRUE.        
!        
!        ELSE IF( ABS(zmass_pre(jc)-zmass_post(jc)) > 0.010_JPRB*ABS(MAX(zmass_pre(jc),zmass_post(jc)))) THEN
!
!           WRITE(NULERR,*) 'm7_interface: m7 violates the mass conservation for compound number = ', jc, ">1%"
!
!           IF (MAX(zmass_pre(jc),zmass_post(jc)) >0._JPRB) THEN
!              WRITE(NULERR,*) '              change in mass : ', &
!                            (zmass_post(jc)-zmass_pre(jc))/MAX(zmass_pre(jc),zmass_post(jc))*100._JPRB,"%"
!           ELSE
!              WRITE(NULERR,*) '              change in mass : ', &
!                            zmass_post(jc)-zmass_pre(jc)
!           ENDIF
!
!        ELSE IF( ABS(zmass_pre(jc)-zmass_post(jc)) > 0.001_JPRB*ABS(MAX(zmass_pre(jc),zmass_post(jc)))) THEN
!
!           WRITE(NULERR,*) 'm7_interface: m7 violates the mass conservation for compound number = ', jc, ">0.1%"
!
!           IF (MAX(zmass_pre(jc),zmass_post(jc)) >0._JPRB) THEN
!              WRITE(NULERR,*) '              change in mass : ', &
!                            (zmass_post(jc)-zmass_pre(jc))/MAX(zmass_pre(jc),zmass_post(jc))*100._JPRB,"%"
!           ELSE
!              WRITE(NULERR,*) '              change in mass : ', &
!                            zmass_post(jc)-zmass_pre(jc)
!           ENDIF
!
!        ENDIF
!
!     ENDDO
!
!     IF (ANY(loabort))THEN
!        WRITE(NULERR,*) 'Mass conservation failure for compounds:', loabort
!        CALL ABOR1 ('m7_interface : m7 violates the mass conservation')
!     ENDIF
!
!  ENDIF
!
!  !--- Auxiliary routines:
!
!  CONTAINS
!
!    SUBROUTINE sum_mass(pmasssum)
!
!      IMPLICIT NONE
!
!      REAL(KIND=JPRB),INTENT(INOUT) :: pmasssum(5)
!
!      pmasssum=0._JPRB
!
!      !--- Store stream in local array for optimization:
!
!      zgboxarea(kidia:kfdia)=gboxarea_2d(kidia:kfdia,krow)
!
!      DO jk=1,klev
!         DO jl=kidia,kfdia
!            pmasssum(1)=pmasssum(1) + (zgso2(jl,jk)         + &
!                                       zgso4(jl,jk)         + &
!                                       zaerml(jl,jk,iso4ns) + &
!                                       zaerml(jl,jk,iso4ks) + &
!                                       zaerml(jl,jk,iso4as) + &
!                                       zaerml(jl,jk,iso4cs))*zdpg(jl,jk)*zgboxarea(jl)
!
!            pmasssum(2)=pmasssum(2) + (zaerml(jl,jk,ibcks)  + &
!                                       zaerml(jl,jk,ibcas)  + &
!                                       zaerml(jl,jk,ibccs)  + &
!                                       zaerml(jl,jk,ibcki))*zdpg(jl,jk)*zgboxarea(jl)
!
!            pmasssum(3)=pmasssum(3) + (zaerml(jl,jk,iocks)  + &
!                                       zaerml(jl,jk,iocas)  + &
!                                       zaerml(jl,jk,ioccs)  + &
!                                       zaerml(jl,jk,iocki))*zdpg(jl,jk)*zgboxarea(jl)
!
!            pmasssum(4)=pmasssum(4) + (zaerml(jl,jk,issas)  + &
!                                       zaerml(jl,jk,isscs))*zdpg(jl,jk)*zgboxarea(jl)
!
!            pmasssum(5)=pmasssum(5) + (zaerml(jl,jk,iduas)  + &
!                                       zaerml(jl,jk,iducs)  + &
!                                       zaerml(jl,jk,iduai)  + &
!                                       zaerml(jl,jk,iduci))*zdpg(jl,jk)*zgboxarea(jl)
!         ENDDO
!      ENDDO
!
!    END SUBROUTINE sum_mass

!-------------------------------------------------------------------------------

!*      9.   COMPUTES VERTICALLY INTEGRATED QUANTITIES FOR MASS-MIXING RATIOS
!            ----------------------------------------------------------------

! NB: diagnostics equivalent to what was done in the original M7's "xt_burden"

ZTOTMSS(kidia:kfdia,1:nm7aer)=0._JPRB
DO jaer=1, nm7AER
  if (ctrac(jaer) /= 'NUM') then
    DO JK=1,KLEV
      zxtp1(kidia:kfdia,jk,jaer) = zxtm1(kidia:kfdia,jk,jaer) + zxtte(kidia:kfdia,jk,jaer)*PTSPHY
      ztotmss(kidia:kfdia,jaer)  = ztotmss(kidia:kfdia,jaer) + zxtp1(kidia:kfdia,jk,jaer)
    ENDDO
  endif 
  PAERODDF(kidia:kfdia,jaer,8) = ztotmss(kidia:kfdia,jaer)
ENDDO

ISTO1=30+1
ISTO2=30+ITRACM7
PAEROU8(kidia:kfdia,ISTO1:ISTO2)=PAERODDF(kidia:kfdia,1:ITRACM7,8)
    
!-------------------------------------------------------------------------------

!*     10.   COMPUTES OPTICAL THICKNESSES AND OPTICAL DEPTHS
!            -----------------------------------------------


! N.B.: This is done using the GEMS aerosol optical properties: 
!       This whole calculation should be revised and improved using
!       mode-relevant optical properties for internally mixed aerosols.

!-- define RH index from "clear-sky" (not yet!) relative humidity
DO JK=1,KLEV
  DO JL=KIDIA,KFDIA
    DO JTAB=1,12
      IF (zrelhum(JL,JK)*100._JPRB >= RRHTAB(JTAB)) THEN
        IRH(JL,JK)=JTAB
      ENDIF
    ENDDO
  ENDDO
ENDDO

IWAVL=8
ZOPDEPTH(KIDIA:KFDIA,1:8)=0._JPRB
DO JK=1,KLEV
  DO JL=KIDIA,KFDIA
    IRHH(JL) = IRH(JL,JK)
    IRRH = IRHH(JL)
!--
    ZALF_SU = ALF_SU(IRRH, IWAVL)
    ZALF_BC = ALF_BC(IWAVL)
    ZALF_OM = ALF_OM(IRRH, IWAVL)
    ZALF_SS = ALF_SS(IRRH, IWAVL, 1)
    ZALF_DD = ALF_DD( 1 ,IWAVL)
!--
    ZOPTHICK(JL,JK,1)= zdpg(JL,jk) * &
      & (zxtp1(JL,jk,iso4ns) &
      & +zxtp1(JL,jk,iso4ks) &
      & +zxtp1(JL,jk,iso4as) &
      & +zxtp1(JL,jk,iso4cs) ) * 1000._JPRB * ALF_SU(IRH(JL,JK),IWAVL)
    ZOPDEPTH(JL,1) = ZOPDEPTH(JL,1)+ZOPTHICK(JL,JK,1)
    ZOPTHICK(JL,JK,2)= zdpg(JL,jk) *  &
      & (zxtp1(JL,jk,ibcks) &
      & +zxtp1(JL,jk,ibcas) &
      & +zxtp1(JL,jk,ibccs) ) * 1000._JPRB * ALF_BC(IWAVL)
    ZOPDEPTH(JL,2) = ZOPDEPTH(JL,2)+ZOPTHICK(JL,JK,2)
    ZOPTHICK(JL,JK,3)= zdpg(JL,jk) *  &
      & (zxtp1(JL,jk,ibcki) ) * 1000._JPRB * ALF_BC(IWAVL)
    ZOPDEPTH(JL,3) = ZOPDEPTH(JL,3)+ZOPTHICK(JL,JK,3)
    ZOPTHICK(JL,JK,4)= zdpg(JL,jk) *  &
      & (zxtp1(JL,jk,iocks) &
      & +zxtp1(JL,jk,iocas) &
      & +zxtp1(JL,jk,ioccs) ) * 1000._JPRB * ALF_OM(IRH(JL,JK),IWAVL)
    ZOPDEPTH(JL,4) = ZOPDEPTH(JL,4)+ZOPTHICK(JL,JK,4)
    ZOPTHICK(JL,JK,5)= zdpg(JL,jk) *  &
      & (zxtp1(JL,jk,iocki) ) * 1000._JPRB * ALF_OM( 1 , IWAVL)
    ZOPDEPTH(JL,5) = ZOPDEPTH(JL,5)+ZOPTHICK(JL,JK,5)
    ZOPTHICK(JL,JK,6)= zdpg(JL,jk) *  &
      & (zxtp1(JL,jk,issas) * 1000._JPRB * ALF_SS(IRH(JL,JK),IWAVL, 1) &
      & +zxtp1(JL,jk,isscs) * 1000._JPRB * ALF_SS(IRH(JL,JK),IWAVL, 3))
    ZOPDEPTH(JL,6) = ZOPDEPTH(JL,6)+ZOPTHICK(JL,JK,6)
    ZOPTHICK(JL,JK,7)= zdpg(JL,jk) *  &
      & (zxtp1(JL,jk,iduas) * 1000._JPRB * ALF_DD( 1 ,IWAVL) &
      & +zxtp1(JL,jk,iducs) * 1000._JPRB * ALF_DD( 3 ,IWAVL))
    ZOPDEPTH(JL,7) = ZOPDEPTH(JL,7)+ZOPTHICK(JL,JK,7)
    ZOPTHICK(JL,JK,8)= zdpg(JL,jk) *  &
      & (zxtp1(JL,jk,iduai) * 1000._JPRB * ALF_DD( 1 ,IWAVL) &
      & +zxtp1(JL,jk,iduci) * 1000._JPRB * ALF_DD( 3 ,IWAVL))
    ZOPDEPTH(JL,8) = ZOPDEPTH(JL,8)+ZOPTHICK(JL,JK,8)
  ENDDO
ENDDO

ISTO1=1
ISTO2=8
PAEROU8(kidia:kfdia,ISTO1:ISTO2)=ZOPDEPTH(KIDIA:KFDIA,1:8)

!--------------------------------------------------------------------------
IF (LHOOK) CALL DR_HOOK('M7_INTERFACE',1,ZHOOK_HANDLE)
END SUBROUTINE m7_interface
