SUBROUTINE AER_STRRLOG &
  &( KLAT  , KLEV   , &
  &  PACTSO4, PH2SO4, PT  , PCONCM, &
  &  PCONHS4, PRNLOG )

!*** *AER_STRRLOG* - DERIVE TOTAL NUMBER OF AEROSOL PARTICLES

! REDUCE NO (TOTAL NUMBER OF AEROSOL PARTICLES CONCENTRATION) 
! WHEN TOTAL H2SO4 > SATURATION VAPOR PRESSURE OF H2SO4
! IN SHORT, CORRECT FOR THE ASSUMPTION THAT ALL THE H2SO4 
! IS CONDENSED (SEE ROUTINE CALRNLOG) 
!    -----------------------------------------------

!     AUTHOR.
!     -------
!        FROM S.BEKKI's *redlog*
!        JJMorcrette  ECMWF 20080423 rewritten for IFS

! INPUTS
! ------ 
!   PACTSO4: H2SO4 activity
!   PH2SO4 : VMR of total H2SO4
!   PT     : temperature (K)
!   M      : air number density (also called concentration) (molec/cm3)
!   KLAT   : number of latitude bands in the model domain
!   KLEV   : number of altitude bands in the model domain
!   for IFS: perhaps add another dimension for longitude

! OUTPUTS
! -------
!   PCONHS4: fraction of condensed PH2SO4 (PH2SO4c/PH2SO4total)
!   INPUT (total)/OUTPUT (corrected): 
!   PRNLOG : total number of aerosol particles (VMR)

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

IMPLICIT NONE
   
!-----------------------------------------------------------------------

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

INTEGER(KIND=JPIM),INTENT(IN) :: KLAT,KLEV

  
REAL(KIND=JPRB),INTENT(IN) :: PACTSO4(KLAT,KLEV), PH2SO4 (KLAT,KLEV)
REAL(KIND=JPRB),INTENT(IN) :: PT     (KLAT,KLEV), PCONCM (KLAT,KLEV)

REAL(KIND=JPRB),INTENT(OUT) :: PCONHS4 (KLAT,KLEV)
REAL(KIND=JPRB),INTENT(INOUT) :: PRNLOG (KLAT,KLEV)


!*       0.5   LOCAL VARIABLES
!              ---------------

INTEGER(KIND=JPIM) :: JI, JK
REAL(KIND=JPRB)    :: ZRP, ZDND 
      
REAL(KIND=JPRB) :: ZHOOK_HANDLE
!-----------------------------------------------------------------------
IF (LHOOK) CALL DR_HOOK('AER_STRRLOG',0,ZHOOK_HANDLE)

!     Loop on space

DO JI=1,KLAT
  DO JK=1,KLEV
! ACTIVITY COEFFICIENT(SEE GIAUQUE,1951)
! AYERS ET AL (1980)
!                                  (MU-MU0)
    ZRP=-10156.0_JPRB/PT(JI,JK) + 16.259_JPRB-(PACTSO4(JI,JK)*4.184_JPRB) &
      &                       /(8.31441_JPRB*PT(JI,JK))

! DROPLET PH2SO4 PRESSURE IN DYN.CM-2 
!       0.086: corrective factor for the difference between studies
!              scaling up saturation vapor pressure
    ZRP=EXP(ZRP)*1.01325E6_JPRB/0.086_JPRB

! PH2SO4 NUMBER DENSITY NEAR DROPLET
!       R=8.31E7 DYN.CM.MOL-1*K-1
!                               R/AVOGADRO NUMBER=DYN.CM.MOLEC-1*K-1
    ZDND=ZRP*6.02E23_JPRB/(8.31E7_JPRB * PT(JI,JK))

! Conversion from N.D TO VMR
    ZDND=ZDND/PCONCM(JI,JK)
  
    IF(PH2SO4(JI,JK) <= ZDND) THEN 
      PCONHS4(JI,JK)=0.
    ELSE
      IF(PH2SO4(JI,JK) > 0.0) THEN 
        PCONHS4(JI,JK)=1.0_JPRB -ZDND/PH2SO4(JI,JK)
      ELSE
        PCONHS4(JI,JK)=0.
      ENDIF
    ENDIF
    PRNLOG (JI,JK)= PRNLOG (JI,JK) *PCONHS4(JI,JK)
  ENDDO
ENDDO

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