SUBROUTINE LWUAD &
 & ( KIDIA, KFDIA, KLON, KLEV,&
 & PVIEW  , PCCO2 , PAER5 , PDP5 , PPMB5, PQOF5 , PTAVE5, PWV5,&
 & PABCU5 ,&
 & PAER   , PDP   , PPMB  , PQOF , PTAVE , PWV   ,&
 & PABCU  &
 & )

!**** *LWUAD* - LONGWAVE EFFECTIVE ABSORBER AMOUNTS
!                      (adjoint)

!     PURPOSE.
!     --------
!           COMPUTES ABSORBER AMOUNTS INCLUDING PRESSURE AND
!           TEMPERATURE EFFECTS

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

!        EXPLICIT ARGUMENTS :
!        --------------------
!     ==== INPUTS ===
!  Trajectory  Perturbation  Description                         Dimension
!  PAER5       PAER          OPTICAL THICKNESS OF THE AEROSOLS   (KLON,6,KLEV)
!  PCCO2       ---           CONCENTRATION IN CO2 (PA/PA)        
!  PDP5        PDP           LAYER PRESSURE THICKNESS (PA)       (KLON,KLEV)
!  PPMB5       PPMB          HALF LEVEL PRESSURE                 (KLON,KLEV+1)
!  PQOF5       PQOF          CONCENTRATION IN OZONE (PA/PA)      (KLON,KLEV)
!  PTAVE5      PTAVE         TEMPERATURE                         (KLON,KLEV)
!  PWV5        PWV           SPECIFIC HUMIDITY PA/PA             (KLON,KLEV)
!  PVIEW      ---            COSECANT OF VIEWING ANGLE           (KLON)

!     ==== OUTPUTS ===
!  Trajectory  Perturbation  Description                         Dimension
!  PABCU5      PABCU         EFFECTIVE ABSORBER AMOUNTS     (KLON,NUA,3*KLEV+1)

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

!     METHOD.
!     -------

!          1. COMPUTES THE PRESSURE AND TEMPERATURE WEIGHTED AMOUNTS OF
!     ABSORBERS.

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

!          NONE

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

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

!     AUTHOR.
!     -------
!        M. Janiskova  *ECMWF*        8-Dec-2006

!     MODIFICATIONS.
!     --------------

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

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

USE YOMCST   , ONLY : RG
USE YOESW    , ONLY : RAER
USE YOELW    , ONLY : NSIL     ,NUA      ,NG1      ,NG1P1    ,&
 & ALWT     ,BLWT     ,RO3T     ,RT1      ,TREF     ,&
 & RVGCO2   ,RVGH2O   ,RVGO3  
USE YOERDI   , ONLY : RCH4     ,RN2O     ,RCFC11   ,RCFC12
USE YOERDU   , ONLY : R10E     ,REPSCO   ,REPSCQ
USE YOPHNC   , ONLY : LH2OCO2

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 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PVIEW(KLON) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PCCO2
REAL(KIND=JPRB)   ,INTENT(IN)    :: PAER5(KLON,6,KLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PDP5(KLON,KLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PPMB5(KLON,KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PQOF5(KLON,KLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PTAVE5(KLON,KLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PWV5(KLON,KLEV) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PABCU5(KLON,NUA,3*KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PAER(KLON,6,KLEV) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PDP(KLON,KLEV) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PPMB(KLON,KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PQOF(KLON,KLEV) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PTAVE(KLON,KLEV) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PWV(KLON,KLEV) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PABCU(KLON,NUA,3*KLEV+1)

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

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

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

!              ------------
REAL(KIND=JPRB) :: ZABLY(KLON,7,3*KLEV+1)  , ZDPM(KLON,3*KLEV)
REAL(KIND=JPRB) :: ZUPM(KLON,3*KLEV)  
REAL(KIND=JPRB) :: ZPHIO(KLON),ZPSC2(KLON) , ZPSC3(KLON), ZPSH1(KLON)
REAL(KIND=JPRB) :: ZPSH2(KLON),ZPSH3(KLON) , ZPSH4(KLON), ZPSH5(KLON)
REAL(KIND=JPRB) :: ZPSH6(KLON),ZPSIO(KLON) , ZTCON(KLON)
REAL(KIND=JPRB) :: ZPHM6(KLON),ZPSM6(KLON) , ZPHN6(KLON), ZPSN6(KLON)  
REAL(KIND=JPRB) :: ZSSIG(KLON,3*KLEV+1)
REAL(KIND=JPRB) :: ZUAER(KLON,NSIL) , ZUAERS(KLON,NSIL)
REAL(KIND=JPRB) :: ZXOZ(KLON) , ZXWV(KLON) , ZTX(KLON), ZTX2(KLON)
REAL(KIND=JPRB) :: ZFPPW(KLON), ZSUM(KLON) , ZDIV(KLON)

REAL(KIND=JPRB) :: ZABLY5(KLON,7,3*KLEV+1)
REAL(KIND=JPRB) :: ZDPM5(KLON,3*KLEV),ZUPM5(KLON,3*KLEV)  
REAL(KIND=JPRB) :: ZDPMP05(KLON,KLEV*NG1P1+NG1+1)
REAL(KIND=JPRB) :: ZUPMH2O5(KLON,KLEV*NG1P1+NG1+1)
REAL(KIND=JPRB) :: ZUPMCO25(KLON,KLEV*NG1P1+NG1+1)
REAL(KIND=JPRB) :: ZUPMO35(KLON,KLEV*NG1P1+NG1+1)
REAL(KIND=JPRB) :: ZUPMG5(KLON,KLEV*NG1P1+NG1+1)
REAL(KIND=JPRB) :: ZU65(KLON,KLEV*NG1P1+NG1+1)
REAL(KIND=JPRB) :: ZDUCM5(KLON,KLEV*NG1P1+NG1+1)

REAL(KIND=JPRB) :: ZPHIO5(KLON,KLEV), ZPSC25(KLON,KLEV)
REAL(KIND=JPRB) :: ZPSC35(KLON,KLEV), ZPSH15(KLON,KLEV)
REAL(KIND=JPRB) :: ZPSH25(KLON,KLEV), ZPSH35(KLON,KLEV)
REAL(KIND=JPRB) :: ZPSH45(KLON,KLEV), ZPSH55(KLON,KLEV)
REAL(KIND=JPRB) :: ZPSH65(KLON,KLEV), ZPSIO5(KLON,KLEV)
REAL(KIND=JPRB) :: ZTCON5(KLON,KLEV)
REAL(KIND=JPRB) :: ZPHM65(KLON,KLEV), ZPSM65(KLON,KLEV)
REAL(KIND=JPRB) :: ZPHN65(KLON,KLEV), ZPSN65(KLON,KLEV)
REAL(KIND=JPRB) :: ZFPPW5(KLON,KLEV), ZXOZ5(KLON,KLEV)
REAL(KIND=JPRB) :: ZDIV5(KLON,KLEV), ZTX5(KLON,KLEV), ZTX25(KLON,KLEV)
REAL(KIND=JPRB) :: ZXWV5(KLON,KLEV)
REAL(KIND=JPRB) :: ZSSIG5(KLON,3*KLEV+1)
REAL(KIND=JPRB) :: ZUAER5(KLON,NSIL,KLEV), ZUAERS5(KLON,NSIL,KLEV)
REAL(KIND=JPRB) :: ZZABLY15(KLON,KLEV), ZZABLY25(KLON,KLEV)
REAL(KIND=JPRB) :: ZCAH15(KLON,KLEV), ZCAH25(KLON,KLEV)
REAL(KIND=JPRB) :: ZCAH35(KLON,KLEV), ZCAH45(KLON,KLEV)
REAL(KIND=JPRB) :: ZCAH55(KLON,KLEV), ZCAH65(KLON,KLEV)
REAL(KIND=JPRB) :: ZCBH15(KLON,KLEV), ZCBH25(KLON,KLEV)
REAL(KIND=JPRB) :: ZCBH35(KLON,KLEV), ZCBH45(KLON,KLEV)
REAL(KIND=JPRB) :: ZCBH55(KLON,KLEV), ZCBH65(KLON,KLEV)
REAL(KIND=JPRB) :: ZUPA5(KLON,KLEV), ZUPB5(KLON,KLEV)
REAL(KIND=JPRB) :: ZUP15(KLON,KLEV), ZUP25(KLON,KLEV)
REAL(KIND=JPRB) :: ZCAC85(KLON,KLEV), ZCBC85(KLON,KLEV)
REAL(KIND=JPRB) :: ZXOZZ5(KLON,KLEV), ZEQ15(KLON,KLEV)
REAL(KIND=JPRB) :: ZDIV15(KLON,KLEV), ZDIV25(KLON,KLEV)
REAL(KIND=JPRB) :: ZDIV35(KLON,KLEV), ZLOG15(KLON,KLEV)
REAL(KIND=JPRB) :: ZSUM5(KLON)

INTEGER(KIND=JPIM) :: IAE1, IAE2, IAE3, IC, ICP1, IG1, IJ, IJPN,&
 & IKIP1, IKJ, IKJP, IKJPN, IKJR, IKL, JA, JAE, &
 & JK, JKI, JKK, JL  

REAL(KIND=JPRB) :: ZALUP, ZCAC8, ZCAH1, ZCAH2, ZCAH3, ZCAH4,&
 & ZCAH5, ZCAH6, ZCBC8, ZCBH1, ZCBH2, ZCBH3, &
 & ZCBH4, ZCBH5, ZCBH6, ZDPMP0,  &
 & ZU6, ZUPMG, ZUP, ZUPMCO2,  &
 & ZUPMH2O, ZUPMO3, ZZABLY  

REAL(KIND=JPRB) :: ZALUP5
REAL(KIND=JPRB) :: ZUP1, ZXOZZ

REAL(KIND=JPRB) :: ZRGI, ZINORMP, ZDUCM, ZIPCCO2, ZDIFFCO2
REAL(KIND=JPRB) :: ZHOOK_HANDLE

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

IF (LHOOK) CALL DR_HOOK('LWUAD',0,ZHOOK_HANDLE)

!*         1.    INITIALIZATION
!                --------------

ZRGI = 0.1_JPRB/RG
ZIPCCO2 = 1.0_JPRB/PCCO2
ZINORMP = 1.0_JPRB/101325._JPRB

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

!*         2.    PRESSURE OVER GAUSS SUB-LEVELS
!                ------------------------------

DO JL = KIDIA,KFDIA
  ZSSIG5(JL, 1 ) = PPMB5(JL,1) * 100._JPRB
ENDDO

DO JK = 1 , KLEV
  IKJ=(JK-1)*NG1P1+1
  IKJR = IKJ
  IKJP = IKJ + NG1P1
  DO JL = KIDIA,KFDIA
    ZSSIG5(JL,IKJP) = PPMB5(JL,JK+1)* 100._JPRB
  ENDDO
  DO IG1=1,NG1
    IKJ=IKJ+1
    DO JL = KIDIA,KFDIA
      ZSSIG5(JL,IKJ) = (ZSSIG5(JL,IKJR) + ZSSIG5(JL,IKJP)) * 0.5_JPRB &
       &  + RT1(IG1) * (ZSSIG5(JL,IKJP) - ZSSIG5(JL,IKJR)) * 0.5_JPRB  
    ENDDO
  ENDDO
ENDDO

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

!*         4.    PRESSURE THICKNESS AND MEAN PRESSURE OF SUB-LAYERS
!                --------------------------------------------------

DO JKI=1,3*KLEV
  IKIP1=JKI+1
  DO JL = KIDIA,KFDIA
    ZUPM5(JL,JKI) = (ZSSIG5(JL,JKI)+ZSSIG5(JL,IKIP1))*0.5_JPRB
    ZDPM5(JL,JKI) = (ZSSIG5(JL,JKI)-ZSSIG5(JL,IKIP1))*ZRGI
  ENDDO
ENDDO

IF (LH2OCO2) THEN
  DO JK = 1 , KLEV
    IKL = KLEV+1 - JK
    DO JL = KIDIA,KFDIA
      IF (PWV5(JL,IKL) > REPSCQ) THEN
        ZXWV5(JL,JK) = PWV5(JL,IKL)
      ELSE
        ZXWV5(JL,JK) = REPSCQ
      ENDIF
    ENDDO
    IKJ=(JK-1)*NG1P1+1
    IKJPN=IKJ+NG1

    DO JKK=IKJ,IKJPN
      DO JL = KIDIA,KFDIA
        ZDPMP05(JL,JKK) = ZDPM5(JL,JKK) * ZINORMP
        ZUPMCO25(JL,JKK) = (ZUPM5(JL,JKK)+RVGCO2)*ZDPMP05(JL,JKK)
        ZUPMH2O5(JL,JKK) = (ZUPM5(JL,JKK)+RVGH2O)*ZDPMP05(JL,JKK)

!      ZFPPW = 1.6078_JPRB * ZXWV(JL) / (1.0_JPRB+0.608_JPRB*ZXWV(JL))
!- H2O
        ZABLY5(JL,1,JKK) = ZXWV5(JL,JK)*ZUPMH2O5(JL,JKK)
!- CO2 (CH4,N2O)
        ZABLY5(JL,3,JKK) = PCCO2*ZUPMCO25(JL,JKK)
      ENDDO
    ENDDO
  ENDDO

ELSE

  DO JK = 1 , KLEV
    IKL = KLEV+1 - JK
    DO JL = KIDIA,KFDIA
      IF (PWV5(JL,IKL) > REPSCQ) THEN
        ZXWV5(JL,JK) = PWV5(JL,IKL)
      ELSE
        ZXWV5(JL,JK) = REPSCQ
      ENDIF

!- H2O continuum
      ZDIV15(JL,JK) = 1.0_JPRB/(1.0_JPRB+0.608_JPRB*ZXWV5(JL,JK))
      ZFPPW5(JL,JK) = 1.6078_JPRB*ZXWV5(JL,JK)*ZDIV15(JL,JK)
!- O3
      ZDIV25(JL,JK) = 1.0_JPRB/PDP5(JL,IKL)
      ZXOZZ5(JL,JK) = PQOF5(JL,IKL)*ZDIV25(JL,JK)
      IF (ZXOZZ5(JL,JK) > REPSCO) THEN
        ZXOZ5(JL,JK) = ZXOZZ5(JL,JK)
      ELSE
        ZXOZ5(JL,JK) = REPSCO
      ENDIF
    ENDDO

    IKJ=(JK-1)*NG1P1+1
    IKJPN=IKJ+NG1
    DO JKK=IKJ,IKJPN
      DO JL = KIDIA,KFDIA
        ZDPMP05(JL,JKK) = ZDPM5(JL,JKK) * ZINORMP
        ZUPMCO25(JL,JKK) = (ZUPM5(JL,JKK)+RVGCO2)*ZDPMP05(JL,JKK)
        ZUPMH2O5(JL,JKK) = (ZUPM5(JL,JKK)+RVGH2O)*ZDPMP05(JL,JKK)

!      ZFPPW = 1.6078_JPRB * ZXWV(JL) / (1.0_JPRB+0.608_JPRB*ZXWV(JL))
!- H2O
        ZABLY5(JL,1,JKK) = ZXWV5(JL,JK)*ZUPMH2O5(JL,JKK)
!- CO2 (CH4,N2O)
        ZABLY5(JL,3,JKK) = PCCO2*ZUPMCO25(JL,JKK)
!- O3
        ZUPMO35(JL,JKK) = (ZUPM5(JL,JKK)+RVGO3)*ZDPMP05(JL,JKK)
        ZABLY5(JL,6,JKK) = ZXOZ5(JL,JK)*ZDPM5(JL,JKK)
        ZABLY5(JL,7,JKK) = ZXOZ5(JL,JK)*ZUPMO35(JL,JKK)
!- H2O continuum
        ZUPMG5(JL,JKK) = ZUPM5(JL,JKK) * ZDPMP05(JL,JKK)
        ZU65(JL,JKK) = ZXWV5(JL,JK)*ZUPMG5(JL,JKK)
        ZABLY5(JL,5,JKK) = ZU65(JL,JKK)*ZFPPW5(JL,JK)
        ZABLY5(JL,4,JKK) = ZU65(JL,JKK)*(1.0_JPRB-ZFPPW5(JL,JK))
        ZABLY5(JL,2,JKK) = PCCO2*ZDPM5(JL,JKK)
      ENDDO
    ENDDO
  ENDDO

ENDIF

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

!*         5.    CUMULATIVE ABSORBER AMOUNTS FROM TOP OF ATMOSPHERE
!                --------------------------------------------------

DO JA = 1, NUA
  DO JL = KIDIA,KFDIA
    PABCU5(JL,JA,3*KLEV+1) = 0.0_JPRB
  ENDDO
ENDDO

DO JK = 1 , KLEV
  IJ=(JK-1)*NG1P1+1
  IJPN=IJ+NG1
  IKL=KLEV+1-JK

!*         5.1  CUMULATIVE AEROSOL AMOUNTS FROM TOP OF ATMOSPHERE
!               --------------------------------------------------
! --            NB: 'PAER' AEROSOLS ARE ENTERED FROM TOP TO BOTTOM

  IAE1=3*KLEV+1-IJ
  IAE2=3*KLEV+1-(IJ+1)
  IAE3=3*KLEV+1-IJPN
  DO JL = KIDIA,KFDIA
    ZSUM5(JL) = ZDPM5(JL,IAE1)+ZDPM5(JL,IAE2)+ZDPM5(JL,IAE3)
    ZDIV5(JL,JK) = 1.0_JPRB/ZSUM5(JL)
  ENDDO

  DO JAE=1,6
    DO JL = KIDIA,KFDIA
      ZUAERS5(JL,JAE,JK) =&
       &  RAER(JAE,1)*PAER5(JL,1,JK)+RAER(JAE,2)*PAER5(JL,2,JK)&
       & +RAER(JAE,3)*PAER5(JL,3,JK)+RAER(JAE,4)*PAER5(JL,4,JK)&
       & +RAER(JAE,5)*PAER5(JL,5,JK)+RAER(JAE,6)*PAER5(JL,6,JK)
      ZUAER5(JL,JAE,JK) = ZUAERS5(JL,JAE,JK)*ZDIV5(JL,JK)
    ENDDO
  ENDDO

!*         5.2  INTRODUCES TEMPERATURE EFFECTS ON ABSORBER AMOUNTS
!               --------------------------------------------------

  DO JL = KIDIA,KFDIA
!    ZFACT(JL)=1.0_JPRB-ZTAVI(JL)/296._JPRB
!    ZTCON(JL)=EXP(6.08*ZFACT(JL))
    ZTX5(JL,JK) = PTAVE5(JL,IKL)-TREF
    ZTX25(JL,JK) = ZTX5(JL,JK)*ZTX5(JL,JK)
    ZZABLY15(JL,JK) = ZABLY5(JL,1,IAE1)+ZABLY5(JL,1,IAE2)+ZABLY5(JL,1,IAE3)
    ZLOG15(JL,JK) = 0.5_JPRB*R10E*LOG(ZZABLY15(JL,JK))+5._JPRB
    IF (ZLOG15(JL,JK) > 0.0_JPRB) THEN
      ZUP15(JL,JK) = ZLOG15(JL,JK)
    ELSE
      ZUP15(JL,JK) = 0.0_JPRB
    ENDIF
    IF (ZUP15(JL,JK) < 6.0_JPRB) THEN
      ZUPA5(JL,JK) = ZUP15(JL,JK)
    ELSE
      ZUPA5(JL,JK) = 6.0_JPRB
    ENDIF

!- H2O
    ZCAH15(JL,JK) = ALWT(1,1)+ZUPA5(JL,JK)*(ALWT(1,2) &
     & + ZUPA5(JL,JK)*ALWT(1,3))
    ZCBH15(JL,JK) = BLWT(1,1)+ZUPA5(JL,JK)*(BLWT(1,2) &
     & + ZUPA5(JL,JK)*BLWT(1,3))
    ZPSH15(JL,JK) = EXP(ZCAH15(JL,JK)*ZTX5(JL,JK) &
     & + ZCBH15(JL,JK)*ZTX25(JL,JK))
    ZCAH25(JL,JK) = ALWT(2,1)+ZUPA5(JL,JK)*(ALWT(2,2) &
     & + ZUPA5(JL,JK)*ALWT(2,3))
    ZCBH25(JL,JK) = BLWT(2,1)+ZUPA5(JL,JK)*(BLWT(2,2) &
     & + ZUPA5(JL,JK)*BLWT(2,3))
    ZPSH25(JL,JK) = EXP(ZCAH25(JL,JK)*ZTX5(JL,JK) &
     & + ZCBH25(JL,JK)*ZTX25(JL,JK))
    ZCAH35(JL,JK) = ALWT(3,1)+ZUPA5(JL,JK)*(ALWT(3,2) &
     & + ZUPA5(JL,JK)*ALWT(3,3))
    ZCBH35(JL,JK) = BLWT(3,1)+ZUPA5(JL,JK)*(BLWT(3,2) &
     & + ZUPA5(JL,JK)*BLWT(3,3))
    ZPSH35(JL,JK) = EXP(ZCAH35(JL,JK)*ZTX5(JL,JK) &
     & + ZCBH35(JL,JK)*ZTX25(JL,JK))
    ZCAH45(JL,JK) = ALWT(4,1)+ZUPA5(JL,JK)*(ALWT(4,2) &
     & + ZUPA5(JL,JK)*ALWT(4,3))
    ZCBH45(JL,JK) = BLWT(4,1)+ZUPA5(JL,JK)*(BLWT(4,2) &
     & + ZUPA5(JL,JK)*BLWT(4,3))
    ZPSH45(JL,JK) = EXP(ZCAH45(JL,JK)*ZTX5(JL,JK) &
     & + ZCBH45(JL,JK)*ZTX25(JL,JK))
    ZCAH55(JL,JK) = ALWT(5,1)+ZUPA5(JL,JK)*(ALWT(5,2) &
     & + ZUPA5(JL,JK)*ALWT(5,3))
    ZCBH55(JL,JK) = BLWT(5,1)+ZUPA5(JL,JK)*(BLWT(5,2) &
     & + ZUPA5(JL,JK)*BLWT(5,3))
    ZPSH55(JL,JK) = EXP(ZCAH55(JL,JK)*ZTX5(JL,JK) &
     & + ZCBH55(JL,JK)*ZTX25(JL,JK))
    ZCAH65(JL,JK) = ALWT(6,1)+ZUPA5(JL,JK)*(ALWT(6,2) &
     & + ZUPA5(JL,JK)*ALWT(6,3))
    ZCBH65(JL,JK) = BLWT(6,1)+ZUPA5(JL,JK)*(BLWT(6,2) &
     & + ZUPA5(JL,JK)*BLWT(6,3))
    ZPSH65(JL,JK) = EXP(ZCAH65(JL,JK)*ZTX5(JL,JK) &
     & + ZCBH65(JL,JK)*ZTX25(JL,JK))

    IF (.NOT.LH2OCO2) THEN
!- CH4
      ZPHM65(JL,JK) = EXP(-5.81E-4_JPRB*ZTX5(JL,JK) &
       & - 1.13E-6_JPRB*ZTX25(JL,JK))
      ZPSM65(JL,JK) = EXP(-5.57E-4_JPRB*ZTX5(JL,JK) &
       & - 3.30E-6_JPRB*ZTX25(JL,JK))
!- N2O
      ZPHN65(JL,JK) = EXP(-3.46E-5_JPRB*ZTX5(JL,JK) &
       & + 2.05E-7_JPRB*ZTX25(JL,JK))
      ZPSN65(JL,JK) = EXP(3.70E-3_JPRB*ZTX5(JL,JK) &
       & - 2.30E-6_JPRB*ZTX25(JL,JK))
    ENDIF
  ENDDO

  DO JL = KIDIA,KFDIA
    ZZABLY25(JL,JK) = ZABLY5(JL,3,IAE1)+ZABLY5(JL,3,IAE2)+ZABLY5(JL,3,IAE3)
    ZALUP5 = R10E * LOG(ZZABLY25(JL,JK))
    ZUP25(JL,JK) = 5.0_JPRB+0.5_JPRB*ZALUP5
    IF (ZUP25(JL,JK) > 0.0_JPRB) THEN
      ZUPB5(JL,JK) = ZUP25(JL,JK)
    ELSE
      ZUPB5(JL,JK) = 0.0_JPRB
    ENDIF
!- CO2
    ZEQ15(JL,JK) = PTAVE5(JL,IKL)/TREF
    ZPSC25(JL,JK) = ZEQ15(JL,JK) ** ZUPB5(JL,JK)
    ZCAC85(JL,JK) = ALWT(8,1)+ZUPB5(JL,JK)*(ALWT(8,2) &
     & + ZUPB5(JL,JK)*ALWT(8,3))
    ZCBC85(JL,JK) = BLWT(8,1)+ZUPB5(JL,JK)*(BLWT(8,2) &
     & + ZUPB5(JL,JK)*BLWT(8,3))
    ZPSC35(JL,JK) = EXP(ZCAC85(JL,JK)*ZTX5(JL,JK) &
     & + ZCBC85(JL,JK)*ZTX25(JL,JK))

    IF (.NOT.LH2OCO2) THEN
!- O3
      ZPHIO5(JL,JK) = EXP( RO3T(1)*ZTX5(JL,JK) + RO3T(2)*ZTX25(JL,JK))
      ZPSIO5(JL,JK) = &
       & EXP(2.0_JPRB*(RO3T(3)*ZTX5(JL,JK)+RO3T(4)*ZTX25(JL,JK)))
    ENDIF
  ENDDO

  DO JKK=IJ,IJPN
    IC=3*KLEV+1-JKK
    ICP1=IC+1
    DO JL = KIDIA,KFDIA
      ZDIFFCO2 = ZIPCCO2*PVIEW(JL)
      ZDUCM5(JL,IC) = ZDPM5(JL,IC)*PVIEW(JL)
!- CO2
      PABCU5(JL,7,IC) = PABCU5(JL,7,ICP1) &
       & + ZABLY5(JL,3,IC)*ZPSC25(JL,JK)*PVIEW(JL)
      PABCU5(JL,8,IC) = PABCU5(JL,8,ICP1) &
       & + ZABLY5(JL,3,IC)*ZPSC35(JL,JK)*PVIEW(JL)
      PABCU5(JL,9,IC) = PABCU5(JL,9,ICP1) &
       & + ZABLY5(JL,3,IC)*ZPSC35(JL,JK)*PVIEW(JL)

!- H2O
      PABCU5(JL,1,IC) = PABCU5(JL,1,ICP1)+ZABLY5(JL,1,IC)*ZPSH15(JL,JK)
      PABCU5(JL,2,IC) = PABCU5(JL,2,ICP1)+ZABLY5(JL,1,IC)*ZPSH25(JL,JK)
      PABCU5(JL,3,IC) = PABCU5(JL,3,ICP1) &
       & + ZABLY5(JL,1,IC)*ZPSH55(JL,JK)*PVIEW(JL)
      PABCU5(JL,4,IC) = PABCU5(JL,4,ICP1)+ZABLY5(JL,1,IC)*ZPSH35(JL,JK)
      PABCU5(JL,5,IC) = PABCU5(JL,5,ICP1)+ZABLY5(JL,1,IC)*ZPSH45(JL,JK)
      PABCU5(JL,6,IC) = PABCU5(JL,6,ICP1) &
       & + ZABLY5(JL,1,IC)*ZPSH65(JL,JK)*PVIEW(JL)

      IF (.NOT.LH2OCO2) THEN
!- H2O continuum
        ZDIV35(JL,JK) = 1.0_JPRB/PTAVE5(JL,IKL)
        ZTCON5(JL,JK) = EXP(6.08_JPRB*(296._JPRB*ZDIV35(JL,JK)-1.0_JPRB))
        PABCU5(JL,10,IC) = PABCU5(JL,10,ICP1)+ZABLY5(JL,4,IC)*PVIEW(JL)
        PABCU5(JL,11,IC) = PABCU5(JL,11,ICP1) &
         & + ZABLY5(JL,5,IC)*ZTCON5(JL,JK)*PVIEW(JL)
!- O3
        PABCU5(JL,12,IC) = PABCU5(JL,12,ICP1) &
         & + ZABLY5(JL,6,IC)*ZPHIO5(JL,JK)*PVIEW(JL)
        PABCU5(JL,13,IC) = PABCU5(JL,13,ICP1) &
         & + ZABLY5(JL,7,IC)*ZPSIO5(JL,JK)*PVIEW(JL)
!- aerosols
        PABCU5(JL,14,IC) = PABCU5(JL,14,ICP1)+ZUAER5(JL,1,JK)*ZDUCM5(JL,IC)
        PABCU5(JL,15,IC) = PABCU5(JL,15,ICP1)+ZUAER5(JL,2,JK)*ZDUCM5(JL,IC)
        PABCU5(JL,16,IC) = PABCU5(JL,16,ICP1)+ZUAER5(JL,3,JK)*ZDUCM5(JL,IC)
        PABCU5(JL,17,IC) = PABCU5(JL,17,ICP1)+ZUAER5(JL,4,JK)*ZDUCM5(JL,IC)
        PABCU5(JL,18,IC) = PABCU5(JL,18,ICP1)+ZUAER5(JL,5,JK)*ZDUCM5(JL,IC)
!- CH4
        PABCU5(JL,19,IC) = PABCU5(JL,19,ICP1)&
         & + ZABLY5(JL,2,IC)*RCH4*ZPHM65(JL,JK)*ZDIFFCO2
        PABCU5(JL,20,IC) = PABCU5(JL,20,ICP1)&
         & + ZABLY5(JL,3,IC)*RCH4*ZPSM65(JL,JK)*ZDIFFCO2
!- N2O
        PABCU5(JL,21,IC) = PABCU5(JL,21,ICP1)&
         & + ZABLY5(JL,2,IC)*RN2O*ZPHN65(JL,JK)*ZDIFFCO2 
        PABCU5(JL,22,IC) = PABCU5(JL,22,ICP1)&
         & + ZABLY5(JL,3,IC)*RN2O*ZPSN65(JL,JK)*ZDIFFCO2
!- CFC11
        PABCU5(JL,23,IC) = PABCU5(JL,23,ICP1)&
         & + ZABLY5(JL,2,IC)*RCFC11*ZDIFFCO2
!- CFC12
        PABCU5(JL,24,IC) = PABCU5(JL,24,ICP1)&
         & + ZABLY5(JL,2,IC)*RCFC12*ZDIFFCO2
      ENDIF

    ENDDO
  ENDDO

ENDDO

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

!*         0.    ADJOINT CALCULATIONS
!                --------------------

!* Set local variables to zero

ZABLY(:,:,:) = 0.0_JPRB
ZDPM(:,:) = 0.0_JPRB
ZUPM(:,:) = 0.0_JPRB
ZSSIG(:,:) = 0.0_JPRB
ZUAER(:,:) = 0.0_JPRB
ZUAERS(:,:) = 0.0_JPRB
ZPHIO(:) = 0.0_JPRB
ZPSC2(:) = 0.0_JPRB
ZPSC3(:) = 0.0_JPRB
ZPSH1(:) = 0.0_JPRB
ZPSH2(:) = 0.0_JPRB
ZPSH3(:) = 0.0_JPRB
ZPSH4(:) = 0.0_JPRB
ZPSH5(:) = 0.0_JPRB
ZPSH6(:) = 0.0_JPRB
ZPSIO(:) = 0.0_JPRB
ZTCON(:) = 0.0_JPRB
ZPHM6(:) = 0.0_JPRB
ZPSM6(:) = 0.0_JPRB
ZPHN6(:) = 0.0_JPRB
ZPSN6(:) = 0.0_JPRB
ZXOZ(:) = 0.0_JPRB
ZXWV(:) = 0.0_JPRB
ZTX(:) = 0.0_JPRB
ZTX2(:) = 0.0_JPRB
ZFPPW(:) = 0.0_JPRB
ZSUM(:) = 0.0_JPRB
ZDIV(:) = 0.0_JPRB

!*         1.5.  CUMULATIVE ABSORBER AMOUNTS FROM TOP OF ATMOSPHERE
!                --------------------------------------------------

DO JK = KLEV, 1 , -1
  IJ=(JK-1)*NG1P1+1
  IJPN=IJ+NG1
  IKL=KLEV+1-JK

  IAE1=3*KLEV+1-IJ
  IAE2=3*KLEV+1-(IJ+1)
  IAE3=3*KLEV+1-IJPN

!*         1.5.2 INTRODUCES TEMPERATURE EFFECTS ON ABSORBER AMOUNTS
!                --------------------------------------------------

  DO JKK=IJPN,IJ,-1
    IC=3*KLEV+1-JKK
    ICP1=IC+1
    DO JL = KIDIA,KFDIA
      ZDUCM  = 0.0_JPRB
      ZDIFFCO2 = ZIPCCO2*PVIEW(JL)

      IF (.NOT.LH2OCO2) THEN
!- CFC12
        ZABLY(JL,2,IC) = ZABLY(JL,2,IC)+RCFC12*ZDIFFCO2*PABCU(JL,24,IC)
        PABCU(JL,24,ICP1) = PABCU(JL,24,ICP1)+PABCU(JL,24,IC)
        PABCU(JL,24,IC) = 0.0_JPRB
!- CFC11
        ZABLY(JL,2,IC) = ZABLY(JL,2,IC)+RCFC11*ZDIFFCO2*PABCU(JL,23,IC)
        PABCU(JL,23,ICP1) = PABCU(JL,23,ICP1)+PABCU(JL,23,IC)
        PABCU(JL,23,IC) = 0.0_JPRB
!- N2O
        ZPSN6(JL) = ZPSN6(JL) &
         & + RN2O*ZDIFFCO2*ZABLY5(JL,3,IC)*PABCU(JL,22,IC)
        ZABLY(JL,3,IC) = ZABLY(JL,3,IC) &
         & + RN2O*ZDIFFCO2*ZPSN65(JL,JK)*PABCU(JL,22,IC)
        PABCU(JL,22,ICP1) = PABCU(JL,22,ICP1)+PABCU(JL,22,IC)
        PABCU(JL,22,IC) = 0.0_JPRB
        ZPHN6(JL) = ZPHN6(JL) &
         & + RN2O*ZDIFFCO2*ZABLY5(JL,2,IC)*PABCU(JL,21,IC)
        ZABLY(JL,2,IC) = ZABLY(JL,2,IC) &
         & + RN2O*ZDIFFCO2*ZPHN65(JL,JK)*PABCU(JL,21,IC)
        PABCU(JL,21,ICP1) = PABCU(JL,21,ICP1)+PABCU(JL,21,IC)
        PABCU(JL,21,IC) = 0.0_JPRB
!- CH4
        ZPSM6(JL) = ZPSM6(JL) &
         & + RCH4*ZDIFFCO2*ZABLY5(JL,3,IC)*PABCU(JL,20,IC)
        ZABLY(JL,3,IC) = ZABLY(JL,3,IC) &
         & + RCH4*ZDIFFCO2*ZPSM65(JL,JK)*PABCU(JL,20,IC)
        PABCU(JL,20,ICP1) = PABCU(JL,20,ICP1)+PABCU(JL,20,IC)
        PABCU(JL,20,IC) = 0.0_JPRB
        ZPHM6(JL) = ZPHM6(JL) &
         & + RCH4*ZDIFFCO2*ZABLY5(JL,2,IC)*PABCU(JL,19,IC)
        ZABLY(JL,2,IC) = ZABLY(JL,2,IC) &
         & + RCH4*ZDIFFCO2*ZPHM65(JL,JK)*PABCU(JL,19,IC)
        PABCU(JL,19,ICP1) = PABCU(JL,19,ICP1)+PABCU(JL,19,IC)
        PABCU(JL,19,IC) = 0.0_JPRB
!- aerosols
        ZDUCM = ZDUCM+ZUAER5(JL,5,JK)*PABCU(JL,18,IC)
        ZUAER(JL,5) = ZUAER(JL,5)+ZDUCM5(JL,IC)*PABCU(JL,18,IC)
        PABCU(JL,18,ICP1) = PABCU(JL,18,ICP1)+PABCU(JL,18,IC)
        PABCU(JL,18,IC) = 0.0_JPRB
        ZDUCM = ZDUCM+ZUAER5(JL,4,JK)*PABCU(JL,17,IC)
        ZUAER(JL,4) = ZUAER(JL,4)+ZDUCM5(JL,IC)*PABCU(JL,17,IC)
        PABCU(JL,17,ICP1) = PABCU(JL,17,ICP1)+PABCU(JL,17,IC)
        PABCU(JL,17,IC) = 0.0_JPRB
        ZDUCM = ZDUCM+ZUAER5(JL,3,JK)*PABCU(JL,16,IC)
        ZUAER(JL,3) = ZUAER(JL,3)+ZDUCM5(JL,IC)*PABCU(JL,16,IC)
        PABCU(JL,16,ICP1) = PABCU (JL,16,ICP1)+PABCU(JL,16,IC)
        PABCU(JL,16,IC) = 0.0_JPRB
        ZDUCM = ZDUCM+ZUAER5(JL,2,JK)*PABCU(JL,15,IC)
        ZUAER(JL,2) = ZUAER(JL,2)+ZDUCM5(JL,IC)*PABCU(JL,15,IC)
        PABCU(JL,15,ICP1) =PABCU(JL,15,ICP1)+PABCU(JL,15,IC)
        PABCU(JL,15,IC) = 0.0_JPRB
        ZDUCM = ZDUCM+ZUAER5(JL,1,JK)*PABCU(JL,14,IC)
        ZUAER(JL,1) = ZUAER(JL,1)+ZDUCM5(JL,IC)*PABCU(JL,14,IC)
        PABCU(JL,14,ICP1) = PABCU(JL,14,ICP1)+PABCU(JL,14,IC)
        PABCU(JL,14,IC) = 0.0_JPRB
!- O3
        ZPSIO(JL) = ZPSIO(JL)+PVIEW(JL)*ZABLY5(JL,7,IC)*PABCU(JL,13,IC)
        ZABLY(JL,7,IC) = ZABLY(JL,7,IC) &
         & + PVIEW(JL)*ZPSIO5(JL,JK)*PABCU(JL,13,IC)
        PABCU(JL,13,ICP1) = PABCU(JL,13,ICP1)+PABCU(JL,13,IC)
        PABCU(JL,13,IC) = 0.0_JPRB
        ZPHIO(JL) = ZPHIO(JL)+PVIEW(JL)*ZABLY5(JL,6,IC)*PABCU(JL,12,IC)
        ZABLY(JL,6,IC) = ZABLY(JL,6,IC) &
         & + PVIEW(JL)*ZPHIO5(JL,JK)*PABCU(JL,12,IC)
        PABCU(JL,12,ICP1) = PABCU(JL,12,ICP1)+PABCU(JL,12,IC)
        PABCU(JL,12,IC) = 0.0_JPRB
!- H2O continuum
        ZTCON(JL) = ZTCON(JL)+PVIEW(JL)*ZABLY5(JL,5,IC)*PABCU(JL,11,IC)
        ZABLY(JL,5,IC) = ZABLY(JL,5,IC) &
         & + PVIEW(JL)*ZTCON5(JL,JK)*PABCU(JL,11,IC)
        PABCU(JL,11,ICP1) = PABCU(JL,11,ICP1)+PABCU(JL,11,IC)
        PABCU(JL,11,IC) = 0.0_JPRB
        ZABLY(JL,4,IC) = ZABLY(JL,4,IC)+PVIEW(JL)*PABCU(JL,10,IC)
        PABCU(JL,10,ICP1) = PABCU(JL,10,ICP1)+PABCU(JL,10,IC)
        PABCU(JL,10,IC) = 0.0_JPRB
        PTAVE(JL,IKL) = PTAVE(JL,IKL)- ZTCON5(JL,JK)*1799.68_JPRB &
         & * ZDIV35(JL,JK)*ZDIV35(JL,JK)*ZTCON(JL)
        ZTCON(JL) = 0.0_JPRB
      ENDIF

!- H2O
      ZPSH6(JL) = ZPSH6(JL)+PVIEW(JL)*ZABLY5(JL,1,IC)*PABCU(JL,6,IC)
      ZABLY(JL,1,IC) = ZABLY(JL,1,IC) &
       & + PVIEW(JL)*ZPSH65(JL,JK)*PABCU(JL,6,IC)
      PABCU(JL,6,ICP1) = PABCU(JL,6,ICP1)+PABCU(JL,6,IC)
      PABCU(JL,6,IC) = 0.0_JPRB
      ZPSH4(JL) = ZPSH4(JL)+ZABLY5(JL,1,IC)*PABCU(JL,5,IC)
      ZABLY(JL,1,IC) = ZABLY(JL,1,IC)+ZPSH45(JL,JK)*PABCU(JL,5,IC)
      PABCU(JL,5,ICP1) = PABCU(JL,5,ICP1)+PABCU(JL,5,IC)
      PABCU(JL,5,IC) = 0.0_JPRB
      ZPSH3(JL) = ZPSH3(JL)+ZABLY5(JL,1,IC)*PABCU(JL,4,IC)
      ZABLY(JL,1,IC) = ZABLY(JL,1,IC)+ZPSH35(JL,JK)*PABCU(JL,4,IC)
      PABCU(JL,4,ICP1) = PABCU(JL,4,ICP1)+PABCU(JL,4,IC)
      PABCU(JL,4,IC) = 0.0_JPRB
      ZPSH5(JL) = ZPSH5(JL)+PVIEW(JL)*ZABLY5(JL,1,IC)*PABCU(JL,3,IC)
      ZABLY(JL,1,IC) = ZABLY(JL,1,IC) &
       & + PVIEW(JL)*ZPSH55(JL,JK)*PABCU(JL,3,IC)
      PABCU(JL,3,ICP1) = PABCU(JL,3,ICP1)+PABCU(JL,3,IC)
      PABCU(JL,3,IC) = 0.0_JPRB
      ZPSH2(JL) = ZPSH2(JL)+ZABLY5(JL,1,IC)*PABCU(JL,2,IC)
      ZABLY(JL,1,IC) = ZABLY(JL,1,IC)+ZPSH25(JL,JK)*PABCU(JL,2,IC)
      PABCU(JL,2,ICP1) = PABCU(JL,2,ICP1)+PABCU(JL,2,IC)
      PABCU(JL,2,IC) = 0.0_JPRB
      ZPSH1(JL) = ZPSH1(JL)+ZABLY5(JL,1,IC)*PABCU(JL,1,IC)
      ZABLY(JL,1,IC) = ZABLY(JL,1,IC)+ZPSH15(JL,JK)*PABCU(JL,1,IC)
      PABCU(JL,1,ICP1) = PABCU(JL,1,ICP1)+PABCU(JL,1,IC)
      PABCU(JL,1,IC) = 0.0_JPRB
!- CO2
      ZPSC3(JL) = ZPSC3(JL)+PVIEW(JL)*ZABLY5(JL,3,IC)*PABCU(JL,9,IC)
      ZABLY(JL,3,IC) = ZABLY(JL,3,IC) &
       & + PVIEW(JL)*ZPSC35(JL,JK)*PABCU(JL,9,IC)
      PABCU(JL,9,ICP1) = PABCU(JL,9,ICP1)+PABCU(JL,9,IC)
      PABCU(JL,9,IC) = 0.0_JPRB
      ZPSC3(JL) = ZPSC3(JL)+PVIEW(JL)*ZABLY5(JL,3,IC)*PABCU(JL,8,IC)
      ZABLY(JL,3,IC) = ZABLY(JL,3,IC) &
       & + PVIEW(JL)*ZPSC35(JL,JK)*PABCU(JL,8,IC)
      PABCU(JL,8,ICP1) = PABCU(JL,8,ICP1)+PABCU(JL,8,IC)
      PABCU(JL,8,IC) = 0.0_JPRB
      ZPSC2(JL) = ZPSC2(JL)+PVIEW(JL)*ZABLY5(JL,3,IC)*PABCU(JL,7,IC)
      ZABLY(JL,3,IC) = ZABLY(JL,3,IC) &
       & + PVIEW(JL)*ZPSC25(JL,JK)*PABCU(JL,7,IC)
      PABCU(JL,7,ICP1) = PABCU(JL,7,ICP1)+PABCU(JL,7,IC)
      PABCU(JL,7,IC) = 0.0_JPRB

      ZDPM(JL,IC) = ZDPM(JL,IC)+PVIEW(JL)*ZDUCM
    ENDDO
  ENDDO

  DO JL = KIDIA,KFDIA
    ZZABLY = 0.0_JPRB
    ZALUP = 0.0_JPRB
    ZUP = 0.0_JPRB
    ZCAC8 = 0.0_JPRB
    ZCBC8 = 0.0_JPRB
    
    IF (.NOT.LH2OCO2) THEN
!- O3
      ZTX(JL) = ZTX(JL)+2.0_JPRB*ZPSIO5(JL,JK)*RO3T(3)*ZPSIO(JL)
      ZTX2(JL) = ZTX2(JL)+2.0_JPRB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_JPRB
    ZCAH1 = 0.0_JPRB
    ZCBH1 = 0.0_JPRB
    ZCAH2 = 0.0_JPRB
    ZCBH2 = 0.0_JPRB
    ZCAH3 = 0.0_JPRB
    ZCBH3 = 0.0_JPRB
    ZCAH4 = 0.0_JPRB
    ZCBH4 = 0.0_JPRB
    ZCAH5 = 0.0_JPRB
    ZCBH5 = 0.0_JPRB
    ZCAH6 = 0.0_JPRB
    ZCBH6 = 0.0_JPRB
    
    IF (.NOT.LH2OCO2) THEN
!- N2O
      ZTX(JL) = ZTX(JL)+3.70E-3_JPRB*ZPSN65(JL,JK)*ZPSN6(JL)
      ZTX2(JL) = ZTX2(JL)-2.30E-6_JPRB*ZPSN65(JL,JK)*ZPSN6(JL)
      ZPSN6(JL) = 0.0_JPRB
      ZTX(JL) = ZTX(JL)-3.46E-5_JPRB*ZPHN65(JL,JK)*ZPHN6(JL)
      ZTX2(JL) = ZTX2(JL)+2.05E-7_JPRB*ZPHN65(JL,JK)*ZPHN6(JL)
      ZPHN6(JL) = 0.0_JPRB
!- CH4
      ZTX(JL) = ZTX(JL)-5.57E-4_JPRB*ZPSM65(JL,JK)*ZPSM6(JL)
      ZTX2(JL) = ZTX2(JL)-3.30E-6_JPRB*ZPSM65(JL,JK)*ZPSM6(JL)
      ZPSM6(JL) = 0.0_JPRB
      ZTX(JL) = ZTX(JL)-5.81E-4_JPRB*ZPHM65(JL,JK)*ZPHM6(JL)
      ZTX2(JL) = ZTX2(JL)-1.13E-6_JPRB*ZPHM65(JL,JK)*ZPHM6(JL)
      ZPHM6(JL) = 0.0_JPRB
    ENDIF

!- H2O
    ZTX(JL) = ZTX(JL)+ZPSH65(JL,JK)*ZCAH65(JL,JK)*ZPSH6(JL)
    ZCAH6 = ZCAH6+ZPSH65(JL,JK)*ZTX5(JL,JK)*ZPSH6(JL)
    ZTX2(JL) = ZTX2(JL)+ZPSH65(JL,JK)*ZCBH65(JL,JK)*ZPSH6(JL)
    ZCBH6 = ZCBH6+ZPSH65(JL,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ZZABLY+0.5_JPRB*R10E*ZUP1/ZZABLY15(JL,JK)
    ENDIF
    ZABLY(JL,1,IAE1) = ZABLY(JL,1,IAE1)+ZZABLY
    ZABLY(JL,1,IAE2) = ZABLY(JL,1,IAE2)+ZZABLY
    ZABLY(JL,1,IAE3) = ZABLY(JL,1,IAE3)+ZZABLY
    ZTX(JL) = ZTX(JL)+2.0_JPRB*ZTX5(JL,JK)*ZTX2(JL)
    ZTX2(JL) = 0.0_JPRB
    PTAVE(JL,IKL) = PTAVE(JL,IKL)+ZTX(JL)
    ZTX(JL) = 0.0_JPRB
  ENDDO

!*         1.5.1  CUMULATIVE AEROSOL AMOUNTS FROM TOP OF ATMOSPHERE
!                 --------------------------------------------------
! --              NB: 'PAER' AEROSOLS ARE ENTERED FROM TOP TO BOTTOM

  DO JAE=1,6
    DO JL = KIDIA,KFDIA
      ZDIV(JL) = ZDIV(JL)+ZUAERS5(JL,JAE,JK)*ZUAER(JL,JAE)
      ZUAERS(JL,JAE) = ZUAERS(JL,JAE)+ZDIV5(JL,JK)*ZUAER(JL,JAE)
      ZUAER(JL,JAE) = 0.0_JPRB
      PAER(JL,1,JK) = PAER(JL,1,JK)+RAER(JAE,1)*ZUAERS(JL,JAE)
      PAER(JL,2,JK) = PAER(JL,2,JK)+RAER(JAE,2)*ZUAERS(JL,JAE)
      PAER(JL,3,JK) = PAER(JL,3,JK)+RAER(JAE,3)*ZUAERS(JL,JAE)
      PAER(JL,4,JK) = PAER(JL,4,JK)+RAER(JAE,4)*ZUAERS(JL,JAE)
      PAER(JL,5,JK) = PAER(JL,5,JK)+RAER(JAE,5)*ZUAERS(JL,JAE)
      PAER(JL,6,JK) = PAER(JL,6,JK)+RAER(JAE,6)*ZUAERS(JL,JAE)
      ZUAERS(JL,JAE) = 0.0_JPRB
    ENDDO
  ENDDO

  DO JL = KIDIA,KFDIA
    ZSUM(JL) = ZSUM(JL)-ZDIV5(JL,JK)*ZDIV5(JL,JK)*ZDIV(JL)
    ZDIV(JL) = 0.0_JPRB
    ZDPM(JL,IAE1) = ZDPM(JL,IAE1)+ZSUM(JL)
    ZDPM(JL,IAE2) = ZDPM(JL,IAE2)+ZSUM(JL)
    ZDPM(JL,IAE3) = ZDPM(JL,IAE3)+ZSUM(JL)
    ZSUM(JL) = 0.0_JPRB
  ENDDO
ENDDO

DO JA = 1, NUA
  DO JL = KIDIA,KFDIA
    PABCU(JL,JA,3*KLEV+1) = 0.0_JPRB
  ENDDO
ENDDO

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

!*         1.4.  PRESSURE THICKNESS AND MEAN PRESSURE OF SUB-LAYERS
!                --------------------------------------------------

IF (LH2OCO2) THEN
  DO JK = KLEV, 1 , -1
    IKL = KLEV+1 - JK

    IKJ=(JK-1)*NG1P1+1
    IKJPN=IKJ+NG1
    DO JKK=IKJPN,IKJ,-1
      DO JL = KIDIA,KFDIA
        ZDPMP0 = 0.0_JPRB
        ZUPMCO2 = 0.0_JPRB
        ZUPMH2O = 0.0_JPRB

!- CO2 (CH4,N2O)
        ZUPMCO2 = ZUPMCO2+PCCO2*ZABLY(JL,3,JKK)
        ZABLY(JL,3,JKK) = 0.0_JPRB
!- H2O
        ZUPMH2O = ZUPMH2O+ZXWV5(JL,JK)*ZABLY(JL,1,JKK)
        ZXWV(JL) = ZXWV(JL)+ZUPMH2O5(JL,JKK)*ZABLY(JL,1,JKK)
        ZABLY(JL,1,JKK) = 0.0_JPRB

        ZDPMP0 = ZDPMP0+(ZUPM5(JL,JKK)+RVGH2O)*ZUPMH2O
        ZUPM(JL,JKK) = ZUPM(JL,JKK)+ZDPMP05(JL,JKK)*ZUPMH2O
        ZDPMP0 = ZDPMP0+(ZUPM5(JL,JKK)+RVGCO2)*ZUPMCO2
        ZUPM(JL,JKK) = ZUPM(JL,JKK)+ZDPMP05(JL,JKK)*ZUPMCO2
        ZDPM(JL,JKK) = ZDPM(JL,JKK)+ZINORMP*ZDPMP0
      ENDDO
    ENDDO

    DO JL = KIDIA,KFDIA
      IF (PWV5(JL,IKL) > REPSCQ) THEN
        PWV(JL,IKL) = PWV(JL,IKL)+ZXWV(JL)
      ENDIF
      ZXWV(JL) = 0.0_JPRB
    ENDDO
  ENDDO

ELSE

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

    IKJ=(JK-1)*NG1P1+1
    IKJPN=IKJ+NG1
    DO JKK=IKJPN,IKJ,-1
      DO JL = KIDIA,KFDIA
        ZDPMP0 = 0.0_JPRB
        ZUPMCO2 = 0.0_JPRB
        ZUPMH2O = 0.0_JPRB
        ZUPMO3 = 0.0_JPRB
        ZUPMG = 0.0_JPRB
        ZU6 = 0.0_JPRB

!- H2O continuum
        ZDPM(JL,JKK) = ZDPM(JL,JKK)+PCCO2*ZABLY(JL,2,JKK)
        ZABLY(JL,2,JKK) = 0.0_JPRB
        ZU6 = ZU6+(1.0_JPRB-ZFPPW5(JL,JK))*ZABLY(JL,4,JKK)
        ZFPPW(JL) = ZFPPW(JL)-ZU65(JL,JKK)*ZABLY(JL,4,JKK)
        ZABLY(JL,4,JKK) = 0.0_JPRB
        ZFPPW(JL) = ZFPPW(JL)+ZU65(JL,JKK)*ZABLY(JL,5,JKK)
        ZU6 = ZU6+ZFPPW5(JL,JK)*ZABLY(JL,5,JKK)
        ZABLY(JL,5,JKK) = 0.0_JPRB
        ZUPMG = ZUPMG+ZXWV5(JL,JK)*ZU6
        ZXWV(JL) = ZXWV(JL)+ZUPMG5(JL,JKK)*ZU6
        ZDPMP0 = ZDPMP0+ZUPM5(JL,JKK)*ZUPMG
        ZUPM(JL,JKK) = ZUPM(JL,JKK)+ZDPMP05(JL,JKK)*ZUPMG
!- O3
        ZUPMO3 = ZUPMO3+ZXOZ5(JL,JK)*ZABLY(JL,7,JKK)
        ZXOZ(JL) = ZXOZ(JL)+ZUPMO35(JL,JKK)*ZABLY(JL,7,JKK)
        ZABLY(JL,7,JKK) = 0.0_JPRB
        ZDPM(JL,JKK) = ZDPM(JL,JKK)+ZXOZ5(JL,JK)*ZABLY(JL,6,JKK)
        ZXOZ(JL) = ZXOZ(JL)+ZDPM5(JL,JKK)*ZABLY(JL,6,JKK)
        ZABLY(JL,6,JKK) = 0.0_JPRB
        ZDPMP0 = ZDPMP0+(ZUPM5(JL,JKK)+RVGO3)*ZUPMO3
        ZUPM(JL,JKK) = ZUPM(JL,JKK)+ZDPMP05(JL,JKK)*ZUPMO3
!- CO2 (CH4,N2O)
        ZUPMCO2 = ZUPMCO2+PCCO2*ZABLY(JL,3,JKK)
        ZABLY(JL,3,JKK) = 0.0_JPRB
!- H2O
        ZUPMH2O = ZUPMH2O+ZXWV5(JL,JK)*ZABLY(JL,1,JKK)
        ZXWV(JL) = ZXWV(JL)+ZUPMH2O5(JL,JKK)*ZABLY(JL,1,JKK)
        ZABLY(JL,1,JKK) = 0.0_JPRB

        ZDPMP0 = ZDPMP0+(ZUPM5(JL,JKK)+RVGH2O)*ZUPMH2O
        ZUPM(JL,JKK) = ZUPM(JL,JKK)+ZDPMP05(JL,JKK)*ZUPMH2O
        ZDPMP0 = ZDPMP0+(ZUPM5(JL,JKK)+RVGCO2)*ZUPMCO2
        ZUPM(JL,JKK) = ZUPM(JL,JKK)+ZDPMP05(JL,JKK)*ZUPMCO2
        ZDPM(JL,JKK) = ZDPM(JL,JKK)+ZINORMP*ZDPMP0
      ENDDO
    ENDDO

    DO JL = KIDIA,KFDIA
      ZXOZZ = 0.0_JPRB
!- O3
      IF (ZXOZZ5(JL,JK) > REPSCO) THEN
        ZXOZZ = ZXOZZ+ZXOZ(JL)
      ENDIF
      ZXOZ(JL) = 0.0_JPRB
      PQOF(JL,IKL) = PQOF(JL,IKL)+ZDIV25(JL,JK)*ZXOZZ
      PDP(JL,IKL) = PDP(JL,IKL) &
       & - PQOF5(JL,IKL)*ZDIV25(JL,JK)*ZDIV25(JL,JK)*ZXOZZ
!- H2O continuum
      ZXWV(JL) = ZXWV(JL) &
      & + 1.6078_JPRB*ZDIV15(JL,JK)*ZDIV15(JL,JK)*ZFPPW(JL)
      ZFPPW(JL) = 0.0_JPRB

      IF (PWV5(JL,IKL) > REPSCQ) THEN
        PWV(JL,IKL) = PWV(JL,IKL)+ZXWV(JL)
      ENDIF
      ZXWV(JL) = 0.0_JPRB
    ENDDO
  ENDDO

ENDIF

DO JKI=3*KLEV,1,-1
  IKIP1=JKI+1
  DO JL = KIDIA,KFDIA
    ZSSIG(JL,JKI) = ZSSIG(JL,JKI)+ZRGI*ZDPM(JL,JKI)
    ZSSIG(JL,IKIP1) = ZSSIG(JL,IKIP1)-ZRGI*ZDPM(JL,JKI)
    ZDPM(JL,JKI) = 0.0_JPRB
    ZSSIG(JL,JKI) = ZSSIG(JL,JKI)+0.5_JPRB*ZUPM(JL,JKI)
    ZSSIG(JL,IKIP1) = ZSSIG(JL,IKIP1)+0.5_JPRB*ZUPM(JL,JKI)
    ZUPM(JL,JKI) = 0.0_JPRB
  ENDDO
ENDDO

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

!*         1.2.  PRESSURE OVER GAUSS SUB-LEVELS
!                ------------------------------

DO JK = KLEV, 1 , -1
  IKJ=(JK-1)*NG1P1+1
  IKJR = IKJ
  IKJP = IKJ + NG1P1

  DO IG1=1,NG1
    IKJ=IKJ+1
    DO JL = KIDIA,KFDIA
      ZSSIG(JL,IKJR) = ZSSIG(JL,IKJR)+0.5_JPRB*ZSSIG(JL,IKJ)
      ZSSIG(JL,IKJP) = ZSSIG(JL,IKJP)+0.5_JPRB*ZSSIG(JL,IKJ)
      ZSSIG(JL,IKJP) = ZSSIG (JL,IKJP)+0.5_JPRB*RT1(IG1)*ZSSIG(JL,IKJ)
      ZSSIG(JL,IKJR) = ZSSIG(JL,IKJR)-0.5_JPRB*RT1(IG1)*ZSSIG(JL,IKJ)
      ZSSIG(JL,IKJ) = 0.0_JPRB
    ENDDO
  ENDDO
  DO JL = KIDIA,KFDIA
    PPMB(JL,JK+1) = PPMB(JL,JK+1)+100._JPRB*ZSSIG(JL,IKJP)
    ZSSIG(JL,IKJP) = 0.0_JPRB
  ENDDO
ENDDO

DO JL = KIDIA,KFDIA
  PPMB(JL,1) = PPMB(JL,1)+100._JPRB*ZSSIG(JL,1)
  ZSSIG(JL,1) = 0.0_JPRB
ENDDO

!      print *,'END OF LWU'

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

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