      SUBROUTINE TRANSC10(T,Q,X,XA,P,PF,Z,ZF,DTDT,DQDT,DXDT,MCT,ISHALL,
     1                    LALMA,MB,PRESSG,PCP,DT,RRL,A,B,EPS1,EPS2,GRAV,
     2                    RGAS,RGASV,CPRES,ILEV,ILEVM,ILG,ILGG,IL1,IL2,
     3                    MSG,MSGG,NTRAC,ITRAC,ISULF,NEQP,ITRPHS,NTRACA,
     4                    INH3,IHNO3,IO3,ICO2,ISO2,ISO4,IHPO,ISSA,ISSC,
     5                    IPAM,PHSROW,CSCBROW,CSCBROL,
     6                    BCSROW,TCSROW,SO4CROW,
     7                    CVMC,SMCT,CQFXROW,CHFXROW,SCLF,XSRC,XSNK,
     9                    SCDN,SLWC,ISVCONV,ISVCHEM,ITRCCH,IDUA,IDUC,
     A                    SAVERAD)  
C-------------------------------------------------------------------------
C     * FEB 02/2017 - M.LAZARE.    REMOVE REFERENCES TO (UNUSED) CAPEN.
C     * MAY 01/2015 - M.LAZARE.    New version for GCM18:
C     *                            - Calls new PARPRP4 instead of PARPRP3.
C     *                            - Unused GCROW removed; this was only
C     *                              in call to SCPRP7 so new SCPRP8
C     *                              called.
C     * JUN 16/2013 - K.VONSALZEN. PREVIOUS ROUTINE TRANSC9 FOR GCM17:
C     *                            - PASSES "IPAM" THROUGH TO NEW SCPRP7
C     *                              TO SUPPORT PLA OPTION.
C     *                            - CALLS NEW TDCAL6.
C     * APR 23/2010 - M.LAZARE/    PREVIOUS VERSION TRANSC8 FOR GCM15I+:
C     *               K.VONSALZEN. - CALLS NEW SCPRP6,TDCAL5.
C     *                            - MODIFIED DIAGNOSTIC FIELDS.
C     * FEB 16/2009 - M.LAZARE.    PREVIOUS VERSION TRANSC7 FOR GCM15H:
C     *                            - CALLS NEW SCPRP5.
C     * DEC 18/2007 - M.LAZARE/    PREVIOUS VERSION TRANSC6 FOR GCM15G:
C     *               K.VONSALZEN. ADD CALCULATIONS FOR DIAGNOSTIC FIELDS
C     *                            WDS4ROL,WDS6ROL. THIS INCLUDES CALL
C     *                            TO NEW TDCAL4 ACCORDINGLY.    
C     * NOV 26/2006 - M.LAZARE/    PREVIOUS VERSION TRANSC5 FOR GCM15F.
C     *               K.VONSALZEN. - PASS IN AND CALCULATE NEW DIAGNOSTIC
C     *                              FIELD "SMCT" UNDER CONTROL OF "ISVCONV".   
C     * NOV 24/2006 - M.LAZARE.    - SELECTED VARIABLES PROMOTED TO REAL*8
C     *                              TO WORK IN 32-BIT MODE.  
C     *                            - OPTIMIZE EXPRESSION FOR ATEMPO.
C     * JUN 15/2006 - M.LAZARE.    - NOW USES INTERNAL WORK ARRAYS
C     *                              INSTEAD OF PASSED WORKSPACE.    
C     *                            - CALLS NEW VERSIONS OF PARPRP3,
C     *                              SCPRP4 AND TDCAL3.  
C     *                            - "ZERO" DATA CONSTANT ADDED AND USED
C     *                              IN CALL TO INTRINSICS.
C     * MAY 04/2006 - M.LAZARE/    PREVIOUS VERSION TRANSC4 FOR GCM15E:
C     *               K.VONSALZEN. - CALLS NEW PARPRP2,SCPRP3.
C     *                              THIS REQUIRES PASSING IN EPS2.
C     *                            - CALCULATION OF SATURATION VAPOUR
C     *                              PRESSURE MODIFIED TO WORK OVER
C     *                              COMPLETE VERTICAL DOMAIN, BY
C     *                              SPECIFYING LIMIT AS ES->P.
C     *                            - STORE MASS FLUX IN NEW PROGNOSTIC
C     *                              ARRAY "CVMC", TO BE USED 
C     *                              SUBSEQUENTLY IN PROVIDING CONVECTIVE
C     *                              CONTRIBUTION TO CLOUD VARIANCE.
C     * DEC 15/2005 - K.VONSALZEN/ PREVIOUS VERSION TRANSC3 FOR GCM15D.
C     *               M.LAZARE.  
C
C     * PERFORMS TRANSIENT SHALLOW CONVECTION ADJUSTMENT BASED ON
C     * MASS-FLUX ALGORITHM (VON SALZEN AND MCFARLANE, JAS, 2001).
C                                               
C     ************************ INDEX OF VARIABLES **********************
C     *  I     => INPUT ARRAYS.              
C     *  O     => OUTPUT ARRAYS.
C     *  W     => WORK ARRAYS.       
C     * IC     => INPUT DATA CONSTANTS.    
C     *  C     => DATA CONSTANTS PERTAINING TO SUBROUTINE ITSELF. 
C
C IC  * A        FOR CALCULATION OF SATURATION VAPOUR PRESSURE 
C                (=21.656).
C  W  * ACOR     CORRECTION FACTOR FOR CLOUD BASE MASS FLUX, USED IN
C                EMERGENCY FEATURE IN TDCAL.
C  W  * ACORX    CORRECTION FACTOR FOR CLOUD BASE MASS FLUX, USED IN
C                EMERGENCY FEATURE IN TDCAL (FOR TRACERS).
C  W  * ACHPA    CHEMICAL PARAMETERS, I.E. HENRY'S LAW CONSTANTS ETC.
C  W  * ALPHA    GATHERED PARAMETER FOR CLOUD-TOP ENTRAINMENT 
C                (DIMENSIONLESS,FOR CLOUD VERTICAL COORDINATES).
C  W  * AMHVAL   WORK ARRAY TO STORE ROW OF "AMH" REQUIRED FOR  PHS
C                DIAGNOSTIC FIELD CALCULATION.
C  W  * AUTO     GATHERED AUTOCONVERSION RATE IN KG/KG/S.
C IC  * B        FOR CALCULATION OF SATURATION VAPOUR PRESSURE 
C                (=5418.).
C  W  * BUOY     GATHERED BUOYANCY IN M/SEC^2.
C  W  * COND     GATHERED CONDENSATION RATE IN KG/KG/S.
C IC  * CPRES    HEAT CAPACITY AT CONSTANT PRESSURE FOR DRY AIR 
C                (=RGAS/RGOCP).
C  O  * CHFXROW  FLUX OF LIQUID WATER STATIC ENERGY (POSITIVE UPWARD)
C     *          AT CLOUD BASE.
C  O  * CQFXROW  FLUX OF TOTAL WATER MIXING RATIO (POSITIVE UPWARD)
C     *          AT CLOUD BASE.
C  W  * DADZF    GATHERED VERTICAL DERIVATIVE OF ALPHA AT GRID CELL
C                INTERFACES IN 1/M.
C  W  * DC       GATHERED, AVERAGED, AND NORMALIZED DETRAINMENT RATE 
C                IN 1/SEC.
C  W  * DG       GATHERED VERTICAL GRID SIZE FROM DDG/DZ=PE 
C                (DIMENSIONLESS).
C  W  * DP       GATHERED VERTICAL GRID SIZE IN PASCAL.
C  O  * DQDT     GATHERED TENDENCY FOR TOTAL WATER MIXING RATIO 
C                IN KG/KG/SEC AT MID-LAYER.
C  W  * DSR      RATIO OF WET AND DRY AIR DENSITIES.
C IC  * DT       TOTAL MODEL TIME STEP IN SEC (DT=2*DELT).
C  O  * DTDT     GATHERED TENDENCY FOR TEMPERATURE IN K/SEC AT 
C                MID-LAYER.
C  O  * DXDT     GATHERED TENDENCY FOR TRACER MIXING RATIOS IN 
C                KG/KG/SEC AT MID-LAYER.
C  W  * DZ       GATHERED VERTICAL GRID SIZE IN METRES 
C                (FOR CLOUD VERTICAL COORDINATES).
C  W  * DZO      GATHERED VERTICAL GRID SIZE IN METRES.
C  W  * EC       GATHERED, AVERAGED, AND NORMALIZED ENTRAINMENT RATE 
C                IN 1/SEC.
C IC  * EPS1     EPS1=RGAS/RGASV (=0.622).
C  W  * FCB      GATHERED WEIGHT FACTOR USED TO ESTIMATE BASE OF
C                CLOUD LAYER (DIMENSIONLESS).
C  W  * FCT      GATHERED WEIGHT FACTOR USED TO ESTIMATE TOP OF 
C                CLOUD LAYER (DIMENSIONLESS).
C IC  * GRAV     ACCELERATION DUE TO GRAVITY (=9.80616).  
C  W  * HCT      GATHERED, MOIST STATIC ENERGY IN CLOUD CORE IN M^2/SEC^2 
C                (FOR BOTH CLOUD AND ENVIRONMENT VERTICAL COORDINATES).
C  W  * HMN      MOIST STATIC ENERGY IN CLOUD ENVIRONMENT AT MID-LAYER 
C                IN M^2/SEC^2. 
C  W  * HMNC     GATHERED HORIZONTALLY AVERAGED MOIST STATIC ENERGY 
C                IN CLOUD IN M^2/SEC^2 (FOR CLOUD VERTICAL COORDINATES).
C  W  * HMNF     GATHERED MOIST STATIC ENERGY AT GRID CELL-INTERFACES 
C                IN M^2/SEC^2 (FOR CLOUD VERTICAL COORDINATES).
C  W  * HMNG     GATHERED MOIST STATIC ENERGY AT MID-LAYERS IN M^2/SEC^2
C                AT INITIAL TIME.
C  W  * HMNMG    GATHERED MOIST STATIC ENERGY IN PARCEL LAUNCHING LAYER
C                IN M^2/SEC^2.
C IC  * ISVCHEM  SWITCH TO SAVE DIAGNOSTIC CHEMISTRY FIELDS.
C IC  * ISVCONV  SWITCH TO SAVE DIAGNOSTICS SHALLOW CONVECTION FIELDS. 
C IC  * ILEV     NUMBER OF MODEL LEVELS, EXCLUDING MOON LAYER.   
C IC  * ILEVM    ILEVM=ILEV-1. 
C IC  * ILG      ILG=LON+2 => SIZE OF HORIZONTAL GRID SLICE. 
C IC  * ILGG     SIZE OF GATHERED GRID SLICE. 
C IC  * IL1      START LONGITUDE INDEX FOR LATITUDE CIRCLE. 
C IC  * IL2      END LONGITUDE INDEX FOR LATITUDE CIRCLE. 
C  I  * ISHALL   INDEX FOR GATHERED GRID CELLS WHICH ARE SUBJECT TO 
C                CONVECTION.
C  W  * ISKIP    ISKIP=1 FOR CASES IN WHICH CONVECTION IS NOT ALLOWED 
C                TO OCCUR.
C IC  * ITRAC    TRACER SWITCH.
C  I  * LALMA    MAXIMUM VERTICAL INDEX OF PARCEL LAUNCHING LAYER 
C                (AT MID-LAYER).
C  W  * LCL      GATHERED INDEX OF LIFTING CONDENSATION LEVEL.
C IC  * LEV      TOTAL NUMBER OF MODEL LEVELS.
C  W  * LMAG     GATHERED VALUE OF LALMA.
C  W  * LNB      GATHERED INDEX OF LEVEL OF NEUTRAL BUOYANCY.
C  W  * LTM      WORK ARRAY USED IN INDEX CALCULATIONS.
C  I  * MB       CLOUD BASE MASS FLUX IN KG/M^2/S.
C  W  * MBG      GATHERED CLOUD BASE MASS FLUX IN KG/M^2/S.
C  W  * MC       GATHERED NORMALIZED VERTICAL MASS FLUX (DIMENSIONLESS, 
C                FOR BOTH CLOUD AND ENVIRONMENT VERTICAL COORDINATES).
C  I  * MCT      NORMALIZED VERTICAL MASS FLUX FOR DEEP(DIMENSIONLESS),
C                USED TO LIMIT CLOUD-BASE MASS FLUX FOR SHALLOW TO
C                THEORETICAL MAXIMUM.
C IC  * MSG      NUMBER OF OMITTED LEVELS AT THE TOP OF MODEL.
C  O  * MSGG     DEFINES THE UPPER BOUNDARY OF THE DOMAIN.
C IC  * NTRAC    NUMBER OF TRACERS.
C  I  * P        AMBIENT MID-LAYER PRESSURE IN HECTOPASCAL. 
C  O  * PCP      PRECIPITATION IN G/M**2.
C  W  * PE       GATHERED ENTRAINMENT PARAMETER FOR LATERAL ENTRAINMENT 
C                IN 1/M (FOR CLOUD VERTICAL COORDINATES).   
C  I  * PF       AMBIENT GRID CELL-INTERFACE PRESSURE IN HECTOPASCAL. 
C  W  * PFO      GATHERED GRID CELL-INTERFACE PRESSURE IN HECTOPASCAL.
C  W  * PFG      GATHERED GRID CELL-INTERFACE PRESSURE IN HECTOPASCAL
C                (FOR CLOUD VERTICAL COORDINATES).
C  W  * PG       GATHERED AMBIENT PRESSURE AT MID-LAYERS IN HECTOPASCAL. 
C  I  * PRESSG   SURFACE PRESSURE IN PASCAL.
C  I  * Q        TOTAL WATER MIXING RATIO IN CLOUD ENVIRONMENT 
C                AT MID-LAYER. 
C  W  * QC       GATHERED HORIZONTALLY AVERAGED TOTAL WATER MIXING 
C                RATIO IN CLOUD IN KG/KG (FOR CLOUD VERTICAL 
C                COORDINATES).
C  W  * QCT      GATHERED, TOTAL WATER MIXING RATIO IN CLOUD CORE
C                IN KG/KG (FOR BOTH CLOUD AND ENVIRONMENT VERTICAL COORDINATES).
C  W  * QF       GATHERED TOTAL WATER MIXING RATIO AT GRID-CELL 
C                INTERFACES IN KG/KG (FOR CLOUD VERTICAL COORDINATES).
C  W  * QFO      GATHERED TOTAL WATER MIXING RATIO AT GRID-CELL 
C                INTERFACE IN KG/KG AT INITIAL TIME.
C  W  * QG       GATHERED TOTAL WATER MIXING RATIO AT MID-LAYERS 
C                IN KG/KG AT INITIAL TIME.
C  W  * QLCT     GATHERED CLOUD WATER MIXING RATIO IN CLOUD CORE
C                IN KG/KG (FOR BOTH CLOUD AND ENVIRONMENT VERTICAL COORDINATES).
C  W  * QLWC     IN-CLOUD CLOUD WATER MIXING RATIO IN KG/KG.
C  W  * QMG      GATHERED TOTAL WATER MIXING RATIO IN PARCEL LAUNCHING 
C                LAYER IN KG/KG.
C  W  * QSTC     GATHERED HORIZONTALL AVERAGED WATER VAPOUR MIXING RATIO 
C                IN CLOUD IN KG/KG. 
C  IC * RGAS     TOTAL (WET) AIR GAS CONSTANT. 
C  IC * RGASV    GAS CONSTANT OF WATER VAPOUR (=461.50).
C  IC * RGOCP    RGOCP=RGAS/CPRES (=2./7.).
C  IC * RRL      LATENT HEAT OF VAPOURIZATION (=2.501E+06).
C  W  * RU       GATHERED SCAVENGING RATE FOR TRACERS IN KG/KG/S.
C  W  * RUA      GATHERED SCAVENGING RATE FOR ADDITIONAL TRACERS IN KG/KG/S.
C  W  * SC       GATHERED IN-CLOUD SOURCES/SINKS OF TRACERS IN KG/KG/S.
C  O  * SCDN     CLOUD DROPLET NUMBER CONCENTRATION IN 1/M3.
C  O  * SCLF     CLOUD FRACTION (0..1.)
C  O  * SLWC     GRID-CELL MEAN CLOUD WATER CONTENT IN KG/KG.
C  I  * T        TEMPERATURE AT MID-LAYER IN K. 
C  W  * TAUC     GATHERED CLOUD LIFETIME.
C  W  * TC       GATHERED HORIZONTALLY AVERAGED TEMPERATURE IN CLOUD 
C                IN K.
C  W  * TDRY     GATHERED THEORETICAL TEMPERATURE IN CLOUD BELOW 
C                SATURATION IN K.
C  W  * TFE      GATHERED TEMPERATURE AT GRID CELL-INTERFACES IN K
C                (FOR CLOUD VERTICAL COORDINATES). 
C  W  * TG       GATHERED AMBIENT TEMPERATURE AT MID-LAYERS IN K.
C  W  * TSTAR    GATHERED TIME AT WHICH THE CLOUD TOP REACHES THE 
C                ACTUAL LEVEL IN SEC.
C  C  * TVFA     CONSTANT USED IN APPROXIMATION OF VIRTUAL 
C                TEMPERATURE (=0.608).
C  W  * WC       GATHERED HORIZONTALLY AVERAGED VERTICAL VELOCITY IN 
C                CLOUD IN M/SEC (FOR CLOUD VERTICAL COORDINATES).
C  W  * WRKX     WORK ARRAY FOR TRACERS.
C  W  * WRK1     WORK ARRAY.
C  W  * WRK2     WORK ARRAY.
C  W  * WRK3     WORK ARRAY.
C  W  * WRK4     WORK ARRAY.
C  I  * X        TRACER MIXING RATIOS AT MID-LAYER.
C  I  * XA       MIXING RATIOS OF ADDITIONAL TRACERS AT MID-LAYER.
C  W  * XC       GATHERED HORIZONTALLY AVERAGED TRACER MIXING RATIOS 
C                IN CLOUD IN KG/KG (FOR CLOUD VERTICAL COORDINATES).
C  W  * XCT      GATHERED, TRACER MIXING RATIO IN CLOUD CORE IN KG/KG 
C                (FOR BOTH CLOUD AND ENVIRONMENT VERTICAL COORDINATES).
C  W  * XCTA     GATHERED, MIXING RATIO OF ADDITIONAL TRACERS IN CLOUD 
C                CORE IN KG/KG (FOR BOTH CLOUD AND ENVIRONMENT 
C                VERTICAL COORDINATES).
C  W  * XF       GATHERED AMBIENT TRACER MIXING RATIOS AT GRID 
C                CELL-INTERFACES IN KG/KG (FOR CLOUD VERTICAL 
C                COORDINATES).
C  W  * XFO      GATHERED AMBIENT TRACER MIXING RATIOS AT GRID 
C                CELL-INTERFACES IN KG/KG.
C  W  * XG       GATHERED AMBIENT TRACER MIXING RATIOS AT MID-LAYERS 
C                IN KG/KG.
C  W  * XGA      GATHERED AMBIENT MIXING RATIOS OF ADDITIONAL TRACERS
C                AT MID-LAYERS IN KG/KG.
C  I  * Z        AMBIENT MID-LAYER HEIGHT IN METRES. 
C  I  * ZF       AMBIENT GRID CELL-INTERFACE HEIGHT IN METRES.
C  W  * ZFG      GATHERED GRID CELL-INTERFACE HEIGHT IN METRES
C                (FOR CLOUD VERTICAL COORDINATES).
C  W  * ZFO      GATHERED GRID CELL-INTERFACE HEIGHT IN METRES.
C  W  * ZG       GATHERED AMBIENT MID-LAYER HEIGHT IN METRES. 
C
C     ******************************************************************
C
      IMPLICIT REAL (A-H,O-Z),
     +INTEGER (I-N)
C      
C     * MULTI-LEVEL I/O FIELDS.
C     
      REAL   T(ILG,ILEV), Z(ILG,ILEV), DTDT(ILG,ILEV), ZF(ILG,ILEV),  
     1      PF(ILG,ILEV), Q(ILG,ILEV), DQDT(ILG,ILEV),  P(ILG,ILEV),
     2     MCT(ILG,ILEV), CVMC(ILG,ILEV), SO4CROW(ILG,ILEV)
      REAL  PHSROW(ILG,ILEV), CLDSROW(ILG,ILEV)
      REAL  SCLF  (ILG,ILEV), SCDN   (ILG,ILEV), SLWC   (ILG,ILEV),
     1      SMCT  (ILG,ILEV)
C
      REAL  X(ILG,ILEV,NTRAC), DXDT(ILG,ILEV,NTRAC)
      REAL XA(ILG,ILEV,NTRACA)
C
C     * SINGLE-LEVEL I/O FIELDS.
C      
      REAL   PRESSG(ILG),     PCP(ILG)
      REAL CSCBROW(ILG),  BCSROW(ILG),  TCSROW(ILG)
      REAL MB(ILG), CQFXROW(ILG), CHFXROW(ILG)
      REAL CSCBROL(ILG)
      INTEGER ISHALL(ILG), LALMA(ILG)
C
C     * TRACER SWITCHES TO DO PHYSICS AND/OR CHEMISTRY.
C
      INTEGER ITRPHS(NTRAC),ITRCCH(NTRAC)
C
C*******************************************************************
C     * INTERNAL WORK FIELDS (FIRST SET ARE PROMOTED FOR CONSISTENCY
C     * WITH REST OF SHALLOW). 
C*******************************************************************
      REAL*8, DIMENSION(ILG,ILEV)      :: BUOY,QF,PFG,QC,QSTC,TC,HMNF,
     1                                    DZ,ZG,ZFG,TDRY,HMNC,
     2                                    QCT,HCT,DG,PE,PD,ALPHA,WC,
     3                                    TSTAR 
      REAL*8, DIMENSION(ILG)           :: FCB,FCT,TAUC
C
      REAL, DIMENSION(ILG,ILEV,NTRAC)  :: XFO,XC,WRKX,XF,XCT,XG,RU,SC
      REAL, DIMENSION(ILG,ILEV,NTRACA) :: XGA,XCTA,RUA
      REAL, DIMENSION(ILG,ILEV,NEQP)   :: ACHPA
      REAL, DIMENSION(ILG,NTRAC)       :: ACORX,XSRC,XSNK
      REAL, DIMENSION(ILG,ILEV)        :: HMNG,PG,DSNFO,HMN,
     1                                    TG,WRK4,DP,WRK1,DSNG,DC,
     2                                    QFO,DADZF,WRK2,DZO,
     3                                    EC,AUTO,DSRC,ZFO,TFE,
     4                                    WRK3,QLCT,COND,PFO,
     5                                    QG,DCT,DSN,MC,DSR,QLWC     
      REAL, DIMENSION(ILG)             :: HMNMG,QMG,MBG,ACOR,AMHVAL
      INTEGER,DIMENSION(ILG)           :: LCL,LNB,LMAG,LTM,ISKIP
C
C     * LOCAL CONSTANTS.
C
      DATA GAMMA  / 5.    /
      DATA TVFA   / 0.608 /
      DATA ADEF   /-9.    / 
      DATA ASEC   / 0.99  /
      DATA IDEF   /-9     /
      DATA ZERO   / 0.    /

C     * INTERNAL FUNCTIONS.
C
      ZINTP( ARG1,ARG2,ARG3 )=ARG3*ARG1+(1.-ARG3)*ARG2
C-----------------------------------------------------------------------
C     * INITIALIZATIONS.
C
      DO 50 L=1,ILEV
      DO 50 IL=IL1,IL2
         QCT (IL,L)=0.
         HCT (IL,L)=0.
         DCT (IL,L)=0.
         MC  (IL,L)=0.
         WRK3(IL,L)=0.
  50  CONTINUE
      IF ( ITRAC.NE.0 ) THEN
         DO 100 N=1,NTRAC
         DO 100 L=1,ILEV
         DO 100 IL=IL1,IL2
            XCT(IL,L,N)=0.
  100    CONTINUE
      END IF
C     
C     * DEFINE MOIST STATIC ENERGY.
C     
      EPSLIM=0.001
      DO 200 L=MSG+1,ILEV 
      DO 200 IL=IL1,IL2 
         ETMP=EXP( A-B/T(IL,L) )
         ESTREF=P(IL,L)*(1.-EPSLIM)/(1.-EPSLIM*EPS2)
         IF ( ETMP.LT.ESTREF ) THEN
           EST=ETMP
         ELSE
           EST=ESTREF
         ENDIF
         QST=EPS1*EST/( P(IL,L)-EST )
         DSN(IL,L)=CPRES*T(IL,L)+GRAV*Z(IL,L)
         HMN(IL,L)=DSN(IL,L)+RRL*MIN( Q(IL,L), QST ) 
 200  CONTINUE  
C
C     * GATHER PROPERTIES.
C
      DO 220 IL=1,ILGG
         MBG  (IL)=MB    (ISHALL(IL))
         LMAG (IL)=LALMA (ISHALL(IL))
 220  CONTINUE
      DO 240 L=MSG+1,ILEV 
      DO 240 IL=1,ILGG
         PG  (IL,L)=P  (ISHALL(IL),L)
         ZG  (IL,L)=Z  (ISHALL(IL),L)
         PFG (IL,L)=PF (ISHALL(IL),L)
         ZFG (IL,L)=ZF (ISHALL(IL),L)
         TG  (IL,L)=T  (ISHALL(IL),L)
         QG  (IL,L)=Q  (ISHALL(IL),L)
         HMNG(IL,L)=HMN(ISHALL(IL),L)
         DSNG(IL,L)=DSN(ISHALL(IL),L)
         ZFO (IL,L)=ZFG(IL,L)
         PFO (IL,L)=100.*PFG(IL,L)
 240  CONTINUE
      IF ( ITRAC.NE.0 ) THEN
         DO 280 N=1,NTRAC
         DO 280 L=MSG+1,ILEV 
         DO 280 IL=1,ILGG 
            XG(IL,L,N)=X(ISHALL(IL),L,N)
 280     CONTINUE
         IF ( ISULF.NE.0 ) THEN
            DO 290 N=1,NTRACA
            DO 290 L=MSG+1,ILEV 
            DO 290 IL=1,ILGG 
               XGA(IL,L,N)=XA(ISHALL(IL),L,N)
 290        CONTINUE
         END IF
      ENDIF
C
C     * DIMENSIONS OF VERTICAL GRID.
C
      DO 300 IL=1,ILGG
         DP(IL,ILEV)=PRESSG(ISHALL(IL))-100.*PFG(IL,ILEV)
 300  CONTINUE 
      DO 320 L=MSG+1,ILEVM 
      DO 320 IL=1,ILGG
         DP(IL,L)=100.*( PFG(IL,L+1)-PFG(IL,L) )
 320  CONTINUE 
      DO 380 L=MSG+1,ILEVM 
      DO 380 IL=1,ILGG
         DZO(IL,L)=ZFG(IL,L)-ZFG(IL,L+1) 
         DZ (IL,L)=DZO(IL,L)
 380  CONTINUE
      DO 400 IL=1,ILGG
         DZO(IL,ILEV)=ZFG(IL,ILEV)
         DZ (IL,ILEV)=DZO(IL,ILEV)
 400  CONTINUE
      DO 420 L=MSG+2,ILEV
      DO 420 IL=1,ILGG
         WRK4(IL,L)=( ZFG(IL,L)-ZG(IL,L-1) )/( ZG(IL,L)-ZG(IL,L-1) )
 420  CONTINUE
      DO 430 L=MSG+1,ILEV
      DO 430 IL=1,ILGG
         DSR(IL,L)=(1.+QG(IL,L))
 430  CONTINUE
C
C     * GET PROPERTIES AT GRID BOX INTERFACES.
C
      DO 440 L=MSG+2,ILEV 
      DO 440 IL=1,ILGG
         QF  (IL,L)=ZINTP( QG  (IL,L),QG  (IL,L-1),WRK4(IL,L) )
         HMNF(IL,L)=ZINTP( HMNG(IL,L),HMNG(IL,L-1),WRK4(IL,L) )
         TFE (IL,L)=ZINTP( TG  (IL,L),TG  (IL,L-1),WRK4(IL,L) )
         QFO  (IL,L)=QF(IL,L)
         DSNFO(IL,L)=ZINTP( DSNG(IL,L),DSNG(IL,L-1),WRK4(IL,L) )
  440 CONTINUE
C
      L=MSG+1
      DO 450 IL=1,ILGG
         QFO  (IL,L)=QG  (IL,L)
         DSNFO(IL,L)=DSNG(IL,L)
  450 CONTINUE
C
      IF ( ITRAC.NE.0 ) THEN
         DO 460 N=1,NTRAC
         DO 460 L=MSG+2,ILEV 
         DO 460 IL=1,ILGG 
            XF(IL,L,N)=ZINTP( XG(IL,L,N),XG(IL,L-1,N),WRK4(IL,L) )
            XFO(IL,L,N)=XF(IL,L,N)
  460    CONTINUE
C
         L=MSG+1
         DO 470 N=1,NTRAC
         DO 470 IL=1,ILGG
            XFO(IL,L,N)=XG(IL,L,N)
  470    CONTINUE
      ENDIF
C
C     * RESTRICT VERTICAL DOMAIN TO LEVELS BELOW FREEZING LEVEL.
C     * A MINIMUM OF 4 LEVELS IS REQUIRED IN TOTAL.
C
      MSGG=ILEV
      DO 480 IL=1,ILGG
         LNB(IL)=IDEF
 480  CONTINUE
      DO 500 L=ILEV,MSG+2,-1 
      DO 500 IL=1,ILGG
         IF ( LNB(IL).EQ.IDEF .AND. TFE(IL,L).LE.273. ) THEN
            MSGG=MIN(MSGG,L-2)
            LNB(IL)=L
         END IF
 500  CONTINUE
      DO 520 IL=1,ILGG
         IF ( LNB(IL).EQ.IDEF) THEN
            MSGG=MSG
         END IF
 520  CONTINUE
      IF ( MSGG.GT.(ILEV-4) ) ILGG=0
C
C     * INITIATING UPDRAFT PROPERTIES BELOW MAXIMUM PARCEL LAUNCHING 
C     * LEVEL.
C
      DO 540 IL=1,ILGG
         L=LMAG(IL)
         QMG  (IL)=QG  (IL,L)
         HMNMG(IL)=HMNG(IL,L)
  540 CONTINUE
C
      DO 550 L=MSGG+1,ILEV
      DO 550 IL=1,ILGG
         IF ( L.GE.LMAG(IL) ) THEN
            QCT(IL,L)=QMG  (IL)
            HCT(IL,L)=HMNMG(IL)
            DCT(IL,L)=DSNG(IL,LMAG(IL))
         END IF
  550 CONTINUE
C
      IF ( ITRAC.NE.0 ) THEN
         DO 562 N=1,NTRAC
            IF ( ITRPHS(N).GT.0 ) THEN
               DO 560 L=MSGG+1,ILEV
               DO 560 IL=1,ILGG
                  IF ( L.GE.LMAG(IL) )                         THEN
                     XCT(IL,L,N)=XG(IL,LMAG(IL),N)
                  END IF
  560          CONTINUE
            ENDIF
  562    CONTINUE
         IF ( ISULF.NE.0 ) THEN
            DO 565 N=1,NTRACA
            DO 565 L=MSGG+1,ILEV
            DO 565 IL=1,ILGG
               IF ( L.GE.LMAG(IL) )                             THEN
                  XCTA(IL,L,N)=XGA(IL,LMAG(IL),N)
               END IF
  565       CONTINUE
         END IF
      END IF
C
C     * PROPERTIES OF AIR PARCEL FOR UNDILUTE ASCENT FROM CLOUD BASE.
C
      CALL PARPRP4(BUOY,TC,QSTC,HMNC,HMNMG,QC,QMG,QF,ILEV,ILEVM,
     1             ILG,ILGG,MSGG,LMAG,LCL,FCB,TDRY,ZFG,TSTAR,WC,DZ,
     2             PFG,TFE,ISKIP,RRL,GRAV,CPRES,EPS1,EPS2,A,B,RGAS,
     3             RGASV,TVFA,ADEF,LTM,MBG,PG,WRK3)
C
C     * RESTRICT VERTICAL DOMAIN TO LEVELS WITH CAN BE REACHED BY
C     * THE UNDILUTED PARCEL (I.E. WC > 0).
C
      MSGGT=ILEV
      DO 570 IL=1,ILGG
         LNB(IL)=IDEF
 570  CONTINUE
      DO 580 L=ILEVM,MSGG+2,-1 
      DO 580 IL=1,ILGG
         IF ( LNB(IL).EQ.IDEF .AND. L.LE.LCL(IL) .AND. WC(IL,L).LE.0.
     1       .AND. ISKIP(IL).EQ.0 ) THEN
            MSGGT=MIN(MSGGT,L-2)
            LNB(IL)=L
         END IF
 580  CONTINUE
      DO 590 IL=1,ILGG
         IF ( LNB(IL).EQ.IDEF .AND. ISKIP(IL).EQ.0 ) THEN
            MSGGT=MSGG
         END IF
 590  CONTINUE
      MSGG=MAX(MSGGT,MSGG)
      IF ( MSGG.GT.(ILEV-4) ) ILGG=0
C
C     * PROPERTIES AT LCL FROM INTERPOLATION.
C
      DO 600 IL=1,ILGG
         IF ( ISKIP(IL).EQ.0 ) THEN
            L=LCL(IL)
            PFG (IL,L+1)=FCB(IL)*PFG (IL,L+1)+(1.-FCB(IL))*PFG (IL,L)
            TFE (IL,L+1)=FCB(IL)*TFE (IL,L+1)+(1.-FCB(IL))*TFE (IL,L)
            TC  (IL,L+1)=FCB(IL)*TC  (IL,L+1)+(1.-FCB(IL))*TC  (IL,L)
            QF  (IL,L+1)=FCB(IL)*QF  (IL,L+1)+(1.-FCB(IL))*QF  (IL,L)
            QSTC(IL,L+1)=FCB(IL)*QSTC(IL,L+1)+(1.-FCB(IL))*QSTC(IL,L)
            HMNF(IL,L+1)=FCB(IL)*HMNF(IL,L+1)+(1.-FCB(IL))*HMNF(IL,L)
         ENDIF
 600  CONTINUE
      IF ( ITRAC.NE.0 ) THEN
         DO 620 N=1,NTRAC
         DO 620 IL=1,ILGG
            IF ( ISKIP(IL).EQ.0 ) THEN
               L=LCL(IL)
               XF(IL,L+1,N)=FCB(IL) *XF(IL,L+1,N)
     1                 +(1.-FCB(IL))*XF(IL,L,N)
            ENDIF
 620     CONTINUE
      ENDIF
C
C     * INITIATING UPDRAFT PROPERTIES BELOW LCL SET TO BE
C     * EQUAL TO PROPERTIES AT MAXIMUM PARCEL LAUNCHING LEVEL.
C
      DO 640 L=ILEVM,MSGG+2,-1
      DO 640 IL=1,ILGG
         IF (       L.LT.LMAG(IL) .AND. L.GE.(LCL(IL)+1) 
     1        .AND. ISKIP(IL).EQ.0 ) THEN
            QCT(IL,L)=QCT(IL,L+1)
            DCT(IL,L)=DCT(IL,L+1)
            HCT(IL,L)=HCT(IL,L+1)
         ENDIF
 640  CONTINUE
      IF ( ITRAC.NE.0 ) THEN
         DO 665 N=1,NTRAC 
            IF ( ITRPHS(N).GT.0 ) THEN
               DO 660 L=ILEVM,MSGG+2,-1
               DO 660 IL=1,ILGG
                  IF (  L.LT.LMAG(IL) .AND. L.GE.(LCL(IL)+1)
     1                 .AND. ISKIP(IL).EQ.0                     ) THEN
                      XCT(IL,L,N)=XCT(IL,L+1,N)
                  ENDIF
 660           CONTINUE
            ENDIF
 665     CONTINUE
         IF ( ISULF.NE.0 ) THEN
            DO 680 N=1,NTRACA
            DO 680 L=ILEVM,MSGG+2,-1
            DO 680 IL=1,ILGG
               IF (  L.LT.LMAG(IL)
     1              .AND. L.GE.(LCL(IL)+1) .AND. ISKIP(IL).EQ.0 ) THEN
                  XCTA(IL,L,N)=XCTA(IL,L+1,N)
               ENDIF
 680        CONTINUE
         ENDIF
      ENDIF
 999  CONTINUE
C
C     * DENSITY OF DRY AIR.
C
      DO 690 L=ILEV,MSGG+2,-1
      DO 690 IL=1,ILGG
         IF ( L.LE.(LCL(IL)+1) .AND. ISKIP(IL).EQ.0 ) THEN
            RGASD=RGAS/(1.+QF(IL,L))
            WRK4(IL,L)=100.*PFG(IL,L)/(RGASD*TFE(IL,L))
         END IF
 690  CONTINUE
C
      DO L=1,ILEV
      DO IL=IL1,IL2
        SCDN(IL,L)=0.
      ENDDO
      ENDDO
C
C     * CLOUD BUDGETS FOR MASS AND ALL OTHER CONSERVED PROPERTIES. 
C
      CALL SCPRP8(MC,HMNC,QC,XC,HMNF,QF,XF,ZFG,TG,HMNG,QG,XG,
     1            ZG,PG,DG,ILEV,ILEVM,ILG,ILGG,MSGG,NTRAC,ADEF,
     2            NTRACA,ISO2,ISO4,IHPO,INH3,IHNO3,IO3,ICO2,
     3            IDUA,IDUC,ISSA,ISSC,ISULF,ITRAC,LCL,LMAG,LTM,
     4            LNB,FCT,QSTC,PFG,COND,AUTO,RU,RUA,ITRCCH,
     5            RRL,GRAV,CPRES,EPS1,EPS2,A,B,BUOY,TDRY,TFE,WC,TSTAR,
     6            TAUC,DZ,TC,DC,EC,PE,PD,ALPHA,WRK1,HCT,QCT,QLCT,
     7            XCT,NEQP,ACHPA,XCTA,XGA,SC,WRK4,AMHVAL,
     8            RGAS,RGASV,TVFA,GAMMA,DADZF,WRK2,WRK3,ITRPHS,
     9            ISKIP,PHSROW,ISHALL,ISVCONV,ISVCHEM,
     A            SO4CROW,DCT,DZO,DT,QLWC,SCDN,IPAM)
C
C     * LIMIT CLOUD BASE MASS FLUX TO ITS THEORETICAL MAXIMUM VALUE.
C
      DO 700 L=MSGG+2,ILEV
      DO 700 IL=1,ILGG
         IF (       L.LE.LMAG(IL) .AND. L.GE.LNB(IL) 
     1        .AND. ISKIP(IL).EQ.0 ) THEN
            APTMP=MIN( DP(IL,L)/DSR(IL,L),DP(IL,L-1)/DSR(IL,L-1) )
            MBG(IL)=MIN( MBG(IL),ASEC/(MC(IL,L)*GRAV)
     1                         *(APTMP/DT-MCT(ISHALL(IL),L)) )
            MBG(IL)=MAX(MBG(IL),ZERO)
         ENDIF
 700  CONTINUE
C
C     * INITIALIZE ENSUING OUTPUT ARRAYS.
C
      DO L=1,ILEV
      DO IL=IL1,IL2
        SCLF(IL,L)=0.
        SLWC(IL,L)=0.
      ENDDO
      ENDDO
C
      CALL TDCAL6( DQDT,DTDT,DXDT,QG,XG,QFO,XFO,ZG,DCT,DSRC,DSNG,
     1             DSNFO,ZFO,PG,PFO,DP,DZ,DZO,QCT,XCT,MC,WRK1,
     2             WRK2,WRK3,TFE,WRKX,MBG,LMAG,LCL,LNB,ISKIP,
     3             ITRPHS,ILEV,ILEVM,ILG,ILGG,MSGG,MSG,NTRAC,
     4             ITRAC,CPRES,RRL,GRAV,ACOR,ACORX,DSR,WC,SC,RU,
     5             AUTO,QLCT,WRK4,PCP,DT,SCLF,ISO2,ISO4,IHPO,
     6             IDUA,IDUC,XSRC,XSNK,
     8             ISHALL,ISVCONV,ISVCHEM,ISULF )
C
C     * FLUXES OF TOTAL WATER MIXING RATIO AND LIQUID WATER STATIC ENERGY
C     * AT CLOUD BASE. POSITIVE SIGN FOR UPWARD FLUXES.
C
      DO 710 IL=1,ILGG
         IF ( ISKIP(IL).EQ.0 ) THEN
           L=LCL(IL)+1
           CQFXROW(ISHALL(IL))=CQFXROW(ISHALL(IL))
     1             +MBG(IL)*MC(IL,L)*(QLCT(IL,L)+QCT(IL,L)-QFO(IL,L-1))
           CHFXROW(ISHALL(IL))=CHFXROW(ISHALL(IL))
     1             +MBG(IL)*MC(IL,L)*((DCT(IL,L)-RRL*QLCT(IL,L))
     2                                                  -DSNFO(IL,L-1))
         ENDIF
 710  CONTINUE
C
C     * CALCULATE SHALLOW CLOUD LIQUID WATER CONTENT.
C
      DO L=MSGG+2,ILEVM
      DO IL=1,ILGG 
         IF ( ISKIP(IL).EQ.0. .AND. L.LE.LCL(IL) .AND. L.GE.(LNB(IL)-1) 
     1                                                           ) THEN
           SLWC(ISHALL(IL),L)=WRK3(IL,L)*.5*(QLWC(IL,L)+QLWC(IL,L+1))
         ENDIF
      ENDDO
      ENDDO
C
C     * STORE MASS FLUX IN PROGNOSTIC ARRAY TO BE USED SUBSEQUENTLY IN
C     * PROVIDING CONVECTIVE CONTRIBUTION TO CLOUD VARIANCE.
C
      DO IL=1,ILGG
         IF ( ISKIP(IL).EQ.0 ) THEN
            DO L=MSG+2,ILEV
              IF ( L.LE.LCL(IL) .AND. L.GE.LNB(IL) ) THEN
                CVMC(ISHALL(IL),L)=CVMC(ISHALL(IL),L)+MBG(IL)*MC(IL,L)
              ENDIF
            ENDDO
         ENDIF
      ENDDO
C
      IF(ISVCONV.NE.0) THEN      
C
C      * GET MAXIMUM CLOUD COVER AND PRECIPITATION.
C
       DO 720 IL=1,ILGG
         IF ( ISKIP(IL).EQ.0 ) THEN
            ATEMPO=0.
            DO 730 L=MSG+2,ILEV
               IF ( L.LE.(LCL(IL)+1) .AND. L.GE.LNB(IL) ) THEN
                  IF (L.LE.LCL(IL)) THEN
                    SMCT(ISHALL(IL),L)=MBG(IL)*MC(IL,L)
                  ENDIF
               END IF
 730        CONTINUE
C
         ENDIF
 720   CONTINUE
C
C      * CLOUD BASE AND CLOUD TOP.
C
       DO 740 IL=1,ILGG
         IF ( ISKIP(IL).EQ.0 ) THEN
              CSCBROW(ISHALL(IL))=CSCBROW(ISHALL(IL)) + 1.*SAVERAD
              BCSROW(ISHALL(IL))= BCSROW(ISHALL(IL)) + 
     1                             100.*PFG(IL,LCL(IL)+1)*SAVERAD
               TCSROW(ISHALL(IL))= TCSROW(ISHALL(IL)) +
     1                             100.*PFG(IL,LNB(IL)-1)*SAVERAD
         ENDIF
 740   CONTINUE
      ENDIF

      DO IL=1,ILGG
         IF ( ISKIP(IL).EQ.0 ) THEN
            CSCBROL(ISHALL(IL))=1.0
         END IF
      END DO ! IL
C
      RETURN
      END
