SUBROUTINE SWNITL &
 & ( KIDIA , KFDIA  , KLON   , KLEV   , KAER  , KNU,&
 & PAER5 , PAKI5  , PALBD5 , PALBP5,&
 & PCG5  , PCLD5  , PCLEAR5,&
 & PDSIG5, POMEGA5, POZ5   , PRMU5  , PSEC5  , PTAU5,&
 & PUD5  , PWV5   , PQS5,&
 & PFDOWN5,PFUP5,&
! PCDOWN5, PCUP5,&
 & PAER  , PAKI   , PALBD  , PALBP,&
 & PCG   , PCLD   , PCLEAR,&
 & PDSIG , POMEGA , POZ    , PRMU   , PSEC   , PTAU,&
 & PUD   , PWV    , PQS,&
 & PFDOWN, PFUP &
!, PCDOWN , PCUP &
 & )  

!**** *SWNITL* - SHORTWAVE RADIATION, NEAR-INFRARED SPECTRAL INTERVALS
!                -> TANGENT LINEAR <-

!     PURPOSE.
!     --------

!          COMPUTES THE SHORTWAVE RADIATION FLUXES IN THE NEAR-INFRARED 
!     SPECTRAL INTERVALS ADAPTED FROM FOUQUART AND BONNEL (1980).

!**   INTERFACE.
!     ----------

!          *SWNITL* IS CALLED FROM *SWTL*.

!        IMPLICIT ARGUMENTS :
!        --------------------

!     ==== INPUTS ===
!     ==== OUTPUTS ===

!     METHOD.
!     -------

!          1. COMPUTES REFLECTIVITY/TRANSMISSIVITY CORRESPONDING TO
!     CONTINUUM SCATTERING FOR CLEAR-SKY AND CLOUDY PARTS OF THE COLUMN
!          2. COMPUTES REFLECTIVITY/TRANSMISSIVITY CORRESPONDING FOR
!     A GREY MOLECULAR ABSORPTION
!          3. LAPLACE TRANSFORM ON THE PREVIOUS TO GET EFFECTIVE AMOUNTS
!     OF ABSORBERS
!          4. APPLY H2O AND U.M.G. TRANSMISSION FUNCTIONS
!          5. MULTIPLY BY OZONE TRANSMISSION FUNCTION

!     EXTERNALS.
!     ----------

!          *SWCLRTL*, *SWRTL*, *SWDETL*, *SWTTTL*, *SWTT1TL*

!     REFERENCE.
!     ----------

!        SEE RADIATION'S PART OF THE ECMWF RESEARCH DEPARTMENT
!        DOCUMENTATION

!     AUTHOR.
!     -------
!        JEAN-JACQUES MORCRETTE  *ECMWF*

!     MODIFICATIONS.
!     --------------
!        ORIGINAL : 96-09-27
!        Modified : 99-05-27 M.Janiskova - correction for the security
!                                          condition for cloudiness 
!                 2000-02-24 M.Janiskova - adopted for  revised aerosols
!                                          as in swni
!                 2002-05-06 M.Janiskova - revised according to JJMorcrette
!                                          modiffications
!        03-10-10 Deborah Salmond and Marta Janiskova Optimisation
!        M.Hamrud      01-Oct-2003 CY28 Cleaning
!                 2008-03-26 M.Janiskova - code optimization and cleaning
!     ------------------------------------------------------------------

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

USE YOESW    , ONLY : RRAY     ,RSUN     ,RSWCE    ,RSWCP
USE YOERAD   , ONLY : NSW
USE YOERDU   , ONLY : REPLOG   ,REPSCQ   ,REPSC

IMPLICIT NONE

INTEGER(KIND=JPIM),INTENT(IN)    :: KLON 
INTEGER(KIND=JPIM),INTENT(IN)    :: KLEV 
INTEGER(KIND=JPIM),INTENT(IN)    :: KIDIA 
INTEGER(KIND=JPIM),INTENT(IN)    :: KFDIA 
INTEGER(KIND=JPIM),INTENT(IN)    :: KAER 
INTEGER(KIND=JPIM),INTENT(IN)    :: KNU 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PAER5(KLON,6,KLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PAKI5(KLON,2,NSW) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PALBD5(KLON,NSW) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PALBP5(KLON,NSW) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PCG5(KLON,NSW,KLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PCLD5(KLON,KLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PCLEAR5(KLON) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PDSIG5(KLON,KLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: POMEGA5(KLON,NSW,KLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: POZ5(KLON,KLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRMU5(KLON) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PSEC5(KLON) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PTAU5(KLON,NSW,KLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PUD5(KLON,5,KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PWV5(KLON,KLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PQS5(KLON,KLEV) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PFDOWN5(KLON,KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PFUP5(KLON,KLEV+1) 
!REAL(KIND=JPRB)   ,INTENT(OUT)   :: PCDOWN5(KLON,KLEV+1)
!REAL(KIND=JPRB)   ,INTENT(OUT)   :: PCUP5(KLON,KLEV+1)
REAL(KIND=JPRB)   ,INTENT(IN)    :: PAER(KLON,6,KLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PAKI(KLON,2,NSW) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PALBD(KLON,NSW) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PALBP(KLON,NSW) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PCG(KLON,NSW,KLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PCLD(KLON,KLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PCLEAR(KLON) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PDSIG(KLON,KLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: POMEGA(KLON,NSW,KLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: POZ(KLON,KLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRMU(KLON) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PSEC(KLON) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PTAU(KLON,NSW,KLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PUD(KLON,5,KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PWV(KLON,KLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PQS(KLON,KLEV) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PFDOWN(KLON,KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PFUP(KLON,KLEV+1) 
!REAL(KIND=JPRB)   ,INTENT(OUT)   :: PCDOWN(KLON,KLEV+1)
!REAL(KIND=JPRB)   ,INTENT(OUT)   :: PCUP(KLON,KLEV+1)
!     ------------------------------------------------------------------

!*       0.1   ARGUMENTS
!              ---------

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

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

INTEGER(KIND=JPIM) :: IIND2(2), IIND3(3)

REAL(KIND=JPRB) :: ZCGAZ5(KLON,KLEV)&
 & ,  ZFD5(KLON,KLEV+1)    , ZFU5(KLON,KLEV+1) &
 & ,  ZG5(KLON)            , ZGG5(KLON)&
 & ,  ZPIZAZ5(KLON,KLEV)   , ZRAYL5(KLON)       &
 & ,  ZRAY15(KLON,KLEV+1)  , ZRAY015(KLON,KLEV+1)&
 & ,  ZRAY25(KLON,KLEV+1)  , ZRAY025(KLON,KLEV+1)&
 & ,  ZRE15(KLON)     , ZRE25(KLON)  &
 & ,  ZREFZ5(KLON,2,KLEV+1), ZREFZ05(KLON,2,KLEV+1)&
 & ,  ZRJ5(KLON,6,KLEV+1)  , ZRJ05(KLON,6,KLEV+1)&
 & ,  ZRK5(KLON,6,KLEV+1)  , ZRK05(KLON,6,KLEV+1)&
 & ,  ZRL5(KLON,8)&
 & ,  ZRMUE5(KLON,KLEV+1)  , ZRMU05(KLON,KLEV+1)&
 & ,  ZRUEF5(KLON,8)    , ZR15(KLON) &
 & ,  ZR25(KLON,2)    , ZR35(KLON,3)      , ZR45(KLON)&
 & ,  ZR215(KLON)     , ZR225(KLON)&
 & ,  ZS5(KLON)  
REAL(KIND=JPRB) :: ZTAUAZ5(KLON,KLEV)   , ZTO15(KLON)&
 & ,  ZTR5(KLON,2,KLEV+1)&
 & ,  ZTRA15(KLON,KLEV+1)  , ZTRA015(KLON,KLEV+1)&
 & ,  ZTRA25(KLON,KLEV+1)  , ZTRA025(KLON,KLEV+1)&
 & ,  ZTR15(KLON)          , ZTR25(KLON)&
 & ,  ZW05(KLON)      , ZW15(KLON)        , ZW25(KLON,2)&
 & ,  ZW35(KLON,3)    , ZW45(KLON)        , ZW55(KLON)  
REAL(KIND=JPRB) :: ZRR25(KLON,2)

REAL(KIND=JPRB) :: ZCGAZ(KLON,KLEV)&
 & ,  ZFD(KLON,KLEV+1)     , ZFU(KLON,KLEV+1) &
 & ,  ZG(KLON)             , ZGG(KLON)&
 & ,  ZPIZAZ(KLON,KLEV)    ,  ZRAYL(KLON)       &
 & ,  ZRAY1(KLON,KLEV+1)   , ZRAY01(KLON,KLEV+1)&
 & ,  ZRAY2(KLON,KLEV+1)   , ZRAY02(KLON,KLEV+1)&
 & ,  ZRE1(KLON)      , ZRE2(KLON)    &
 & ,  ZREFZ(KLON,2,KLEV+1) , ZREFZ0(KLON,2,KLEV+1)&
 & ,  ZRJ(KLON,6,KLEV+1)   , ZRJ0(KLON,6,KLEV+1)&
 & ,  ZRK(KLON,6,KLEV+1)   , ZRK0(KLON,6,KLEV+1)&
 & ,  ZRL(KLON,8)&
 & ,  ZRMUE(KLON,KLEV+1)   , ZRMU0(KLON,KLEV+1) &
 & ,  ZRUEF(KLON,8)    , ZR1(KLON) &
 & ,  ZR2(KLON,2)     , ZR3(KLON,3)      , ZR4(KLON)&
 & ,  ZR21(KLON)      , ZR22(KLON)&
 & ,  ZS(KLON)  
REAL(KIND=JPRB) :: ZTAUAZ(KLON,KLEV)    , ZTO1(KLON)&
 & ,  ZTR(KLON,2,KLEV+1)&
 & ,  ZTRA1(KLON,KLEV+1)   , ZTRA01(KLON,KLEV+1)&
 & ,  ZTRA2(KLON,KLEV+1)   , ZTRA02(KLON,KLEV+1)&
 & ,  ZTR1(KLON)           , ZTR2(KLON)&
 & ,  ZW0(KLON)       , ZW1(KLON)        , ZW2(KLON,2)&
 & ,  ZW3(KLON,3)     , ZW4(KLON)        , ZW5(KLON)&
 & ,  ZTMP1(KLON)     , ZTMP2(KLON)      , ZTMP3(KLON) , ZTMP4(KLON)
REAL(KIND=JPRB) :: ZRR2(KLON,2)

INTEGER(KIND=JPIM) :: IABS, IKL, IKLP1, IKM1, JABS, JAJ, JAJP,&
 & JK, JKKI, JKKP4, JL, JN, JN2J, JREF  

REAL(KIND=JPRB) :: ZAA, ZAA5, ZAAT5, ZBB, ZBB5, ZPNEB, ZPNEB5, &
 & ZCNEB, ZCNEB5, ZRE11, ZRE115, ZRMUM1, ZRMUM15,&
 & ZWH2O, ZWH2O5, ZCHKG, ZCHKG5, ZCHKS, ZCHKS5
REAL(KIND=JPRB) :: ZRMUE5D,  ZWH2O5D
REAL(KIND=JPRB) :: ZPIZAZ5D, ZTO15D, ZCNEB5D, ZW05D
REAL(KIND=JPRB) :: ZRR,ZRR5,ZRRJ,ZRRJ5,ZRRK,ZRRK5
REAL(KIND=JPRB) :: ZLOG15, ZLOG25
REAL(KIND=JPRB) :: ZHOOK_HANDLE

#include "swclrtl.intfb.h"
#include "swdetl.intfb.h"
#include "swrtl.intfb.h"
#include "swtt1tl.intfb.h"
#include "swtttl.intfb.h"

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

!*         1.     NEAR-INFRARED SPECTRAL INTERVAL (0.68-4.00 MICRON)
!                 --------------------------------------------------

! 100 CONTINUE

!*         1.1    OPTICAL THICKNESS FOR RAYLEIGH SCATTERING
!                 -----------------------------------------

! 110 CONTINUE

IF (LHOOK) CALL DR_HOOK('SWNITL',0,ZHOOK_HANDLE)
DO JL = KIDIA,KFDIA
  ZRMUM1  =    - PRMU (JL)
  ZRMUM15 = 1.0_JPRB - PRMU5(JL)
  ZRAYL (JL) =                  ZRMUM1 * (1*RRAY(KNU,2) + ZRMUM15 &
   & * (2*RRAY(KNU,3) + ZRMUM15* (3*RRAY(KNU,4) + ZRMUM15 &
   & * (4*RRAY(KNU,5) + ZRMUM15*  5*RRAY(KNU,6)     ))))  
  ZRAYL5(JL) =  RRAY(KNU,1) + ZRMUM15   * (RRAY(KNU,2) + ZRMUM15 &
   & * (RRAY(KNU,3) + ZRMUM15   * (RRAY(KNU,4) + ZRMUM15 &
   & * (RRAY(KNU,5) + ZRMUM15   *  RRAY(KNU,6)     ))))  
  IF (ZRAYL5(JL) < 0.0_JPRB) THEN
    ZRAYL(JL)  = 0.0_JPRB
    ZRAYL5(JL) = 0.0_JPRB
  ENDIF
ENDDO

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

!*         2.    CONTINUUM SCATTERING CALCULATIONS
!                ---------------------------------

! 200 CONTINUE

!*         2.1   CLEAR-SKY FRACTION OF THE COLUMN
!                --------------------------------

! 210 CONTINUE

CALL SWCLRTL &
 & ( KIDIA   , KFDIA  , KLON   , KLEV   , KAER    , KNU,&
 & PAER5   , PALBP5 , PDSIG5 , ZRAYL5 , PSEC5,&
 & ZCGAZ5  , ZPIZAZ5, ZRAY015, ZRAY025, ZREFZ05, ZRJ05,&
 & ZRK05   , ZRMU05 , ZTAUAZ5, ZTRA015, ZTRA025,&
 & PAER    , PALBP  , PDSIG  , ZRAYL  , PSEC,&
 & ZCGAZ   , ZPIZAZ , ZRAY01 , ZRAY02 , ZREFZ0 , ZRJ0,&
 & ZRK0    , ZRMU0  , ZTAUAZ , ZTRA01 , ZTRA02 &
 & )  

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

!*         2.2   CLOUDY FRACTION OF THE COLUMN
!                -----------------------------

! 220 CONTINUE

CALL SWRTL &
 & ( KIDIA  , KFDIA  , KLON  , KLEV  , KNU,&
 & PALBD5 , PCG5   , PCLD5 ,POMEGA5, PSEC5, PTAU5,&
 & ZCGAZ5 , ZPIZAZ5, ZRAY15, ZRAY25, ZREFZ5 , ZRJ5 , ZRK5, ZRMUE5,&
 & ZTAUAZ5, ZTRA15 , ZTRA25,&
 & PALBD  , PCG    , PCLD  , POMEGA, PSEC , PTAU,&
 & ZCGAZ  , ZPIZAZ , ZRAY1 , ZRAY2 , ZREFZ  , ZRJ  , ZRK , ZRMUE,&
 & ZTAUAZ , ZTRA1  , ZTRA2 &
 & )  

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

!*         3.    SCATTERING CALCULATIONS WITH GREY MOLECULAR ABSORPTION
!                ------------------------------------------------------

! 300 CONTINUE

JN = 2

DO JABS=1,2

!*         3.1  SURFACE CONDITIONS
!               ------------------

! 310 CONTINUE

  DO JL = KIDIA,KFDIA
    ZREFZ (JL,2,1) = PALBD (JL,KNU)
    ZREFZ5(JL,2,1) = PALBD5(JL,KNU)
    ZREFZ (JL,1,1) = PALBD (JL,KNU)
    ZREFZ5(JL,1,1) = PALBD5(JL,KNU)
  ENDDO

!*         3.2  INTRODUCING CLOUD EFFECTS
!               -------------------------

! 320 CONTINUE

  DO JK = 2 , KLEV+1
    IKM1 = JK - 1
    IKL=KLEV+1-IKM1
    DO JL = KIDIA,KFDIA
      IF (JABS == 1.AND. PCLD5(JL,IKM1) > REPSC ) THEN
        IF (PWV5(JL,IKL) >= REPSCQ) THEN
          ZWH2O = PWV (JL,IKL)
          ZWH2O5= PWV5(JL,IKL)
        ELSE
          ZWH2O = 0.0_JPRB
          ZWH2O5= REPSCQ
        ENDIF
        IF (PCLD5(JL,IKM1) <= 1.0_JPRB-REPSC ) THEN
          ZPNEB = PCLD (JL,IKM1)
          ZPNEB5= PCLD5(JL,IKM1)
        ELSE
          ZPNEB = 0.0_JPRB
          ZPNEB5= 1.0_JPRB-REPSC
        ENDIF 
        IF (ZPNEB5 >= REPSC ) THEN
          ZCNEB = ZPNEB 
          ZCNEB5= ZPNEB5
        ELSE
          ZCNEB = 0.0_JPRB
          ZCNEB5= REPSC
        ENDIF

        ZWH2O5D = 1.0_JPRB/ZWH2O5
        ZBB = (PUD (JL,JABS,IKM1)*PQS5(JL,IKL)&
         & +PUD5(JL,JABS,IKM1)*PQS (JL,IKL))*ZWH2O5D &
         & + PUD5(JL,JABS,IKM1)*PQS5(JL,IKL)*(-ZWH2O)*ZWH2O5D**2
        ZBB5=PUD5(JL,JABS,IKM1)*PQS5(JL,IKL)*ZWH2O5D

        ZCNEB5D = 1.0_JPRB/(1.0_JPRB-ZCNEB5)
        ZAAT5= (PUD5(JL,JABS,IKM1)-ZCNEB5*ZBB5)*ZCNEB5D
        IF (ZAAT5 >= REPSCQ) THEN
          ZAA  = (PUD (JL,JABS,IKM1)-ZCNEB *ZBB5 &
           & -ZCNEB5*ZBB )*ZCNEB5D&
           & - (PUD5(JL,JABS,IKM1)-ZCNEB5*ZBB5)*(-ZCNEB)&
           & *(ZCNEB5D**2)
          ZAA5 = ZAAT5
        ELSE
          ZAA  = 0.0_JPRB
          ZAA5 = REPSCQ
        ENDIF
      ELSE
        ZAA =PUD (JL,JABS,IKM1)
        ZAA5=PUD5(JL,JABS,IKM1)
        ZBB =ZAA
        ZBB5=ZAA5
      ENDIF
      
      IF ((PAKI5(JL,JABS,KNU)*ZAA5*1.66_JPRB) <= 200._JPRB) THEN
        ZCHKS  = 1.66_JPRB*(PAKI5(JL,JABS,KNU)*ZAA + ZAA5*PAKI (JL,JABS,KNU)) 
        ZCHKS5 = PAKI5(JL,JABS,KNU)*ZAA5*1.66_JPRB
      ELSE
        ZCHKS  = 0.0_JPRB
        ZCHKS5 = 200._JPRB
      ENDIF
      ZRMUE5D = 1.0_JPRB/ZRMUE5(JL,JK)
      IF ((PAKI5(JL,JABS,KNU)*ZAA5*ZRMUE5D) <= 200._JPRB) THEN
        ZCHKG  = ZAA*PAKI5(JL,JABS,KNU)*ZRMUE5D &
         & + PAKI (JL,JABS,KNU)*ZAA5*ZRMUE5D &
         & - ZRMUE(JL,JK)*PAKI5(JL,JABS,KNU)*ZAA5*ZRMUE5D**2  
        ZCHKG5 = PAKI5(JL,JABS,KNU)*ZAA5*ZRMUE5D
      ELSE
        ZCHKG  = 0.0_JPRB
        ZCHKG5 = 200._JPRB
      ENDIF

      IF( N_VMASS > 0 )THEN
        ZTMP1(JL-KIDIA+1) = 0.0_JPRB - ZCHKS5
        ZTMP2(JL-KIDIA+1) = 0.0_JPRB - ZCHKG5
        ZTMP3(JL-KIDIA+1) = 0.0_JPRB - ZCHKS
        ZTMP4(JL-KIDIA+1) = 0.0_JPRB - ZCHKG
      ELSE
        ZS5(JL) = EXP( - ZCHKS5 )
        ZS(JL)  = -ZCHKS * ZS5(JL)
        ZG5(JL) = EXP( - ZCHKG5 )
        ZG (JL) = -ZCHKG * ZG5(JL) 
      ENDIF

      ZW05D = 1.0_JPRB/POMEGA5(JL,KNU,IKM1)
      ZPIZAZ5D = 1.0_JPRB/ZPIZAZ5(JL,IKM1)

      ZTO1 (JL) = PTAU (JL,KNU,IKM1) * ZW05D&
       & + PTAU5(JL,KNU,IKM1) &
       & *(-POMEGA (JL,KNU,IKM1))*(ZW05D**2)&
       & + ZTAUAZ (JL,IKM1)   * ZPIZAZ5D&
       & + ZTAUAZ5(JL,IKM1)*(-ZPIZAZ(JL,IKM1))*(ZPIZAZ5D**2)&
       & + ZBB * PAKI5(JL,JABS,KNU) + ZBB5* PAKI (JL,JABS,KNU)  
      ZTO15(JL) = PTAU5(JL,KNU,IKM1) * ZW05D&
       & + ZTAUAZ5(JL,IKM1)   * ZPIZAZ5D&
       & + ZBB5 * PAKI5(JL,JABS,KNU)  

      ZR21 (JL) = PTAU (JL,KNU,IKM1) + ZTAUAZ (JL,IKM1)
      ZR215(JL) = PTAU5(JL,KNU,IKM1) + ZTAUAZ5(JL,IKM1)
      ZR22 (JL) = PTAU (JL,KNU,IKM1) / ZR215(JL)&
       & + PTAU5(JL,KNU,IKM1) *(-ZR21 (JL))/(ZR215(JL)**2)  
      ZR225(JL) = PTAU5(JL,KNU,IKM1) / ZR215(JL)
      ZGG (JL) = ZR22 (JL) * PCG5(JL,KNU,IKM1)&
       & + ZR225(JL) * PCG (JL,KNU,IKM1)&
       & + (   - ZR22 (JL)) * ZCGAZ5(JL,IKM1)&
       & + (1.0_JPRB - ZR225(JL)) * ZCGAZ (JL,IKM1)  
      ZGG5(JL) = ZR225(JL) * PCG5(JL,KNU,IKM1)&
       & + (1.0_JPRB - ZR225(JL)) * ZCGAZ5(JL,IKM1)  
      ZTO15D = 1.0_JPRB/ZTO15(JL)
      ZW0 (JL) = ZR21 (JL) * ZTO15D + ZR215(JL)*(-ZTO1(JL))*(ZTO15D**2)
      ZW05(JL) = ZR215(JL) * ZTO15D
    ENDDO

    IF( N_VMASS > 0 )THEN
      CALL VEXP(ZS5(KIDIA),ZTMP1,KFDIA-KIDIA+1)
      CALL VEXP(ZG5(KIDIA),ZTMP2,KFDIA-KIDIA+1)
    ENDIF

    CALL SWDETL &
     & ( KIDIA , KFDIA , KLON,&
     & ZGG5  , ZREFZ5(1,1,IKM1), ZRMUE5(1,JK), ZTO15, ZW05,&
     & ZRE15 , ZRE25 , ZTR15 , ZTR25,&
     & ZGG   , ZREFZ(1,1,IKM1) , ZRMUE(1,JK) , ZTO1 , ZW0,&
     & ZRE1  , ZRE2  , ZTR1  , ZTR2    &
     & )  

    DO JL = KIDIA,KFDIA

      IF( N_VMASS > 0 )THEN
        ZS(JL) = ZTMP3(JL-KIDIA+1) * ZS5(JL)
        ZG(JL) = ZTMP4(JL-KIDIA+1) * ZG5(JL)
      ENDIF

      ZRR5=1.0_JPRB/(1.0_JPRB-ZRAY25(JL,IKM1)*ZREFZ5(JL,1,IKM1))
      ZRR=(ZRAY2(JL,IKM1)*ZREFZ5(JL,1,IKM1)+ZRAY25(JL,IKM1)*ZREFZ(JL,1,IKM1)) &
       & *ZRR5*ZRR5  

      ZREFZ (JL,2,JK) =&
       & PCLD (JL,IKM1) * ZRE15(JL) + PCLD5(JL,IKM1) * ZRE1 (JL)&
       & + (  -PCLD (JL,IKM1)) &
       & * (ZRAY15(JL,IKM1)&
       & + ZREFZ5(JL,2,IKM1) * ZTRA15(JL,IKM1) * ZTRA25(JL,IKM1) )&
       & * ZG5(JL) * ZS5(JL)&
       & + (1.0_JPRB-PCLD5(JL,IKM1))&
       & * (ZRAY1 (JL,IKM1) &
       & + ZREFZ (JL,2,IKM1) * ZTRA15(JL,IKM1) * ZTRA25(JL,IKM1)&
       & +ZREFZ5(JL,2,IKM1) * ZTRA1 (JL,IKM1) * ZTRA25(JL,IKM1)&
       & +ZREFZ5(JL,2,IKM1) * ZTRA15(JL,IKM1) * ZTRA2 (JL,IKM1) )&
       & * ZG5(JL) * ZS5(JL)&
       & + (1.0_JPRB-PCLD5(JL,IKM1))&
       & * (ZRAY15(JL,IKM1)&
       & + ZREFZ5(JL,2,IKM1) * ZTRA15(JL,IKM1) * ZTRA25(JL,IKM1) )&
       & * (ZG (JL)*ZS5(JL) + ZG5(JL)*ZS (JL))  

      ZREFZ5(JL,2,JK) =&
       & PCLD5(JL,IKM1) * ZRE15(JL)&
       & + (1.0_JPRB-PCLD5(JL,IKM1))&
       & * (ZRAY15(JL,IKM1)&
       & + ZREFZ5(JL,2,IKM1) * ZTRA15(JL,IKM1) * ZTRA25(JL,IKM1) )&
       & * ZG5(JL) * ZS5(JL)  

      ZTR (JL,2,IKM1)=&
       & PCLD (JL,IKM1)*ZTR15(JL) + PCLD5(JL,IKM1)*ZTR1 (JL)&
       & + (ZTRA1 (JL,IKM1)) * ZG5(JL) * (1.0_JPRB-PCLD5(JL,IKM1))&
       & + (ZTRA15(JL,IKM1)) * ZG (JL) * (1.0_JPRB-PCLD5(JL,IKM1))&
       & + (ZTRA15(JL,IKM1)) * ZG5(JL) * (  -PCLD (JL,IKM1))  

      ZTR5(JL,2,IKM1)=&
       & PCLD5(JL,IKM1)*ZTR15(JL)&
       & + (ZTRA15(JL,IKM1)) * ZG5(JL) * (1.0_JPRB-PCLD5(JL,IKM1))  

      ZREFZ(JL,1,JK) = PCLD5(JL,IKM1) * ZRE2(JL) + ZRE25(JL)*PCLD(JL,IKM1) &
       & + (1.0_JPRB-PCLD5(JL,IKM1))*ZG5(JL)*ZS5(JL) &
       & * (ZRAY1(JL,IKM1) &
       & + ZREFZ5(JL,1,IKM1)*ZTRA15(JL,IKM1)*ZTRA25(JL,IKM1)*ZRR &
       & + ZREFZ5(JL,1,IKM1)*ZTRA15(JL,IKM1)*ZRR5*ZTRA2(JL,IKM1) &
       & + ZREFZ5(JL,1,IKM1)*ZTRA25(JL,IKM1)*ZRR5*ZTRA1(JL,IKM1) &
       & + ZTRA25(JL,IKM1)*ZRR5*ZTRA15(JL,IKM1)*ZREFZ(JL,1,IKM1))&
       & + (ZRAY15(JL,IKM1)+ZREFZ5(JL,1,IKM1)*ZTRA15(JL,IKM1) &
       & * ZTRA25(JL,IKM1)*ZRR5 ) &
       & * (-ZG5(JL)*ZS5(JL)*PCLD(JL,IKM1) &
       & + (1.0_JPRB-PCLD5(JL,IKM1))*ZG5(JL)*ZS(JL) &
       & + (1.0_JPRB-PCLD5(JL,IKM1))*ZS5(JL)*ZG(JL))  

      ZREFZ5(JL,1,JK) =&
       & PCLD5(JL,IKM1) * ZRE25(JL)&
       & + (1.0_JPRB-PCLD5(JL,IKM1))&
       & * (ZRAY15(JL,IKM1)&
       & + ZREFZ5(JL,1,IKM1) * ZTRA15(JL,IKM1) * ZTRA25(JL,IKM1)&
       & *ZRR5 ) &
       & * ZG5(JL) * ZS5(JL)  

      ZTR (JL,1,IKM1)=&
       & PCLD (JL,IKM1) * ZTR25(JL) + PCLD5(JL,IKM1) * ZTR2 (JL)&
       & + (ZTRA1 (JL,IKM1)  &
       & *ZRR5 )&
       & * ZG5(JL) * (1.0_JPRB -PCLD5(JL,IKM1))&
       & + (ZTRA15(JL,IKM1)  &
       & *ZRR )&
       & * ZG5(JL) * (1.0_JPRB -PCLD5(JL,IKM1))&
       & + (ZTRA15(JL,IKM1)&
       & *ZRR5 )&
       & * ( ZG(JL)*(1.0_JPRB-PCLD5(JL,IKM1)) + ZG5(JL)*(  -PCLD (JL,IKM1)) )  

      ZTR5(JL,1,IKM1)=&
       & PCLD5(JL,IKM1) * ZTR25(JL)&
       & + (ZTRA15(JL,IKM1)  &
       & *ZRR5 )&
       & * ZG5(JL) * (1.0_JPRB -PCLD5(JL,IKM1))  

    ENDDO
  ENDDO

!*         3.3  REFLECT./TRANSMISSIVITY BETWEEN SURFACE AND LEVEL
!               -------------------------------------------------

! 330 CONTINUE

  DO JREF=1,2

    JN = JN + 1

    DO JL = KIDIA,KFDIA
      ZRJ (JL,JN,KLEV+1) = 0.0_JPRB
      ZRJ5(JL,JN,KLEV+1) = 1.0_JPRB
      ZRK (JL,JN,KLEV+1) = ZREFZ (JL,JREF,KLEV+1)
      ZRK5(JL,JN,KLEV+1) = ZREFZ5(JL,JREF,KLEV+1)
    ENDDO

    DO JK = 1 , KLEV
      IKL = KLEV+1 - JK
      IKLP1 = IKL + 1
      DO JL = KIDIA,KFDIA
        ZRE11  = ZRJ (JL,JN,IKLP1) * ZTR5(JL,JREF,IKL)&
         & + ZRJ5(JL,JN,IKLP1) * ZTR (JL,JREF,IKL)  
        ZRE115 = ZRJ5(JL,JN,IKLP1) * ZTR5(JL,JREF,IKL)
        ZRJ (JL,JN,IKL) = ZRE11
        ZRJ5(JL,JN,IKL) = ZRE115
        ZRK (JL,JN,IKL) = ZRE11  * ZREFZ5(JL,JREF,IKL)&
         & + ZRE115 * ZREFZ (JL,JREF,IKL)  
        ZRK5(JL,JN,IKL) = ZRE115 * ZREFZ5(JL,JREF,IKL)
      ENDDO
    ENDDO
  ENDDO
ENDDO

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

!*         4.    INVERT GREY AND CONTINUUM FLUXES
!                --------------------------------

! 400 CONTINUE

!*         4.1   UPWARD (ZRK) AND DOWNWARD (ZRJ) PSEUDO-FLUXES
!                ---------------------------------------------

! 410 CONTINUE

DO JK = 1 , KLEV+1
  DO JAJ = 1 , 5 , 2
    JAJP = JAJ + 1
    DO JL = KIDIA,KFDIA
      ZRJ (JL,JAJ,JK)=        ZRJ (JL,JAJ,JK) - ZRJ (JL,JAJP,JK)
      ZRJ5(JL,JAJ,JK)=        ZRJ5(JL,JAJ,JK) - ZRJ5(JL,JAJP,JK)
      ZRK (JL,JAJ,JK)=        ZRK (JL,JAJ,JK) - ZRK (JL,JAJP,JK)
      ZRK5(JL,JAJ,JK)=        ZRK5(JL,JAJ,JK) - ZRK5(JL,JAJP,JK)
      IF (ZRJ5(JL,JAJ,JK) <= REPLOG) THEN
        ZRJ (JL,JAJ,JK) = 0.0_JPRB
        ZRJ5(JL,JAJ,JK) = REPLOG
      ENDIF
      IF (ZRK5(JL,JAJ,JK) <= REPLOG) THEN
        ZRK (JL,JAJ,JK) = 0.0_JPRB
        ZRK5(JL,JAJ,JK) = REPLOG
      ENDIF
    ENDDO
  ENDDO
ENDDO

DO JK = 1 , KLEV+1
  DO JAJ = 2 , 6 , 2
    DO JL = KIDIA,KFDIA
      IF (ZRJ5(JL,JAJ,JK) <= REPLOG) THEN
        ZRJ (JL,JAJ,JK) = 0.0_JPRB
        ZRJ5(JL,JAJ,JK) = REPLOG
      ENDIF
      IF (ZRK5(JL,JAJ,JK) <= REPLOG) THEN
        ZRK (JL,JAJ,JK) = 0.0_JPRB
        ZRK5(JL,JAJ,JK) = REPLOG
      ENDIF
    ENDDO
  ENDDO
ENDDO

!*         4.2    EFFECTIVE ABSORBER AMOUNTS BY INVERSE LAPLACE
!                 ---------------------------------------------

! 420 CONTINUE

DO JAJ = 1 , 2
  DO JL = KIDIA,KFDIA
    ZRR25(JL,JAJ)=1.0_JPRB/PAKI5(JL,JAJ,KNU)
    ZRR2 (JL,JAJ)=-PAKI(JL,JAJ,KNU)*ZRR25(JL,JAJ)**2
  ENDDO
ENDDO

DO JK = 1 , KLEV+1
  JKKI = 1
  DO JAJ = 1 , 2
    IIND2(1)=JAJ
    IIND2(2)=JAJ
    DO JN = 1 , 2
      JN2J = JN + 2 * JAJ
      JKKP4 = JKKI + 4

!*         4.2.1  EFFECTIVE ABSORBER AMOUNTS
!                 --------------------------

!4210 CONTINUE

      IF( N_VMASS > 0 )THEN

        CALL VDIV(ZTMP1,ZRJ5(KIDIA,JN,JK),ZRJ5(KIDIA,JN2J,JK),KFDIA-KIDIA+1)
        CALL VLOG(ZTMP2,ZTMP1,KFDIA-KIDIA+1)
        CALL VDIV(ZTMP3,ZRK5(KIDIA,JN,JK),ZRK5(KIDIA,JN2J,JK),KFDIA-KIDIA+1)
        CALL VLOG(ZTMP4,ZTMP3,KFDIA-KIDIA+1)

        DO JL = KIDIA,KFDIA

!          ZRR5=1.0_JPRB/PAKI5(JL,JAJ,KNU)
!          ZRR=-PAKI(JL,JAJ,KNU)*ZRR5**2

          ZRRJ=( ZRJ (JL,JN,JK) * ZRJ5(JL,JN2J,JK)&
           & -ZRJ5(JL,JN,JK) * ZRJ (JL,JN2J,JK) )&
           & / ZRJ5(JL,JN2J,JK)**2

          ZRRK=( ZRK (JL,JN,JK) * ZRK5(JL,JN2J,JK)&
           & -ZRK5(JL,JN,JK) * ZRK (JL,JN2J,JK) )&
           & / ZRK5(JL,JN2J,JK)**2

          ZW2 (JL,1) = ZRRJ*ZRR25(JL,JAJ)/ZTMP1(JL-KIDIA+1) &
           & + ZTMP2(JL-KIDIA+1)*ZRR2(JL,JAJ)
          ZW25(JL,1) = ZTMP2(JL) * ZRR25(JL,JAJ)

          ZW2 (JL,2) = ZRRK*ZRR25(JL,JAJ)/ZTMP3(JL-KIDIA+1) &
           & + ZTMP4(JL-KIDIA+1)*ZRR2(JL,JAJ)
          ZW25(JL,2) = ZTMP4(JL-KIDIA+1) * ZRR25(JL,JAJ)
        ENDDO

      ELSE

        DO JL = KIDIA,KFDIA

!          ZRR5=1.0_JPRB/PAKI5(JL,JAJ,KNU)
!          ZRR=-PAKI(JL,JAJ,KNU)*ZRR5**2

          ZRRJ=( ZRJ (JL,JN,JK) * ZRJ5(JL,JN2J,JK)&
           & -ZRJ5(JL,JN,JK) * ZRJ (JL,JN2J,JK) )&
           & / ZRJ5(JL,JN2J,JK)**2  
          ZRRJ5=ZRJ5(JL,JN,JK)/ ZRJ5(JL,JN2J,JK) 
   
          ZRRK=( ZRK (JL,JN,JK) * ZRK5(JL,JN2J,JK)&
           & -ZRK5(JL,JN,JK) * ZRK (JL,JN2J,JK) )&
           & / ZRK5(JL,JN2J,JK)**2  
          ZRRK5=ZRK5(JL,JN,JK)/ ZRK5(JL,JN2J,JK) 

          ZLOG15 = LOG(ZRRJ5)
          ZW2 (JL,1) = ZRRJ*ZRR25(JL,JAJ)/ZRRJ5+ ZLOG15*ZRR2(JL,JAJ)
          ZW25(JL,1) = ZLOG15 * ZRR25(JL,JAJ)

          ZLOG25 = LOG(ZRRK5)
          ZW2 (JL,2) = ZRRK*ZRR25(JL,JAJ)/ZRRK5+ ZLOG25*ZRR2(JL,JAJ)
          ZW25(JL,2) = ZLOG25 * ZRR25(JL,JAJ)
        ENDDO

      ENDIF

!*         4.2.2  TRANSMISSION FUNCTION
!                 ---------------------

!4220 CONTINUE

      CALL SWTT1TL( KIDIA,KFDIA,KLON, KNU, 2, IIND2, ZW25, ZR25, ZW2, ZR2)

      DO JL = KIDIA,KFDIA
        ZRL (JL,JKKI)   = ZR2 (JL,1)
        ZRL5(JL,JKKI)   = ZR25(JL,1)
        ZRUEF (JL,JKKI) = ZW2 (JL,1)
        ZRUEF5(JL,JKKI) = ZW25(JL,1)
        ZRL (JL,JKKP4)  = ZR2 (JL,2)
        ZRL5(JL,JKKP4)  = ZR25(JL,2)
        ZRUEF (JL,JKKP4)= ZW2 (JL,2)
        ZRUEF5(JL,JKKP4)= ZW25(JL,2)
      ENDDO

      JKKI=JKKI+1
    ENDDO
  ENDDO

!*         4.3    UPWARD AND DOWNWARD FLUXES WITH H2O AND UMG ABSORPTION
!                 ------------------------------------------------------

! 430 CONTINUE

  DO JL = KIDIA,KFDIA
    PFDOWN (JL,JK) = ZRJ (JL,1,JK) * ZRL5(JL,1) * ZRL5(JL,3)&
     & + ZRJ (JL,2,JK) * ZRL5(JL,2) * ZRL5(JL,4)&
     & + ZRJ5(JL,1,JK) * ZRL (JL,1) * ZRL5(JL,3)&
     & + ZRJ5(JL,2,JK) * ZRL (JL,2) * ZRL5(JL,4)&
     & + ZRJ5(JL,1,JK) * ZRL5(JL,1) * ZRL (JL,3)&
     & + ZRJ5(JL,2,JK) * ZRL5(JL,2) * ZRL (JL,4)  
    PFDOWN5(JL,JK) = ZRJ5(JL,1,JK) * ZRL5(JL,1) * ZRL5(JL,3)&
     & + ZRJ5(JL,2,JK) * ZRL5(JL,2) * ZRL5(JL,4)  
    PFUP (JL,JK)   = ZRK (JL,1,JK) * ZRL5(JL,5) * ZRL5(JL,7)&
     & + ZRK (JL,2,JK) * ZRL5(JL,6) * ZRL5(JL,8)&
     & + ZRK5(JL,1,JK) * ZRL (JL,5) * ZRL5(JL,7)&
     & + ZRK5(JL,2,JK) * ZRL (JL,6) * ZRL5(JL,8)&
     & + ZRK5(JL,1,JK) * ZRL5(JL,5) * ZRL (JL,7)&
     & + ZRK5(JL,2,JK) * ZRL5(JL,6) * ZRL (JL,8)  
    PFUP5(JL,JK)   = ZRK5(JL,1,JK) * ZRL5(JL,5) * ZRL5(JL,7)&
     & + ZRK5(JL,2,JK) * ZRL5(JL,6) * ZRL5(JL,8)  
  ENDDO
ENDDO

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

!*         5.    MOLECULAR ABSORPTION ON CLEAR-SKY FLUXES
!                ----------------------------------------

! 500 CONTINUE

!*         5.1   DOWNWARD FLUXES
!                ---------------

! 510 CONTINUE

JAJ = 2
IIND3(1)=1
IIND3(2)=2
IIND3(3)=3

DO JL = KIDIA,KFDIA
  ZW3 (JL,1)=0.0_JPRB
  ZW3 (JL,2)=0.0_JPRB
  ZW3 (JL,3)=0.0_JPRB
  ZW4 (JL)  =0.0_JPRB
  ZW5 (JL)  =0.0_JPRB
  ZR4 (JL)  =0.0_JPRB
  ZFD (JL,KLEV+1)= ZRJ0 (JL,JAJ,KLEV+1)
  ZW35(JL,1)=0.0_JPRB
  ZW35(JL,2)=0.0_JPRB
  ZW35(JL,3)=0.0_JPRB
  ZW45(JL)  =0.0_JPRB
  ZW55(JL)  =0.0_JPRB
  ZR45(JL)  =1.0_JPRB
  ZFD5(JL,KLEV+1)= ZRJ05(JL,JAJ,KLEV+1)
ENDDO
DO JK = 1 , KLEV
  IKL = KLEV+1-JK
  DO JL = KIDIA,KFDIA
    ZRR5=1.0_JPRB/ZRMU05(JL,IKL)
    ZRR=-ZRMU0(JL,IKL)*(ZRR5**2)
    ZW3 (JL,1)=ZW3 (JL,1)+PUD (JL,1,IKL)*ZRR5&
     & +PUD5(JL,1,IKL)*ZRR  
    ZW3 (JL,2)=ZW3 (JL,2)+PUD (JL,2,IKL)*ZRR5&
     & +PUD5(JL,2,IKL)*ZRR  
    ZW3 (JL,3)=ZW3 (JL,3)+POZ (JL,  IKL)*ZRR5&
     & +POZ5(JL,  IKL)*ZRR  
    ZW4 (JL)  =ZW4 (JL)  +PUD (JL,4,IKL)*ZRR5&
     & +PUD5(JL,4,IKL)*ZRR  
    ZW5 (JL)  =ZW5 (JL)  +PUD (JL,5,IKL)*ZRR5&
     & +PUD5(JL,5,IKL)*ZRR  
    ZW35(JL,1)=ZW35(JL,1)+PUD5(JL,1,IKL)*ZRR5
    ZW35(JL,2)=ZW35(JL,2)+PUD5(JL,2,IKL)*ZRR5
    ZW35(JL,3)=ZW35(JL,3)+POZ5(JL,  IKL)*ZRR5
    ZW45(JL)  =ZW45(JL)  +PUD5(JL,4,IKL)*ZRR5
    ZW55(JL)  =ZW55(JL)  +PUD5(JL,5,IKL)*ZRR5
  ENDDO

  CALL SWTT1TL( KIDIA,KFDIA,KLON, KNU, 3, IIND3, ZW35, ZR35, ZW3, ZR3)

  DO JL = KIDIA,KFDIA
!cc      ZR4 (JL) = (-RSWCE(KNU)*ZW4 (JL)-RSWCP(KNU)*ZW5 (JL))
!cc  $                * EXP(-RSWCE(KNU)*ZW45(JL)-RSWCP(KNU)*ZW55(JL))
    ZR45(JL) = EXP(-RSWCE(KNU)*ZW45(JL)-RSWCP(KNU)*ZW55(JL))
    ZR4 (JL) = (-RSWCE(KNU)*ZW4 (JL)-RSWCP(KNU)*ZW5 (JL))* ZR45(JL)
    ZFD (JL,IKL) = ZR3 (JL,1)*ZR35(JL,2)*ZR35(JL,3)*ZR45(JL)&
     & * ZRJ05(JL,JAJ,IKL)&
     & + ZR35(JL,1)*ZR3 (JL,2)*ZR35(JL,3)*ZR45(JL)&
     & * ZRJ05(JL,JAJ,IKL)&
     & + ZR35(JL,1)*ZR35(JL,2)*ZR3 (JL,3)*ZR45(JL)&
     & * ZRJ05(JL,JAJ,IKL)&
     & + ZR35(JL,1)*ZR35(JL,2)*ZR35(JL,3)*ZR4 (JL)&
     & * ZRJ05(JL,JAJ,IKL)&
     & + ZR35(JL,1)*ZR35(JL,2)*ZR35(JL,3)*ZR45(JL)&
     & * ZRJ0 (JL,JAJ,IKL)  
    ZFD5(JL,IKL) = ZR35(JL,1)*ZR35(JL,2)*ZR35(JL,3)*ZR45(JL)&
     & * ZRJ05(JL,JAJ,IKL)  
  ENDDO
ENDDO

!*         5.2   UPWARD FLUXES
!                -------------

! 520 CONTINUE

DO JL = KIDIA,KFDIA
  ZFU (JL,1) = ZFD (JL,1)*PALBP5(JL,KNU)+ ZFD5(JL,1)*PALBP (JL,KNU)
  ZFU5(JL,1) = ZFD5(JL,1)*PALBP5(JL,KNU)
ENDDO

DO JK = 2 , KLEV+1
  IKM1=JK-1
  DO JL = KIDIA,KFDIA
    ZW3 (JL,1)=ZW3 (JL,1)+PUD (JL,1,IKM1)*1.66_JPRB
    ZW3 (JL,2)=ZW3 (JL,2)+PUD (JL,2,IKM1)*1.66_JPRB
    ZW3 (JL,3)=ZW3 (JL,3)+POZ (JL,  IKM1)*1.66_JPRB
    ZW4 (JL)  =ZW4 (JL)  +PUD (JL,4,IKM1)*1.66_JPRB
    ZW5 (JL)  =ZW5 (JL)  +PUD (JL,5,IKM1)*1.66_JPRB
    ZW35(JL,1)=ZW35(JL,1)+PUD5(JL,1,IKM1)*1.66_JPRB
    ZW35(JL,2)=ZW35(JL,2)+PUD5(JL,2,IKM1)*1.66_JPRB
    ZW35(JL,3)=ZW35(JL,3)+POZ5(JL,  IKM1)*1.66_JPRB
    ZW45(JL)  =ZW45(JL)  +PUD5(JL,4,IKM1)*1.66_JPRB
    ZW55(JL)  =ZW55(JL)  +PUD5(JL,5,IKM1)*1.66_JPRB
  ENDDO

  CALL SWTT1TL( KIDIA,KFDIA,KLON, KNU, 3, IIND3, ZW35, ZR35, ZW3, ZR3)

  DO JL = KIDIA,KFDIA
!cc      ZR4(JL) = (-RSWCE(KNU)*ZW4 (JL)-RSWCP(KNU)*ZW5 (JL))
!cc     $            * EXP(-RSWCE(KNU)*ZW45(JL)-RSWCP(KNU)*ZW55(JL))
    ZR45(JL) = EXP(-RSWCE(KNU)*ZW45(JL)-RSWCP(KNU)*ZW55(JL))
    ZR4 (JL) = (-RSWCE(KNU)*ZW4 (JL)-RSWCP(KNU)*ZW5 (JL))* ZR45(JL)
    ZFU (JL,JK) = ZR3 (JL,1)*ZR35(JL,2)*ZR35(JL,3)*ZR45(JL)&
     & * ZRK05(JL,JAJ,JK)&
     & + ZR35(JL,1)*ZR3 (JL,2)*ZR35(JL,3)*ZR45(JL)&
     & * ZRK05(JL,JAJ,JK)&
     & + ZR35(JL,1)*ZR35(JL,2)*ZR3 (JL,3)*ZR45(JL)&
     & * ZRK05(JL,JAJ,JK)&
     & + ZR35(JL,1)*ZR35(JL,2)*ZR35(JL,3)*ZR4 (JL)&
     & * ZRK05(JL,JAJ,JK)&
     & + ZR35(JL,1)*ZR35(JL,2)*ZR35(JL,3)*ZR45(JL)&
     & * ZRK0 (JL,JAJ,JK)  
    ZFU5(JL,JK) = ZR35(JL,1)*ZR35(JL,2)*ZR35(JL,3)*ZR45(JL)* ZRK05(JL,JAJ,JK)
  ENDDO
ENDDO

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

!*         6.     INTRODUCTION OF OZONE AND H2O CONTINUUM ABSORPTION
!                 --------------------------------------------------

! 600 CONTINUE
IABS=3

!*         6.1    DOWNWARD FLUXES
!                 ---------------

! 610 CONTINUE
DO JL = KIDIA,KFDIA
  ZW1 (JL)=0.0_JPRB
  ZW4 (JL)=0.0_JPRB
  ZW5 (JL)=0.0_JPRB
  ZR1 (JL)=0.0_JPRB
  ZW15 (JL)=0.0_JPRB
  ZW45(JL)=0.0_JPRB
  ZW55(JL)=0.0_JPRB
  ZR15(JL)=0.0_JPRB
  PFDOWN (JL,KLEV+1) = ((  -PCLEAR (JL))*PFDOWN5(JL,KLEV+1)&
   & +  (1.0_JPRB-PCLEAR5(JL))*PFDOWN (JL,KLEV+1)&
   & + PCLEAR (JL) * ZFD5(JL,KLEV+1)&
   & + PCLEAR5(JL) * ZFD (JL,KLEV+1)) * RSUN(KNU)  
  PFDOWN5(JL,KLEV+1) = ((1.0_JPRB-PCLEAR5(JL))*PFDOWN5(JL,KLEV+1)&
   & + PCLEAR5(JL) * ZFD5(JL,KLEV+1)) * RSUN(KNU)  

! diagnostic clear sky quantity
!  PCDOWN (JL,KLEV+1) = ZFD (JL,KLEV+1) * RSUN(KNU)
!  PCDOWN5(JL,KLEV+1) = ZFD5(JL,KLEV+1) * RSUN(KNU)
ENDDO

DO JK = 1 , KLEV
  IKL=KLEV+1-JK

  DO JL = KIDIA,KFDIA
    ZRR5=1.0_JPRB/ZRMUE5(JL,IKL)
    ZRR=-ZRMUE(JL,IKL)*(ZRR5**2)
    ZW1 (JL) = ZW1 (JL)+POZ (JL,  IKL)*ZRR5+POZ5(JL,  IKL)*ZRR
    ZW15(JL) = ZW15(JL)+POZ5(JL,  IKL)*ZRR5
    ZW4 (JL) = ZW4 (JL)+PUD (JL,4,IKL)*ZRR5+PUD5(JL,4,IKL)*ZRR
    ZW45(JL) = ZW45(JL)+PUD5(JL,4,IKL)*ZRR5
    ZW5 (JL) = ZW5 (JL)+PUD (JL,5,IKL)*ZRR5+PUD5(JL,5,IKL)*ZRR
    ZW55(JL) = ZW55(JL)+PUD5(JL,5,IKL)*ZRR5
!cc      ZR4(JL) = (-RSWCE(KNU)*ZW4 (JL)-RSWCP(KNU)*ZW5 (JL))
!cc     $            * EXP(-RSWCE(KNU)*ZW45(JL)-RSWCP(KNU)*ZW55(JL))
    ZR45(JL) = EXP(-RSWCE(KNU)*ZW45(JL)-RSWCP(KNU)*ZW55(JL))
    ZR4 (JL) = (-RSWCE(KNU)*ZW4 (JL)-RSWCP(KNU)*ZW5 (JL))*  ZR45(JL)
  ENDDO

  CALL SWTTTL( KIDIA,KFDIA,KLON, KNU, IABS, ZW15, ZR15, ZW1, ZR1)

  DO JL = KIDIA,KFDIA
    PFDOWN (JL,IKL) = (&
     & (  -PCLEAR (JL)) * ZR15(JL)*ZR45(JL)*PFDOWN5(JL,IKL)&
     & +(1.0_JPRB-PCLEAR5(JL))&
     & *(ZR1 (JL)*ZR45(JL)*PFDOWN5(JL,IKL)&
     & +ZR15(JL)*ZR4 (JL)*PFDOWN5(JL,IKL)&
     & +ZR15(JL)*ZR45(JL)*PFDOWN (JL,IKL))&
     & +    PCLEAR (JL)                    *ZFD5(JL,IKL)&
     & +PCLEAR5(JL)*ZFD (JL,IKL)) * RSUN(KNU)  
    PFDOWN5(JL,IKL) = (&
     & (1.0_JPRB-PCLEAR5(JL)) *ZR15(JL)*ZR45(JL)*PFDOWN5(JL,IKL)&
     & +PCLEAR5(JL)*ZFD5(JL,IKL)) * RSUN(KNU)  

! diagnostic clear sky quantity
!    PCDOWN (JL,IKL) = ZFD (JL,IKL) * RSUN(KNU)
!    PCDOWN5(JL,IKL) = ZFD5(JL,IKL) * RSUN(KNU)
  ENDDO
ENDDO

!*         6.2    UPWARD FLUXES
!                 -------------

! 620 CONTINUE
DO JL = KIDIA,KFDIA
  PFUP (JL,1) = (&
   & (  -PCLEAR (JL)) * ZR15(JL)*ZR45(JL) * PFUP5(JL,1)&
   & +(1.0_JPRB-PCLEAR5(JL))&
   & *(ZR1 (JL)*ZR45(JL) * PFUP5(JL,1)&
   & +ZR15(JL)*ZR4 (JL) * PFUP5(JL,1)&
   & +ZR15(JL)*ZR45(JL) * PFUP (JL,1) )&
   & +    PCLEAR (JL)                      * ZFU5(JL,1)&
   & +PCLEAR5(JL)*ZFU (JL,1)) * RSUN(KNU)  
  PFUP5(JL,1) = (&
   & (1.0_JPRB-PCLEAR5(JL)) * ZR15(JL)*ZR45(JL) * PFUP5(JL,1)&
   & +PCLEAR5(JL)* ZFU5(JL,1)) * RSUN(KNU)  

! diagnostic clear sky quantity
!  PCUP (JL,1) = ZFU (JL,1) * RSUN(KNU)
!  PCUP5(JL,1) = ZFU5(JL,1) * RSUN(KNU)
ENDDO

DO JK = 2 , KLEV+1
  IKM1=JK-1
  DO JL = KIDIA,KFDIA
    ZW1 (JL) = ZW1 (JL)+POZ (JL  ,IKM1)*1.66_JPRB
    ZW15(JL) = ZW15(JL)+POZ5(JL  ,IKM1)*1.66_JPRB
    ZW4 (JL) = ZW4 (JL)+PUD (JL,4,IKM1)*1.66_JPRB
    ZW45(JL) = ZW45(JL)+PUD5(JL,4,IKM1)*1.66_JPRB
    ZW5 (JL) = ZW5 (JL)+PUD (JL,5,IKM1)*1.66_JPRB
    ZW55(JL) = ZW55(JL)+PUD5(JL,5,IKM1)*1.66_JPRB
    ZR45(JL) = EXP(-RSWCE(KNU)*ZW45(JL)-RSWCP(KNU)*ZW55(JL))
    ZR4 (JL) = (-RSWCE(KNU)*ZW4 (JL)-RSWCP(KNU)*ZW5 (JL))* ZR45(JL)
  ENDDO

  CALL SWTTTL ( KIDIA,KFDIA,KLON, KNU, IABS, ZW15, ZR15, ZW1, ZR1)

  DO JL = KIDIA,KFDIA
    PFUP (JL,JK) = (&
     & (  -PCLEAR (JL)) * ZR15(JL)*ZR45(JL) * PFUP5(JL,JK)&
     & +(1.0_JPRB-PCLEAR5(JL))&
     & *(ZR1 (JL)*ZR45(JL) * PFUP5(JL,JK)&
     & +ZR15(JL)*ZR4 (JL) * PFUP5(JL,JK)&
     & +ZR15(JL)*ZR45(JL) * PFUP (JL,JK) )&
     & +    PCLEAR (JL)                      * ZFU5(JL,JK)&
     & +PCLEAR5(JL)*ZFU (JL,JK)) * RSUN(KNU)  
    PFUP5(JL,JK) = (&
     & (1.0_JPRB-PCLEAR5(JL)) * ZR15(JL)*ZR45(JL) * PFUP5(JL,JK)&
     & +PCLEAR5(JL) * ZFU5(JL,JK)) * RSUN(KNU)  

! diagnostic clear sky quantity
!    PCUP (JL,JK) = ZFU (JL,JK) * RSUN(KNU)
!    PCUP5(JL,JK) = ZFU5(JL,JK) * RSUN(KNU)
  ENDDO
ENDDO

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

IF (LHOOK) CALL DR_HOOK('SWNITL',1,ZHOOK_HANDLE)
END SUBROUTINE SWNITL
