      SUBROUTINE PAMDIAG(XROW,IAIND,ILG,ILEVP1,NTRAC,IL1,IL2,NTRACP, &
                         ILEV,DP,THROW,RHC,PH,CLDT,RMU, &
                         SSLDROW,RESSROW,VESSROW,DSLDROW,REDSROW, &
                         VEDSROW,BCLDROW,REBCROW,VEBCROW,OCLDROW, &
                         REOCROW,VEOCROW,AMLDROW,REAMROW,VEAMROW, &
                         FR1ROW,FR2ROW,SULIFRC,RSUIFRC,VSUIFRC, &
                         F1SUFRC,F2SUFRC,BCLIFRC,RBCIFRC,VBCIFRC, &
                         F1BCFRC,F2BCFRC,OCLIFRC,ROCIFRC,VOCIFRC, &
                         F1OCFRC,F2OCFRC,SDVLROW,SDNUROW,SDMAROW, &
                         SDACROW,SDCOROW,SSSNROW,SMDNROW,SIANROW, &
                         SSSMROW,SMDMROW,SEWMROW,SSUMROW,SOCMROW, &
                         SBCMROW,SIWMROW,TNSSROW,TNMDROW,TNIAROW, &
                         TMSSROW,TMMDROW,TMOCROW,TMBCROW,TMSPROW, &
                         SNSSROW,SNMDROW,SNIAROW,SMSSROW,SMMDROW, &
                         SMOCROW,SMBCROW,SMSPROW,SIWHROW,SEWHROW, &
                         PM25ROW,PM10ROW,DM25ROW,DM10ROW,SAVERAD,IRFRC)
!-----------------------------------------------------------------------
!     PURPOSE:
!     --------
!     PAM DIAGNOSTIC CALCULATIONS.
!
!     HISTORY:
!     --------
!     * AUG 18/2014 - K.VONSALZEN   NEW, BASED ON PAMDRIV,
!     *                             SEPARATION OF DIAGNOSTIC CALCULATIONS
!     *                             FROM REST OF PAM
!-----------------------------------------------------------------------
!
      USE SDPARM
      USE COMPAR
!
      IMPLICIT REAL (A-H,O-Z),INTEGER (I-N)
!
!-----------------------------------------------------------------------
!     * INPUT VARIABLES.
!
      INTEGER, INTENT(IN), DIMENSION(NTRACP) :: IAIND
      REAL, INTENT(IN), DIMENSION(ILG,ILEVP1,NTRAC) :: XROW
      REAL, INTENT(IN), DIMENSION(ILG,ILEVP1) :: THROW
      REAL, INTENT(IN), DIMENSION(ILG,ILEV) :: DP,RHC,PH
      REAL, INTENT(IN), DIMENSION(ILG) :: CLDT,RMU
      REAL, INTENT(IN) :: SAVERAD
!
!     * OUTPUT VARIABLES.
!
      REAL, INTENT(OUT), DIMENSION(ILG,ILEV) :: SSLDROW,VESSROW,RESSROW, &
                                                DSLDROW,VEDSROW,REDSROW, &
                                                BCLDROW,VEBCROW,REBCROW, &
                                                OCLDROW,REOCROW,VEOCROW, &
                                                AMLDROW,VEAMROW,REAMROW, &
                                                FR1ROW,FR2ROW
      REAL, INTENT(OUT), DIMENSION(ILG,ILEV) :: SULIFRC,RSUIFRC,VSUIFRC, &
                                                F1SUFRC,F2SUFRC,BCLIFRC, &
                                                RBCIFRC,VBCIFRC,F1BCFRC, &
                                                F2BCFRC,OCLIFRC,ROCIFRC, &
                                                VOCIFRC,F1OCFRC,F2OCFRC
      REAL, INTENT(OUT), DIMENSION(ILG,ISDIAG) :: SDVLROW
      REAL, INTENT(OUT), DIMENSION(ILG,ISDNUM) :: &
                                       SNSSROW,SNMDROW,SNIAROW,SMSSROW, &
                                       SMMDROW,SMOCROW,SMBCROW,SMSPROW, &
                                       SIWHROW,SEWHROW
      REAL, INTENT(OUT), DIMENSION(ILG,ILEV,ISDNUM) :: &
                                       SDNUROW,SDMAROW,SDACROW,SDCOROW, &
                                       SSSNROW,SMDNROW,SIANROW,SSSMROW, &
                                       SMDMROW,SEWMROW,SSUMROW,SOCMROW, &
                                       SBCMROW,SIWMROW
      REAL, INTENT(OUT), DIMENSION(ILG) :: &
                                       TNSSROW,TNMDROW,TNIAROW,TMSSROW, &
                                       TMMDROW,TMOCROW,TMBCROW,TMSPROW
      REAL, INTENT(OUT), DIMENSION(ILG,ILEV) :: PM25ROW,PM10ROW,DM25ROW, &
                                                DM10ROW
!
!     * DIAGNOSTIC INPUT VARIABLES.
!
      REAL, ALLOCATABLE, DIMENSION(:,:,:) :: TRAC
      REAL, ALLOCATABLE, DIMENSION(:,:) :: DPA,TA,RHA,PHA
      REAL, ALLOCATABLE, DIMENSION(:) :: CLDA,RMUA
!
!     * DIAGNOSTIC OUTPUT VARIABLES.
!
      REAL, ALLOCATABLE, DIMENSION(:,:) :: SSLD,RESS,VESS,MDLD, &
                                           REMD,VEMD,BCLD,REBC,VEBC, &
                                           OCLD,REOC,VEOC,AMLD,REAM, &
                                           VEAM,FR1,FR2
      REAL, ALLOCATABLE, DIMENSION(:,:) :: SO4LDI,RESO4I,VESO4I,FR1SO4I, &
                                           FR2SO4I,BCLDI,REBCI,VEBCI, &
                                           FR1BCI,FR2BCI,OCLDI,REOCI, &
                                           VEOCI,FR1OCI,FR2OCI
      REAL, ALLOCATABLE, DIMENSION(:,:) :: SDVL
      REAL, ALLOCATABLE, DIMENSION(:) ::   TNSS,TNMD,TNIA,TMSS, &
                                           TMMD,TMOC,TMBC,TMSP
      REAL, ALLOCATABLE, DIMENSION(:,:) :: SNSS,SNMD,SNIA,SMSS, &
                                           SMMD,SMOC,SMBC,SMSP, &
                                           SIWH,SEWH
      REAL, ALLOCATABLE, DIMENSION(:,:,:) :: &
                                           SDNU,SDMA,SDAC,SDCO, &
                                           SSSN,SMDN,SIAN,SSSM, &
                                           SMDM,SEWM,SSUM,SOCM, &
                                           SBCM,SIWM
      REAL, ALLOCATABLE, DIMENSION(:,:) :: PM2P5,PM10,PM2P5D,PM10D
!
!-----------------------------------------------------------------------
!     * CALCULATIONS FOR FULL VERTICAL DOMAIN.
!
      LEVA=ILEV
      IF ( LEVA > ILEV ) CALL XIT('PAMDIAG',-1)
      ILGA=IL2-IL1+1
!
!     * ALLOCATE MEMORY.
!
      ALLOCATE(TRAC(ILGA,LEVA,NTRACT))
      ALLOCATE(TA  (ILGA,LEVA))
      ALLOCATE(RHA (ILGA,LEVA))
      ALLOCATE(DPA (ILGA,LEVA))
      ALLOCATE(PHA (ILGA,LEVA))
      ALLOCATE(SSLD(ILGA,LEVA))
      ALLOCATE(RESS(ILGA,LEVA))
      ALLOCATE(VESS(ILGA,LEVA))
      ALLOCATE(MDLD(ILGA,LEVA))
      ALLOCATE(REMD(ILGA,LEVA))
      ALLOCATE(VEMD(ILGA,LEVA))
      ALLOCATE(BCLD(ILGA,LEVA))
      ALLOCATE(REBC(ILGA,LEVA))
      ALLOCATE(VEBC(ILGA,LEVA))
      ALLOCATE(OCLD(ILGA,LEVA))
      ALLOCATE(REOC(ILGA,LEVA))
      ALLOCATE(VEOC(ILGA,LEVA))
      ALLOCATE(AMLD(ILGA,LEVA))
      ALLOCATE(REAM(ILGA,LEVA))
      ALLOCATE(VEAM(ILGA,LEVA))
      ALLOCATE(FR1 (ILGA,LEVA))
      ALLOCATE(FR2 (ILGA,LEVA))
      ALLOCATE(SO4LDI(ILGA,LEVA))
      ALLOCATE(RESO4I(ILGA,LEVA))
      ALLOCATE(VESO4I(ILGA,LEVA))
      ALLOCATE(FR1SO4I(ILGA,LEVA))
      ALLOCATE(FR2SO4I(ILGA,LEVA))
      ALLOCATE(BCLDI(ILGA,LEVA))
      ALLOCATE(REBCI(ILGA,LEVA))
      ALLOCATE(VEBCI(ILGA,LEVA))
      ALLOCATE(FR1BCI(ILGA,LEVA))
      ALLOCATE(FR2BCI(ILGA,LEVA))
      ALLOCATE(OCLDI(ILGA,LEVA))
      ALLOCATE(REOCI(ILGA,LEVA))
      ALLOCATE(VEOCI(ILGA,LEVA))
      ALLOCATE(FR1OCI(ILGA,LEVA))
      ALLOCATE(FR2OCI(ILGA,LEVA))
      ALLOCATE(SDVL(ILGA,ISDIAG))
      ALLOCATE(TNSS(ILGA))
      ALLOCATE(TNMD(ILGA))
      ALLOCATE(TNIA(ILGA))
      ALLOCATE(TMSS(ILGA))
      ALLOCATE(TMMD(ILGA))
      ALLOCATE(TMOC(ILGA))
      ALLOCATE(TMBC(ILGA))
      ALLOCATE(TMSP(ILGA))
      ALLOCATE(PM2P5(ILGA,LEVA))
      ALLOCATE(PM10(ILGA,LEVA))
      ALLOCATE(PM2P5D(ILGA,LEVA))
      ALLOCATE(PM10D(ILGA,LEVA))
      ALLOCATE(SNSS(ILGA,ISDNUM))
      ALLOCATE(SNMD(ILGA,ISDNUM))
      ALLOCATE(SNIA(ILGA,ISDNUM))
      ALLOCATE(SMSS(ILGA,ISDNUM))
      ALLOCATE(SMMD(ILGA,ISDNUM))
      ALLOCATE(SMOC(ILGA,ISDNUM))
      ALLOCATE(SMBC(ILGA,ISDNUM))
      ALLOCATE(SMSP(ILGA,ISDNUM))
      ALLOCATE(SIWH(ILGA,ISDNUM))
      ALLOCATE(SEWH(ILGA,ISDNUM))
      ALLOCATE(SDNU(ILGA,LEVA,ISDNUM))
      ALLOCATE(SDMA(ILGA,LEVA,ISDNUM))
      ALLOCATE(SDAC(ILGA,LEVA,ISDNUM))
      ALLOCATE(SDCO(ILGA,LEVA,ISDNUM))
      ALLOCATE(SSSN(ILGA,LEVA,ISDNUM))
      ALLOCATE(SMDN(ILGA,LEVA,ISDNUM))
      ALLOCATE(SIAN(ILGA,LEVA,ISDNUM))
      ALLOCATE(SSSM(ILGA,LEVA,ISDNUM))
      ALLOCATE(SMDM(ILGA,LEVA,ISDNUM))
      ALLOCATE(SEWM(ILGA,LEVA,ISDNUM))
      ALLOCATE(SSUM(ILGA,LEVA,ISDNUM))
      ALLOCATE(SOCM(ILGA,LEVA,ISDNUM))
      ALLOCATE(SBCM(ILGA,LEVA,ISDNUM))
      ALLOCATE(SIWM(ILGA,LEVA,ISDNUM))
      ALLOCATE(CLDA(ILGA))
      ALLOCATE(RMUA(ILGA))
!
!     * COPY AEROSOL TRACER FIELDS.
!
      MSGP2A=ILEVP1-LEVA+1
      MSGP1A=ILEV  -LEVA+1
      DO NS=1,NTRACS
        N=IAIND(NS)
        TRAC (1:ILGA,1:LEVA,NS)=XROW(IL1:IL2,MSGP2A:ILEVP1,N)
      ENDDO
!
!     * TEMPERATURE AND RELATIVE HUMIDITY.
!
      TA  =THROW(IL1:IL2,MSGP2A:ILEVP1)
      RHA =RHC  (IL1:IL2,MSGP1A:ILEV)
      DPA =DP   (IL1:IL2,MSGP1A:ILEV)
      PHA =PH   (IL1:IL2,MSGP1A:ILEV)
      CLDA=CLDT (IL1:IL2)
      RMUA=RMU  (IL1:IL2)
!
!     * DIAGNOSIS OF RADIATION AND OTHER PARAMETERS BASED
!     * ON SIZE DISTRIBUTIONS PREDICTED BY PAM.
!
      CALL PAMD(TRAC,TA,RHA,PHA,SSLD,RESS,VESS,MDLD,REMD,VEMD, &
                BCLD,REBC,VEBC,OCLD,REOC,VEOC,AMLD,REAM,VEAM, &
                FR1,FR2,SO4LDI,RESO4I,VESO4I,FR1SO4I,FR2SO4I, &
                BCLDI,REBCI,VEBCI,FR1BCI,FR2BCI,OCLDI, &
                REOCI,VEOCI,FR1OCI,FR2OCI,PM2P5,PM10,PM2P5D,PM10D, &
                DPA,CLDA,RMUA,TNSS,TNMD,TNIA,TMSS,TMMD,TMOC, &
                TMBC,TMSP,SNSS,SNMD,SNIA,SMSS,SMMD,SMOC,SMBC, &
                SMSP,SIWH,SEWH,SDNU,SDMA,SDAC,SDCO,SSSN,SMDN, &
                SIAN,SSSM,SMDM,SEWM,SSUM,SOCM,SBCM,SIWM,SDVL, &
                LEVA,ILGA,IRFRC)
!
!     * RESULTS THAT ARE USED FOR CALCULATIONS OF RADIATION
!     * IN THE DRIVING MODEL.
!
      SSLDROW(IL1:IL2,MSGP1A:ILEV)=SSLD
      RESSROW(IL1:IL2,MSGP1A:ILEV)=RESS*1.E+06
      VESSROW(IL1:IL2,MSGP1A:ILEV)=VESS
      DSLDROW(IL1:IL2,MSGP1A:ILEV)=MDLD
      REDSROW(IL1:IL2,MSGP1A:ILEV)=REMD*1.E+06
      VEDSROW(IL1:IL2,MSGP1A:ILEV)=VEMD
      BCLDROW(IL1:IL2,MSGP1A:ILEV)=BCLD
      REBCROW(IL1:IL2,MSGP1A:ILEV)=REBC*1.E+06
      VEBCROW(IL1:IL2,MSGP1A:ILEV)=VEBC
      OCLDROW(IL1:IL2,MSGP1A:ILEV)=OCLD
      REOCROW(IL1:IL2,MSGP1A:ILEV)=REOC*1.E+06
      VEOCROW(IL1:IL2,MSGP1A:ILEV)=VEOC
      AMLDROW(IL1:IL2,MSGP1A:ILEV)=AMLD
      REAMROW(IL1:IL2,MSGP1A:ILEV)=REAM*1.E+06
      VEAMROW(IL1:IL2,MSGP1A:ILEV)=VEAM
      FR1ROW (IL1:IL2,MSGP1A:ILEV)=FR1
      FR2ROW (IL1:IL2,MSGP1A:ILEV)=FR2
!
!     * RESULTS THAT ARE USED FOR DIAGNOSIS OF RADIATIVE FORCINGS.
!
      SULIFRC(IL1:IL2,MSGP1A:ILEV)=SO4LDI
      RSUIFRC(IL1:IL2,MSGP1A:ILEV)=RESO4I*1.E+06
      VSUIFRC(IL1:IL2,MSGP1A:ILEV)=VESO4I
      F1SUFRC(IL1:IL2,MSGP1A:ILEV)=FR1SO4I
      F2SUFRC(IL1:IL2,MSGP1A:ILEV)=FR2SO4I
      BCLIFRC(IL1:IL2,MSGP1A:ILEV)=BCLDI
      RBCIFRC(IL1:IL2,MSGP1A:ILEV)=REBCI*1.E+06
      VBCIFRC(IL1:IL2,MSGP1A:ILEV)=VEBCI
      F1BCFRC(IL1:IL2,MSGP1A:ILEV)=FR1BCI
      F2BCFRC(IL1:IL2,MSGP1A:ILEV)=FR2BCI
      OCLIFRC(IL1:IL2,MSGP1A:ILEV)=OCLDI
      ROCIFRC(IL1:IL2,MSGP1A:ILEV)=REOCI*1.E+06
      VOCIFRC(IL1:IL2,MSGP1A:ILEV)=VEOCI
      F1OCFRC(IL1:IL2,MSGP1A:ILEV)=FR1OCI
      F2OCFRC(IL1:IL2,MSGP1A:ILEV)=FR2OCI
!
!     * EXTRA DIAGNOSTIC OUTPUT.
!
      IF ( KXTRA1 ) THEN
        PM25ROW(IL1:IL2,MSGP1A:ILEV)=PM25ROW(IL1:IL2,MSGP1A:ILEV) &
                                    +PM2P5*SAVERAD
        PM10ROW(IL1:IL2,MSGP1A:ILEV)=PM10ROW(IL1:IL2,MSGP1A:ILEV) &
                                    +PM10*SAVERAD
        DM25ROW(IL1:IL2,MSGP1A:ILEV)=DM25ROW(IL1:IL2,MSGP1A:ILEV) &
                                    +PM2P5D*SAVERAD
        DM10ROW(IL1:IL2,MSGP1A:ILEV)=DM10ROW(IL1:IL2,MSGP1A:ILEV) &
                                    +PM10D*SAVERAD
      ENDIF
      IF ( KXTRA2 ) THEN
        SDVLROW(IL1:IL2,:)=SDVL(:,:)
        IF ( ISDNUM > 1 ) THEN
          SNSSROW(IL1:IL2,:)=SNSSROW(IL1:IL2,:)+SNSS*SAVERAD
          SNMDROW(IL1:IL2,:)=SNMDROW(IL1:IL2,:)+SNMD*SAVERAD
          SNIAROW(IL1:IL2,:)=SNIAROW(IL1:IL2,:)+SNIA*SAVERAD
          SMSSROW(IL1:IL2,:)=SMSSROW(IL1:IL2,:)+SMSS*SAVERAD
          SMMDROW(IL1:IL2,:)=SMMDROW(IL1:IL2,:)+SMMD*SAVERAD
          SMOCROW(IL1:IL2,:)=SMOCROW(IL1:IL2,:)+SMOC*SAVERAD
          SMBCROW(IL1:IL2,:)=SMBCROW(IL1:IL2,:)+SMBC*SAVERAD
          SMSPROW(IL1:IL2,:)=SMSPROW(IL1:IL2,:)+SMSP*SAVERAD
          SIWHROW(IL1:IL2,:)=SIWHROW(IL1:IL2,:)+SIWH*SAVERAD
          SEWHROW(IL1:IL2,:)=SEWHROW(IL1:IL2,:)+SEWH*SAVERAD
          SDNUROW(IL1:IL2,MSGP1A:ILEV,:)=SDNUROW(IL1:IL2,MSGP1A:ILEV,:) &
                                        +SDNU*SAVERAD
          SDMAROW(IL1:IL2,MSGP1A:ILEV,:)=SDMAROW(IL1:IL2,MSGP1A:ILEV,:) &
                                        +SDMA*SAVERAD
          SDACROW(IL1:IL2,MSGP1A:ILEV,:)=SDACROW(IL1:IL2,MSGP1A:ILEV,:) &
                                        +SDAC*SAVERAD
          SDCOROW(IL1:IL2,MSGP1A:ILEV,:)=SDCOROW(IL1:IL2,MSGP1A:ILEV,:) &
                                        +SDCO*SAVERAD
          SSSNROW(IL1:IL2,MSGP1A:ILEV,:)=SSSNROW(IL1:IL2,MSGP1A:ILEV,:) &
                                        +SSSN*SAVERAD
          SMDNROW(IL1:IL2,MSGP1A:ILEV,:)=SMDNROW(IL1:IL2,MSGP1A:ILEV,:) &
                                        +SMDN*SAVERAD
          SIANROW(IL1:IL2,MSGP1A:ILEV,:)=SIANROW(IL1:IL2,MSGP1A:ILEV,:) &
                                        +SIAN*SAVERAD
          SSSMROW(IL1:IL2,MSGP1A:ILEV,:)=SSSMROW(IL1:IL2,MSGP1A:ILEV,:) &
                                        +SSSM*SAVERAD
          SMDMROW(IL1:IL2,MSGP1A:ILEV,:)=SMDMROW(IL1:IL2,MSGP1A:ILEV,:) &
                                        +SMDM*SAVERAD
          SEWMROW(IL1:IL2,MSGP1A:ILEV,:)=SEWMROW(IL1:IL2,MSGP1A:ILEV,:) &
                                        +SEWM*SAVERAD
          SSUMROW(IL1:IL2,MSGP1A:ILEV,:)=SSUMROW(IL1:IL2,MSGP1A:ILEV,:) &
                                        +SSUM*SAVERAD
          SOCMROW(IL1:IL2,MSGP1A:ILEV,:)=SOCMROW(IL1:IL2,MSGP1A:ILEV,:) &
                                        +SOCM*SAVERAD
          SBCMROW(IL1:IL2,MSGP1A:ILEV,:)=SBCMROW(IL1:IL2,MSGP1A:ILEV,:) &
                                        +SBCM*SAVERAD
          SIWMROW(IL1:IL2,MSGP1A:ILEV,:)=SIWMROW(IL1:IL2,MSGP1A:ILEV,:) &
                                        +SIWM*SAVERAD
          TNSSROW(IL1:IL2)=TNSSROW(IL1:IL2)+TNSS*SAVERAD
          TNMDROW(IL1:IL2)=TNMDROW(IL1:IL2)+TNMD*SAVERAD
          TNIAROW(IL1:IL2)=TNIAROW(IL1:IL2)+TNIA*SAVERAD
          TMSSROW(IL1:IL2)=TMSSROW(IL1:IL2)+TMSS*SAVERAD
          TMMDROW(IL1:IL2)=TMMDROW(IL1:IL2)+TMMD*SAVERAD
          TMOCROW(IL1:IL2)=TMOCROW(IL1:IL2)+TMOC*SAVERAD
          TMBCROW(IL1:IL2)=TMBCROW(IL1:IL2)+TMBC*SAVERAD
          TMSPROW(IL1:IL2)=TMSPROW(IL1:IL2)+TMSP*SAVERAD
        ENDIF
      ENDIF
!
!     * THE SAME FIELDS AS IN THE PREVIOUS SECTION BUT FOR THE
!     * REGION THAT IS OUTSIDE OF THE PAM DOMAIN.
!
      IF ( LEVA < ILEV ) THEN
        SSLDROW(IL1:IL2,1:MSGP1A-1)=0.
        RESSROW(IL1:IL2,1:MSGP1A-1)=0.
        VESSROW(IL1:IL2,1:MSGP1A-1)=0.
        DSLDROW(IL1:IL2,1:MSGP1A-1)=0.
        REDSROW(IL1:IL2,1:MSGP1A-1)=0.
        VEDSROW(IL1:IL2,1:MSGP1A-1)=0.
        BCLDROW(IL1:IL2,1:MSGP1A-1)=0.
        REBCROW(IL1:IL2,1:MSGP1A-1)=0.
        VEBCROW(IL1:IL2,1:MSGP1A-1)=0.
        OCLDROW(IL1:IL2,1:MSGP1A-1)=0.
        REOCROW(IL1:IL2,1:MSGP1A-1)=0.
        VEOCROW(IL1:IL2,1:MSGP1A-1)=0.
        AMLDROW(IL1:IL2,1:MSGP1A-1)=0.
        REAMROW(IL1:IL2,1:MSGP1A-1)=0.
        VEAMROW(IL1:IL2,1:MSGP1A-1)=0.
        FR1ROW (IL1:IL2,1:MSGP1A-1)=0.
        FR2ROW (IL1:IL2,1:MSGP1A-1)=0.
        SULIFRC(IL1:IL2,1:MSGP1A-1)=0.
        RSUIFRC(IL1:IL2,1:MSGP1A-1)=0.
        VSUIFRC(IL1:IL2,1:MSGP1A-1)=0.
        F1SUFRC(IL1:IL2,1:MSGP1A-1)=0.
        F2SUFRC(IL1:IL2,1:MSGP1A-1)=0.
        BCLIFRC(IL1:IL2,1:MSGP1A-1)=0.
        RBCIFRC(IL1:IL2,1:MSGP1A-1)=0.
        VBCIFRC(IL1:IL2,1:MSGP1A-1)=0.
        F1BCFRC(IL1:IL2,1:MSGP1A-1)=0.
        F2BCFRC(IL1:IL2,1:MSGP1A-1)=0.
        OCLIFRC(IL1:IL2,1:MSGP1A-1)=0.
        ROCIFRC(IL1:IL2,1:MSGP1A-1)=0.
        VOCIFRC(IL1:IL2,1:MSGP1A-1)=0.
        F1OCFRC(IL1:IL2,1:MSGP1A-1)=0.
        F2OCFRC(IL1:IL2,1:MSGP1A-1)=0.
        SDNUROW(IL1:IL2,1:MSGP1A-1,:)=0.
        SDMAROW(IL1:IL2,1:MSGP1A-1,:)=0.
        SDACROW(IL1:IL2,1:MSGP1A-1,:)=0.
        SDCOROW(IL1:IL2,1:MSGP1A-1,:)=0.
        SSSNROW(IL1:IL2,1:MSGP1A-1,:)=0.
        SMDNROW(IL1:IL2,1:MSGP1A-1,:)=0.
        SIANROW(IL1:IL2,1:MSGP1A-1,:)=0.
        SSSMROW(IL1:IL2,1:MSGP1A-1,:)=0.
        SMDMROW(IL1:IL2,1:MSGP1A-1,:)=0.
        SEWMROW(IL1:IL2,1:MSGP1A-1,:)=0.
        SSUMROW(IL1:IL2,1:MSGP1A-1,:)=0.
        SOCMROW(IL1:IL2,1:MSGP1A-1,:)=0.
        SBCMROW(IL1:IL2,1:MSGP1A-1,:)=0.
        SIWMROW(IL1:IL2,1:MSGP1A-1,:)=0.
        PM25ROW(IL1:IL2,1:MSGP1A-1)=0.
        PM10ROW(IL1:IL2,1:MSGP1A-1)=0.
        DM25ROW(IL1:IL2,1:MSGP1A-1)=0.
        DM10ROW(IL1:IL2,1:MSGP1A-1)=0.
      ENDIF
!
!-----------------------------------------------------------------------
!     * DEALLOCATE MEMORY.
!
      DEALLOCATE(TRAC)
      DEALLOCATE(TA  )
      DEALLOCATE(RHA )
      DEALLOCATE(DPA )
      DEALLOCATE(PHA )
      DEALLOCATE(SSLD)
      DEALLOCATE(RESS)
      DEALLOCATE(VESS)
      DEALLOCATE(MDLD)
      DEALLOCATE(REMD)
      DEALLOCATE(VEMD)
      DEALLOCATE(BCLD)
      DEALLOCATE(REBC)
      DEALLOCATE(VEBC)
      DEALLOCATE(OCLD)
      DEALLOCATE(REOC)
      DEALLOCATE(VEOC)
      DEALLOCATE(AMLD)
      DEALLOCATE(REAM)
      DEALLOCATE(VEAM)
      DEALLOCATE(FR1 )
      DEALLOCATE(FR2 )
      DEALLOCATE(SO4LDI)
      DEALLOCATE(RESO4I)
      DEALLOCATE(VESO4I)
      DEALLOCATE(FR1SO4I)
      DEALLOCATE(FR2SO4I)
      DEALLOCATE(BCLDI)
      DEALLOCATE(REBCI)
      DEALLOCATE(VEBCI)
      DEALLOCATE(FR1BCI)
      DEALLOCATE(FR2BCI)
      DEALLOCATE(OCLDI)
      DEALLOCATE(REOCI)
      DEALLOCATE(VEOCI)
      DEALLOCATE(FR1OCI)
      DEALLOCATE(FR2OCI)
      DEALLOCATE(SDVL)
      DEALLOCATE(TNSS)
      DEALLOCATE(TNMD)
      DEALLOCATE(TNIA)
      DEALLOCATE(TMSS)
      DEALLOCATE(TMMD)
      DEALLOCATE(TMOC)
      DEALLOCATE(TMBC)
      DEALLOCATE(TMSP)
      DEALLOCATE(PM2P5)
      DEALLOCATE(PM10)
      DEALLOCATE(PM2P5D)
      DEALLOCATE(PM10D)
      DEALLOCATE(SNSS)
      DEALLOCATE(SNMD)
      DEALLOCATE(SNIA)
      DEALLOCATE(SMSS)
      DEALLOCATE(SMMD)
      DEALLOCATE(SMOC)
      DEALLOCATE(SMBC)
      DEALLOCATE(SMSP)
      DEALLOCATE(SIWH)
      DEALLOCATE(SEWH)
      DEALLOCATE(SDNU)
      DEALLOCATE(SDMA)
      DEALLOCATE(SDAC)
      DEALLOCATE(SDCO)
      DEALLOCATE(SSSN)
      DEALLOCATE(SMDN)
      DEALLOCATE(SIAN)
      DEALLOCATE(SSSM)
      DEALLOCATE(SMDM)
      DEALLOCATE(SEWM)
      DEALLOCATE(SSUM)
      DEALLOCATE(SOCM)
      DEALLOCATE(SBCM)
      DEALLOCATE(SIWM)
      DEALLOCATE(CLDA)
      DEALLOCATE(RMUA)
!
      END SUBROUTINE PAMDIAG
