SUBROUTINE QNEGAD(KPROMA,KIDIA,KFDIA,PQ5,PQ,PQN)

!**** *QNEGAD* - ADJOINT  OF QNEG

!     PURPOSE
!     -------
!          TAKES AWAY ALL THE NEGATIVE VALUES
!          OF THE SPECIFIC HUMIDITY MODEL VARIABLE

!        EXPLICIT ARGUMENTS
!        ------------------

!        KPROMA            - HORIZONTAL DIMENSION.                  (INPUT-C)
!        KIDIA             - INDEX OF START POINT                   (INPUT-C)
!        KFDIA             - INDEX OF END   POINT                   (INPUT-C)
!        PQ (KPROMA)       - SPECIFIC HUMIDITY ON THE LOWER
!                            LEVEL.                         Kg/Kg   (INPUT)
!        PQN(KPROMA)       - POSITIVE SPECIFIC HUMIDITY
!                            ON THE LOWER LEVEL.            Kg/Kg   (OUTPUT)

!     AUTHOR.
!     -------
!        CARLA CARDINALI *ECMWF*

!        ORIGINAL : 92-05-27
!     ------------------------------------------------------------------

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

IMPLICIT NONE

INTEGER(KIND=JPIM),INTENT(IN)    :: KPROMA 
INTEGER(KIND=JPIM),INTENT(IN)    :: KIDIA 
INTEGER(KIND=JPIM),INTENT(IN)    :: KFDIA 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PQ5(KPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PQ(KPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PQN(KPROMA) 
INTEGER(KIND=JPIM) :: JL
REAL(KIND=JPRB) :: ZHOOK_HANDLE

IF (LHOOK) CALL DR_HOOK('QNEGAD',0,ZHOOK_HANDLE)
DO JL=KIDIA,KFDIA
  IF(PQ5(JL) > 0.0_JPRB) THEN
    PQ(JL)=PQ(JL)+PQN(JL)
  ENDIF
ENDDO

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

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

