!******************************************************************************
SUBROUTINE RRTM_TAUMOL14 (KIDIA,KFDIA,KLEV,P_TAU,&
 & P_TAUAERL,P_FAC00,P_FAC01,P_FAC10,P_FAC11,K_JP,K_JT,K_JT1,&
 & P_COLCO2,K_LAYTROP,P_SELFFAC,P_SELFFRAC,K_INDSELF,PFRAC)  

!     BAND 14:  2250-2380 cm-1 (low - CO2; high - CO2)

! Modifications
!        M.Hamrud      01-Oct-2003 CY28 Cleaning

!     D Salmond 1999-07-14 speed-up
!        NEC           25-Oct-2007 Optimisations

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

USE PARRRTM  , ONLY : JPLAY  ,JPBAND ,JPGPT  ,NGS13
USE YOERRTWN , ONLY : NSPA   ,NSPB
USE YOERRTA14, ONLY : ABSA   ,ABSB   ,FRACREFA, FRACREFB,SELFREF

IMPLICIT NONE

!  Output
INTEGER(KIND=JPIM),INTENT(IN)    :: KIDIA
INTEGER(KIND=JPIM),INTENT(IN)    :: KFDIA
INTEGER(KIND=JPIM),INTENT(IN)    :: KLEV 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: P_TAU(KIDIA:KFDIA,JPGPT,JPLAY) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_TAUAERL(KIDIA:KFDIA,JPLAY,JPBAND) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC00(KIDIA:KFDIA,JPLAY) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC01(KIDIA:KFDIA,JPLAY) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC10(KIDIA:KFDIA,JPLAY) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC11(KIDIA:KFDIA,JPLAY) 
INTEGER(KIND=JPIM),INTENT(IN)    :: K_JP(KIDIA:KFDIA,JPLAY) 
INTEGER(KIND=JPIM),INTENT(IN)    :: K_JT(KIDIA:KFDIA,JPLAY) 
INTEGER(KIND=JPIM),INTENT(IN)    :: K_JT1(KIDIA:KFDIA,JPLAY) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_COLCO2(KIDIA:KFDIA,JPLAY) 
INTEGER(KIND=JPIM),INTENT(IN)    :: K_LAYTROP(KIDIA:KFDIA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_SELFFAC(KIDIA:KFDIA,JPLAY) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_SELFFRAC(KIDIA:KFDIA,JPLAY) 
INTEGER(KIND=JPIM),INTENT(IN)    :: K_INDSELF(KIDIA:KFDIA,JPLAY) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PFRAC(KIDIA:KFDIA,JPGPT,JPLAY) 
!- from AER
!- from INTFAC      
!- from INTIND
!- from PROFDATA             
!- from SELF             
!- from SP             
INTEGER(KIND=JPIM) :: IG, IND0, IND1, INDS, JLAY
INTEGER(KIND=JPIM) :: JLON
REAL(KIND=JPRB) :: ZHOOK_HANDLE

!  Input
!#include "yoeratm.h"

!      REAL TAUAER(JPLAY)
!      EQUIVALENCE (TAUAERL(1,14),TAUAER)

!     Compute the optical depth by interpolating in ln(pressure) and 
!     temperature.  Below LAYTROP, the water vapor self-continuum 
!     is interpolated (in temperature) separately.  

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

DO JLAY = 1, KLEV
  DO JLON = KIDIA, KFDIA
    IF (JLAY <= K_LAYTROP(JLON)) THEN
      IND0 = ((K_JP(JLON,JLAY)-1)*5+(K_JT(JLON,JLAY)-1))*NSPA(14) + 1
      IND1 = (K_JP(JLON,JLAY)*5+(K_JT1(JLON,JLAY)-1))*NSPA(14) + 1
      INDS = K_INDSELF(JLON,JLAY)
!-- DS_990714  
!         DO IG = 1, NG14
      IG=1
      P_TAU(JLON,NGS13+IG,JLAY) = P_COLCO2(JLON,JLAY) *&
       & (P_FAC00(JLON,JLAY) * ABSA(IND0  ,IG) +&
       & P_FAC10(JLON,JLAY) * ABSA(IND0+1,IG) +&
       & P_FAC01(JLON,JLAY) * ABSA(IND1  ,IG) +&
       & P_FAC11(JLON,JLAY) * ABSA(IND1+1,IG) +&
       & P_SELFFAC(JLON,JLAY) * (SELFREF(INDS,IG) + &
       & P_SELFFRAC(JLON,JLAY) *&
       & (SELFREF(INDS+1,IG) - SELFREF(INDS,IG))))&
       & + P_TAUAERL(JLON,JLAY,14)  
      PFRAC(JLON,NGS13+IG,JLAY) = FRACREFA(IG)
      IG=2
      P_TAU(JLON,NGS13+IG,JLAY) = P_COLCO2(JLON,JLAY) *&
       & (P_FAC00(JLON,JLAY) * ABSA(IND0  ,IG) +&
       & P_FAC10(JLON,JLAY) * ABSA(IND0+1,IG) +&
       & P_FAC01(JLON,JLAY) * ABSA(IND1  ,IG) +&
       & P_FAC11(JLON,JLAY) * ABSA(IND1+1,IG) +&
       & P_SELFFAC(JLON,JLAY) * (SELFREF(INDS,IG) +&
       & P_SELFFRAC(JLON,JLAY) *&
       & (SELFREF(INDS+1,IG) - SELFREF(INDS,IG))))&
       & + P_TAUAERL(JLON,JLAY,14)  
      PFRAC(JLON,NGS13+IG,JLAY) = FRACREFA(IG)
!         END DO
!-- DS_990714  
    ENDIF

    IF (JLAY > K_LAYTROP(JLON)) THEN
      IND0 = ((K_JP(JLON,JLAY)-13)*5+(K_JT(JLON,JLAY)-1))*NSPB(14) + 1
      IND1 = ((K_JP(JLON,JLAY)-12)*5+(K_JT1(JLON,JLAY)-1))*NSPB(14) + 1
!-- DS_990714  
!         DO IG = 1, NG14
      IG=1
      P_TAU(JLON,NGS13+IG,JLAY) = P_COLCO2(JLON,JLAY) *&
       & (P_FAC00(JLON,JLAY) * ABSB(IND0  ,IG) +&
       & P_FAC10(JLON,JLAY) * ABSB(IND0+1,IG) +&
       & P_FAC01(JLON,JLAY) * ABSB(IND1  ,IG) +&
       & P_FAC11(JLON,JLAY) * ABSB(IND1+1,IG)) &
       & + P_TAUAERL(JLON,JLAY,14)  
      PFRAC(JLON,NGS13+IG,JLAY) = FRACREFB(IG)
      IG=2
      P_TAU(JLON,NGS13+IG,JLAY) = P_COLCO2(JLON,JLAY) *&
       & (P_FAC00(JLON,JLAY) * ABSB(IND0  ,IG) +&
       & P_FAC10(JLON,JLAY) * ABSB(IND0+1,IG) +&
       & P_FAC01(JLON,JLAY) * ABSB(IND1  ,IG) +&
       & P_FAC11(JLON,JLAY) * ABSB(IND1+1,IG)) &
       & + P_TAUAERL(JLON,JLAY,14)  
      PFRAC(JLON,NGS13+IG,JLAY) = FRACREFB(IG)
!         END DO
!-- DS_990714  
    ENDIF
  ENDDO
ENDDO


IF (LHOOK) CALL DR_HOOK('RRTM_TAUMOL14',1,ZHOOK_HANDLE)

END SUBROUTINE RRTM_TAUMOL14
