!+ Subroutine to assign Properties of Clouds.                                      RAD_ALL.3405  
!                                                                                  RAD_ALL.3406  
! Purpose:                                                                         RAD_ALL.3407  
!   The fractions of different types of clouds and their microphysical             RAD_ALL.3408  
!   preoperties are set.                                                           RAD_ALL.3409  
!                                                                                  RAD_ALL.3410  
! Method:                                                                          RAD_ALL.3411  
!   Straightforward.                                                               RAD_ALL.3412  
!                                                                                  RAD_ALL.3413  
! Current Owner of Code: J. M. Edwards                                             RAD_ALL.3414  
!                                                                                  RAD_ALL.3415  
! History:                                                                         RAD_ALL.3416  
!       Version         Date                    Comment                            RAD_ALL.3417  
!       4.0             27-07-95                Original Code                      RAD_ALL.3418  
!                                               (J. M. Edwards)                    RAD_ALL.3419  
!       4.1             10-06-96                New flag L_AEROSOL_CCN             RAD_ALL.3420  
!                                               introduced to allow                RAD_ALL.3421  
!                                               inclusion of indirect              RAD_ALL.3422  
!                                               aerosol forcing alone.             RAD_ALL.3423  
!                                               Correction of comments             RAD_ALL.3424  
!                                               for LCCWC1 and LCCWC2.             RAD_ALL.3425  
!                                               Correction of level at             RAD_ALL.3426  
!                                               which temperature for              RAD_ALL.3427  
!                                               partitioning                       RAD_ALL.3428  
!                                               convective homogeneously           RAD_ALL.3429  
!                                               mixed cloud is taken.              RAD_ALL.3430  
!                                               (J. M. Edwards)                    RAD_ALL.3431  
!       4.4             08-04-97                Changes for new precip             RAD_ALL.3432  
!                                               scheme (qCF prognostic)            RAD_ALL.3433  
!                                               (A. C. Bushell)                    RAD_ALL.3434  
!       4.4             15-09-97                A parametrization of               RAD_ALL.3435  
!                                               ice crystals with a                RAD_ALL.3436  
!                                               temperature dependedence           RAD_ALL.3437  
!                                               of the size has been               RAD_ALL.3438  
!                                               added.                             RAD_ALL.3439  
!                                               Explicit checking of               RAD_ALL.3440  
!                                               the sizes of particles             RAD_ALL.3441  
!                                               for the domain of                  RAD_ALL.3442  
!                                               validity of the para-              RAD_ALL.3443  
!                                               metrization has been               RAD_ALL.3444  
!                                               added.                             RAD_ALL.3445  
!                                               (J. M. Edwards)                    RAD_ALL.3446  
!                                                                                  RAD_ALL.3447  
! Description of Code:                                                             RAD_ALL.3448  
!   FORTRAN 77  with extensions listed in documentation.                           RAD_ALL.3449  
!                                                                                  RAD_ALL.3450  
!- ---------------------------------------------------------------------           RAD_ALL.3451  
      SUBROUTINE R2_SET_CLOUD_FIELD(N_PROFILE, NLEVS, NCLDS                        RAD_ALL.3452  
     &   , I_GATHER                                                                RAD_ALL.3453  
     &   , P, T, D_MASS                                                            RAD_ALL.3454  
     &   , CCB, CCT, CCA, CCCWP                                                    RAD_ALL.3455  
     &   , LCCWC1, LCCWC2, LCA                                                     RAD_ALL.3456  
     &   , L_MICROPHYSICS, L_AEROSOL_CCN                                           RAD_ALL.3457  
     &   , SULP_DIM1, SULP_DIM2, ACCUM_SULPHATE, DISS_SULPHATE                     RAD_ALL.3458  
     &   , L_CLOUD_WATER_PARTITION, LAND_G                                         RAD_ALL.3459  
     &   , I_CLOUD_REPRESENTATION, I_CONDENSED_PARAM                               RAD_ALL.3460  
     &   , CONDENSED_MIN_DIM, CONDENSED_MAX_DIM                                    RAD_ALL.3461  
     &   , N_CONDENSED, TYPE_CONDENSED                                             RAD_ALL.3462  
     &   , W_CLOUD, FRAC_CLOUD                                                     RAD_ALL.3463  
     &   , CONDENSED_MIX_RATIO, CONDENSED_DIM_CHAR                                 RAD_ALL.3464  
     &   , RE_CONV, RE_CONV_FLAG, RE_STRAT, RE_STRAT_FLAG                          RAD_ALL.3465  
     &   , WGT_CONV, WGT_CONV_FLAG, WGT_STRAT, WGT_STRAT_FLAG                      RAD_ALL.3466  
     &   , LWP_STRAT, LWP_STRAT_FLAG                                               RAD_ALL.3467  
     &   , NTOT_DIAG, NTOT_DIAG_FLAG                                               RAD_ALL.3468  
     &   , STRAT_LWC_DIAG, STRAT_LWC_DIAG_FLAG                                     RAD_ALL.3469  
     &   , SO4_CCN_DIAG, SO4_CCN_DIAG_FLAG                                         RAD_ALL.3470  
     &   , COND_SAMP_WGT, COND_SAMP_WGT_FLAG                                       RAD_ALL.3471  
     &   , NPD_FIELD, NPD_PROFILE, NPD_LAYER, NPD_AEROSOL_SPECIES                  RAD_ALL.3472  
     &   , N_CCA_LEV, L_3D_CCA                                                     RAD_ALL.3473  
     &   )                                                                         RAD_ALL.3474  
!                                                                                  RAD_ALL.3475  
!                                                                                  RAD_ALL.3476  
!                                                                                  RAD_ALL.3477  
      IMPLICIT NONE                                                                RAD_ALL.3478  
!                                                                                  RAD_ALL.3479  
!                                                                                  RAD_ALL.3480  
!     COMDECKS INCLUDED.                                                           RAD_ALL.3481  
!     ------------------------------------------------------------------           PRMCH3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       PRMCH3A.3     
!                                                                                  PRMCH3A.4     
!     MODULE FOR SETTING MACHINE PRECISION.                                        PRMCH3A.5     
!                                                                                  PRMCH3A.6     
      REAL                                                                         PRMCH3A.7     
     &     TOL_MACHINE                                                             PRMCH3A.8     
!             MACHINE TOLERANCE                                                    PRMCH3A.9     
     &   , SQRT_TOL_MACHINE                                                        PRMCH3A.10    
!             SQRT OF MACHINE TOLERANCE                                            PRMCH3A.11    
!                                                                                  PRMCH3A.12    
!                                                                                  PRMCH3A.13    
!     THE PRECISION SHOULD BE ABOUT 2/2^(SIZE OF SIGNIFICAND)                      PRMCH3A.14    
!                                                                                  PRMCH3A.15    
!     THE IEEE-FORMAT USES 53 BITS FOR THE SIGNIFICAND                             PRMCH3A.16    
!     IN DOUBLE PRECISION                                                          PRMCH3A.17    
!                                                                                  PRMCH3A.18    
!     THE CRAY FORMAT USES 47 BITS IN SINGLE PRECISION.                            PRMCH3A.19    
!                                                                                  PRMCH3A.20    
      PARAMETER(                                                                   PRMCH3A.21    
     &     TOL_MACHINE=1.42E-14                                                    PRMCH3A.22    
     &   , SQRT_TOL_MACHINE=1.19E-7                                                PRMCH3A.23    
     &   )                                                                         PRMCH3A.24    
!                                                                                  PRMCH3A.25    
!     ------------------------------------------------------------------           PRMCH3A.26    
!     ------------------------------------------------------------------           PRECSN3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       PRECSN3A.3     
!                                                                                  PRECSN3A.4     
!     MODULE FOR SETTING MACHINE-DEPENDENT TOLERANCES.                             PRECSN3A.5     
!     (THE COMDECK PRMCH3A MUST ALWAYS BE INCLUDED BEFORE THIS COMDECK.)           PRECSN3A.6     
!                                                                                  PRECSN3A.7     
      REAL                                                                         PRECSN3A.8     
     &     TOL_DIV                                                                 PRECSN3A.9     
!             TOLERANCE FOR DIVISION                                               PRECSN3A.10    
     &   , TOL_TEST                                                                PRECSN3A.11    
!             TOLERANCE FOR TESTING EQUALITY                                       PRECSN3A.12    
!                                                                                  PRECSN3A.13    
      PARAMETER(                                                                   PRECSN3A.14    
     &     TOL_DIV=3.2E+01*TOL_MACHINE                                             PRECSN3A.15    
     &   , TOL_TEST=1.6E+01*TOL_MACHINE                                            PRECSN3A.16    
     &   )                                                                         PRECSN3A.17    
!                                                                                  PRECSN3A.18    
!     ------------------------------------------------------------------           PRECSN3A.19    
!     ------------------------------------------------------------------           DIMFIX3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       DIMFIX3A.3     
!                                                                                  DIMFIX3A.4     
!     MODULE TO SET INTERNAL DIMENSIONS TIED TO ALGORITHMS,                        DIMFIX3A.5     
!     MOSTLY FOR CLOUDS.                                                           DIMFIX3A.6     
!                                                                                  DIMFIX3A.7     
      INTEGER                                                                      DIMFIX3A.8     
     &     NPD_CLOUD_COMPONENT                                                     DIMFIX3A.9     
!             NUMBER OF COMPONENTS OF CLOUDS                                       DIMFIX3A.10    
     &   , NPD_CLOUD_TYPE                                                          DIMFIX3A.11    
!             NUMBER OF PERMITTED TYPES OF CLOUDS.                                 DIMFIX3A.12    
     &   , NPD_CLOUD_REPRESENTATION                                                DIMFIX3A.13    
!             NUMBER OF PERMITTED REPRESENTATIONS OF CLOUDS.                       DIMFIX3A.14    
     &   , NPD_OVERLAP_COEFF                                                       DIMFIX3A.15    
!             NUMBER OF OVERLAP COEFFICIENTS FOR CLOUDS                            DIMFIX3A.16    
     &   , NPD_SOURCE_COEFF                                                        DIMFIX3A.17    
!             NUMBER OF COEFFICIENTS FOR TWO-STREAM SOURCES                        DIMFIX3A.18    
     &   , NPD_REGION                                                              DIMFIX3A.19    
!             NUMBER OF REGIONS IN A LAYER                                         DIMFIX3A.20    
!                                                                                  DIMFIX3A.21    
      PARAMETER(                                                                   DIMFIX3A.22    
     &     NPD_CLOUD_COMPONENT=4                                                   DIMFIX3A.23    
     &   , NPD_CLOUD_TYPE=4                                                        DIMFIX3A.24    
     &   , NPD_CLOUD_REPRESENTATION=4                                              DIMFIX3A.25    
     &   , NPD_OVERLAP_COEFF=18                                                    DIMFIX3A.26    
     &   , NPD_SOURCE_COEFF=2                                                      DIMFIX3A.27    
     &   , NPD_REGION=3                                                            DIMFIX3A.28    
     &   )                                                                         DIMFIX3A.29    
!                                                                                  DIMFIX3A.30    
!     ------------------------------------------------------------------           DIMFIX3A.31    
!     ------------------------------------------------------------------           CLDCMP3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       CLDCMP3A.3     
!                                                                                  CLDCMP3A.4     
!     MODULE TO SET COMPONENTS OF CLOUDS.                                          CLDCMP3A.5     
!                                                                                  CLDCMP3A.6     
      INTEGER                                                                      CLDCMP3A.7     
     &     IP_CLCMP_ST_WATER                                                       CLDCMP3A.8     
!             STRATIFORM WATER DROPLETS                                            CLDCMP3A.9     
     &   , IP_CLCMP_ST_ICE                                                         CLDCMP3A.10    
!             STRATIFORM ICE CRYSTALS                                              CLDCMP3A.11    
     &   , IP_CLCMP_CNV_WATER                                                      CLDCMP3A.12    
!             CONVECTIVE WATER DROPLETS                                            CLDCMP3A.13    
     &   , IP_CLCMP_CNV_ICE                                                        CLDCMP3A.14    
!             CONVECTIVE ICE CRYSTALS                                              CLDCMP3A.15    
!                                                                                  CLDCMP3A.16    
      PARAMETER(                                                                   CLDCMP3A.17    
     &     IP_CLCMP_ST_WATER=1                                                     CLDCMP3A.18    
     &   , IP_CLCMP_ST_ICE=2                                                       CLDCMP3A.19    
     &   , IP_CLCMP_CNV_WATER=3                                                    CLDCMP3A.20    
     &   , IP_CLCMP_CNV_ICE=4                                                      CLDCMP3A.21    
     &   )                                                                         CLDCMP3A.22    
!                                                                                  CLDCMP3A.23    
!     ------------------------------------------------------------------           CLDCMP3A.24    
!     ------------------------------------------------------------------           CLDTYP3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       CLDTYP3A.3     
!                                                                                  CLDTYP3A.4     
!     MODULE TO SET TYPES OF CLOUDS.                                               CLDTYP3A.5     
!                                                                                  CLDTYP3A.6     
      INTEGER                                                                      CLDTYP3A.7     
     &     IP_CLOUD_TYPE_HOMOGEN                                                   CLDTYP3A.8     
!             CLOUD COMPOSED OF MIXED WATER AND ICE                                CLDTYP3A.9     
     &   , IP_CLOUD_TYPE_WATER                                                     CLDTYP3A.10    
!             CLOUD COMPOSED ONLY OF WATER                                         CLDTYP3A.11    
     &   , IP_CLOUD_TYPE_ICE                                                       CLDTYP3A.12    
!             CLOUD COMPOSED ONLY OF ICE                                           CLDTYP3A.13    
     &   , IP_CLOUD_TYPE_STRAT                                                     CLDTYP3A.14    
!             MIXED-PHASE STRATIFORM CLOUD                                         CLDTYP3A.15    
     &   , IP_CLOUD_TYPE_CONV                                                      CLDTYP3A.16    
!             MIXED-PHASE CONVECTIVE CLOUD                                         CLDTYP3A.17    
     &   , IP_CLOUD_TYPE_SW                                                        CLDTYP3A.18    
!             STRATIFORM WATER CLOUD                                               CLDTYP3A.19    
     &   , IP_CLOUD_TYPE_SI                                                        CLDTYP3A.20    
!             STRATIFORM ICE CLOUD                                                 CLDTYP3A.21    
     &   , IP_CLOUD_TYPE_CW                                                        CLDTYP3A.22    
!             CONVECTIVE WATER CLOUD                                               CLDTYP3A.23    
     &   , IP_CLOUD_TYPE_CI                                                        CLDTYP3A.24    
!             CONVECTIVE ICE CLOUD                                                 CLDTYP3A.25    
!                                                                                  CLDTYP3A.26    
      PARAMETER(                                                                   CLDTYP3A.27    
     &     IP_CLOUD_TYPE_HOMOGEN=1                                                 CLDTYP3A.28    
     &   , IP_CLOUD_TYPE_WATER=1                                                   CLDTYP3A.29    
     &   , IP_CLOUD_TYPE_ICE=2                                                     CLDTYP3A.30    
     &   , IP_CLOUD_TYPE_STRAT=1                                                   CLDTYP3A.31    
     &   , IP_CLOUD_TYPE_CONV=2                                                    CLDTYP3A.32    
     &   , IP_CLOUD_TYPE_SW=1                                                      CLDTYP3A.33    
     &   , IP_CLOUD_TYPE_SI=2                                                      CLDTYP3A.34    
     &   , IP_CLOUD_TYPE_CW=3                                                      CLDTYP3A.35    
     &   , IP_CLOUD_TYPE_CI=4                                                      CLDTYP3A.36    
     &   )                                                                         CLDTYP3A.37    
!                                                                                  CLDTYP3A.38    
!     ------------------------------------------------------------------           CLDTYP3A.39    
!     ------------------------------------------------------------------           CLREPP3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       CLREPP3A.3     
!                                                                                  CLREPP3A.4     
!     MODULE TO SET REPRESENTATIONS OF CLOUDS.                                     CLREPP3A.5     
!                                                                                  CLREPP3A.6     
!     REPRESENTATIONS                                                              CLREPP3A.7     
      INTEGER                                                                      CLREPP3A.8     
     &     IP_CLOUD_HOMOGEN                                                        CLREPP3A.9     
!             ALL COMPONENTS ARE MIXED HOMOGENEOUSLY                               CLREPP3A.10    
     &   , IP_CLOUD_ICE_WATER                                                      CLREPP3A.11    
!             ICE AND WATER CLOUDS ARE TREATED SEPARATELY                          CLREPP3A.12    
     &   , IP_CLOUD_CONV_STRAT                                                     CLREPP3A.13    
!             CLOUDS ARE DIVIDED INTO HOMOGENEOUSLY MIXED                          CLREPP3A.14    
!             STRATIFORM AND CONVECTIVE PARTS                                      CLREPP3A.15    
     &   , IP_CLOUD_CSIW                                                           CLREPP3A.16    
!             CLOUDS DIVIDED INTO ICE AND WATER PHASES AND                         CLREPP3A.17    
!             INTO STRATIFORM AND CONVECTIVE COMPONENTS.                           CLREPP3A.18    
!                                                                                  CLREPP3A.19    
      PARAMETER(                                                                   CLREPP3A.20    
     &     IP_CLOUD_HOMOGEN=1                                                      CLREPP3A.21    
     &   , IP_CLOUD_ICE_WATER=2                                                    CLREPP3A.22    
     &   , IP_CLOUD_CONV_STRAT=3                                                   CLREPP3A.23    
     &   , IP_CLOUD_CSIW=4                                                         CLREPP3A.24    
     &   )                                                                         CLREPP3A.25    
!                                                                                  CLREPP3A.26    
!     TYPES OF CLOUDS:                                                             CLREPP3A.27    
      INTEGER                                                                      CLREPP3A.28    
     &     NP_CLOUD_TYPE(NPD_CLOUD_REPRESENTATION)                                 CLREPP3A.29    
!             NUMBER OF TYPE OF CLOUDS IN REPRESENTATION                           CLREPP3A.30    
!                                                                                  CLREPP3A.31    
      INTEGER                                                                      CLREPP3A.32    
     &     IP_CLOUD_TYPE_MAP(NPD_CLOUD_COMPONENT                                   CLREPP3A.33    
     &       , NPD_CLOUD_REPRESENTATION)                                           CLREPP3A.34    
!            MAP OF COMPONENTS CONTRIBUTING TO TYPES OF CLOUDS                     CLREPP3A.35    
!                                                                                  CLREPP3A.36    
!     ------------------------------------------------------------------           CLREPP3A.37    
!     ------------------------------------------------------------------           ICLPRM3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       ICLPRM3A.3     
!                                                                                  ICLPRM3A.4     
!     MODULE TO SET NUMBERS FOR ICE CLOUD SCHEMES.                                 ICLPRM3A.5     
!                                                                                  ICLPRM3A.6     
      INTEGER                                                                      ICLPRM3A.7     
     &     NPD_ICE_CLOUD_FIT                                                       ICLPRM3A.8     
!             NUMBER OF CLOUD FITTING SCHEMES                                      ICLPRM3A.9     
     &   , IP_SLINGO_SCHRECKER_ICE                                                 ICLPRM3A.10    
!             PARAMETRIZATION OF SLINGO AND SCHRECKER.                             ICLPRM3A.11    
     &   , IP_ICE_UNPARAMETRIZED                                                   ICLPRM3A.12    
!             UNPARAMETRIZED ICE CRYSTAL DATA                                      ICLPRM3A.13    
     &   , IP_SUN_SHINE_VN2_VIS                                                    ICLPRM3A.14    
!             SUN AND SHINE'S PARAMETRIZATION IN THE VISIBLE (VERSION 2)           ICLPRM3A.15    
     &   , IP_SUN_SHINE_VN2_IR                                                     ICLPRM3A.16    
!             SUN AND SHINE'S PARAMETRIZATION IN THE IR (VERSION 2)                ICLPRM3A.17    
     &   , IP_ICE_ADT                                                              ICLPRM3A.18    
!             SCHEME BASED ON ANOMALOUS DIFFRACTION THEORY                         ICLPRM3A.19    
!             FOR ICE CRYSTALS                                                     ICLPRM3A.20    
                                                                                   ICLPRM3A.21    
!                                                                                  ICLPRM3A.22    
      PARAMETER(                                                                   ICLPRM3A.23    
     &     NPD_ICE_CLOUD_FIT=6                                                     ICLPRM3A.24    
     &   , IP_SLINGO_SCHRECKER_ICE=1                                               ICLPRM3A.25    
     &   , IP_ICE_UNPARAMETRIZED=3                                                 ICLPRM3A.26    
     &   , IP_SUN_SHINE_VN2_VIS=4                                                  ICLPRM3A.27    
     &   , IP_SUN_SHINE_VN2_IR=5                                                   ICLPRM3A.28    
     &   , IP_ICE_ADT=6                                                            ICLPRM3A.29    
     &   )                                                                         ICLPRM3A.30    
!                                                                                  ICLPRM3A.31    
!     ------------------------------------------------------------------           ICLPRM3A.32    
C*L------------------COMDECK C_O_DG_C-----------------------------------           C_0_DG_C.2     
C ZERODEGC IS CONVERSION BETWEEN DEGREES CELSIUS AND KELVIN                        C_0_DG_C.3     
C TFS IS TEMPERATURE AT WHICH SEA WATER FREEZES                                    C_0_DG_C.4     
C TM IS TEMPERATURE AT WHICH FRESH WATER FREEZES AND ICE MELTS                     C_0_DG_C.5     
      REAL ZERODEGC,TFS,TM                                                         C_0_DG_C.6     
                                                                                   C_0_DG_C.7     
      PARAMETER(ZERODEGC=273.15,                                                   C_0_DG_C.8     
     &          TFS=271.35,                                                        C_0_DG_C.9     
     &          TM=273.15)                                                         C_0_DG_C.10    
C*----------------------------------------------------------------------           C_0_DG_C.11    
                                                                                   C_0_DG_C.12    
C*L------------------COMDECK C_R_CP-------------------------------------           C_R_CP.2     
C R IS GAS CONSTANT FOR DRY AIR                                                    C_R_CP.3     
C CP IS SPECIFIC HEAT OF DRY AIR AT CONSTANT PRESSURE                              C_R_CP.4     
C PREF IS REFERENCE SURFACE PRESSURE                                               C_R_CP.5     
      REAL R,CP,KAPPA,PREF  ! PREFTOKI                                             C_R_CP.6     
                                                                                   C_R_CP.7     
      PARAMETER(R=287.05,                                                          C_R_CP.8     
     &          CP=1005.,                                                          C_R_CP.9     
     &          KAPPA=R/CP,                                                        C_R_CP.10    
     &          PREF=100000.)                                                      C_R_CP.11    
C*----------------------------------------------------------------------           C_R_CP.12    
                                                                                   C_R_CP.13    
!                                                                                  RAD_ALL.3491  
!                                                                                  RAD_ALL.3492  
!     DIMENSIONS OF ARRAYS:                                                        RAD_ALL.3493  
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.3494  
     &     NPD_FIELD                                                               RAD_ALL.3495  
!             FIELD SIZE IN CALLING PROGRAM                                        RAD_ALL.3496  
     &   , NPD_PROFILE                                                             RAD_ALL.3497  
!             SIZE OF ARRAY OF PROFILES                                            RAD_ALL.3498  
     &   , NPD_LAYER                                                               RAD_ALL.3499  
!             MAXIMUM NUMBER OF LAYERS                                             RAD_ALL.3500  
     &   , NPD_AEROSOL_SPECIES                                                     RAD_ALL.3501  
!             MAXIMUM NUMBER OF AEROSOL_SPECIES                                    RAD_ALL.3502  
     &   , SULP_DIM1                                                               RAD_ALL.3503  
!             1ST DIMENSION OF ARRAYS OF SULPHATE                                  RAD_ALL.3504  
     &   , SULP_DIM2                                                               RAD_ALL.3505  
!             2ND DIMENSION OF ARRAYS OF SULPHATE                                  RAD_ALL.3506  
     &   , N_CCA_LEV                                                               RAD_ALL.3507  
!             NUMBER OF LEVELS FOR CONVECTIVE CLOUD AMOUNT                         RAD_ALL.3508  
!                                                                                  RAD_ALL.3509  
!     ACTUAL SIZES USED:                                                           RAD_ALL.3510  
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.3511  
     &     N_PROFILE                                                               RAD_ALL.3512  
!             NUMBER OF PROFILES                                                   RAD_ALL.3513  
     &   , NLEVS                                                                   RAD_ALL.3514  
!             NUMBER OF ATMOSPHERIC LAYERS                                         RAD_ALL.3515  
     &   , NCLDS                                                                   RAD_ALL.3516  
!             NUMBER OF CLOUDY LEVELS                                              RAD_ALL.3517  
!                                                                                  RAD_ALL.3518  
!     GATHERING ARRAY:                                                             RAD_ALL.3519  
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.3520  
     &     I_GATHER(NPD_FIELD)                                                     RAD_ALL.3521  
!             LIST OF POINTS TO BE GATHERED                                        RAD_ALL.3522  
!                                                                                  RAD_ALL.3523  
!     THERMODYNAMIC FIELDS:                                                        RAD_ALL.3524  
      REAL      !, INTENT(IN)                                                      RAD_ALL.3525  
     &     P(NPD_PROFILE, 0: NPD_LAYER)                                            RAD_ALL.3526  
!             PRESSURES                                                            RAD_ALL.3527  
     &   , T(NPD_PROFILE, 0: NPD_LAYER)                                            RAD_ALL.3528  
!             TEMPERATURES                                                         RAD_ALL.3529  
     &   , D_MASS(NPD_PROFILE, NPD_LAYER)                                          RAD_ALL.3530  
!             MASS THICKNESSES OF LAYERS                                           RAD_ALL.3531  
!                                                                                  RAD_ALL.3532  
!     CONVECTIVE CLOUDS:                                                           RAD_ALL.3533  
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.3534  
     &     CCB(NPD_FIELD)                                                          RAD_ALL.3535  
!             BASE OF CONVECTIVE CLOUD                                             RAD_ALL.3536  
     &   , CCT(NPD_FIELD)                                                          RAD_ALL.3537  
!             TOP OF CONVECTIVE CLOUD                                              RAD_ALL.3538  
      REAL      !, INTENT(IN)                                                      RAD_ALL.3539  
     &     CCA(NPD_FIELD,N_CCA_LEV)                                                RAD_ALL.3540  
!             FRACTION OF CONVECTIVE CLOUD                                         RAD_ALL.3541  
     &   , CCCWP(NPD_FIELD)                                                        RAD_ALL.3542  
!             WATER PATH OF CONVECTIVE CLOUD                                       RAD_ALL.3543  
      LOGICAL   !, INTENT(IN)                                                      RAD_ALL.3544  
     &     L_3D_CCA                                                                RAD_ALL.3545  
!                                                                                  RAD_ALL.3546  
!     LAYER CLOUDS:                                                                RAD_ALL.3547  
      REAL      !, INTENT(IN)                                                      RAD_ALL.3548  
     &     LCCWC1(NPD_FIELD, NCLDS+1/(NCLDS+1))                                    RAD_ALL.3549  
!             LIQUID WATER CONTENTS                                                RAD_ALL.3550  
     &   , LCCWC2(NPD_FIELD, NCLDS+1/(NCLDS+1))                                    RAD_ALL.3551  
!             ICE WATER CONTENTS                                                   RAD_ALL.3552  
     &   , LCA(NPD_FIELD, NCLDS+1/(NCLDS+1))                                       RAD_ALL.3553  
!             FRACTIONS OF LAYER CLOUDS                                            RAD_ALL.3554  
!                                                                                  RAD_ALL.3555  
!     ARRAYS FOR MICROPHYSICS:                                                     RAD_ALL.3556  
      LOGICAL   !, INTENT(IN)                                                      RAD_ALL.3557  
     &     L_MICROPHYSICS                                                          RAD_ALL.3558  
!             MICROPHYSICAL FLAG                                                   RAD_ALL.3559  
     &   , L_AEROSOL_CCN                                                           RAD_ALL.3560  
!             FLAG TO USE AEROSOLS TO FIND CCN                                     RAD_ALL.3561  
     &   , L_CLOUD_WATER_PARTITION                                                 RAD_ALL.3562  
!             FLAG TO USE PROGNOSTIC CLOUD ICE CONTENTS                            RAD_ALL.3563  
     &   , LAND_G(NPD_PROFILE)                                                     RAD_ALL.3564  
!             FLAG FOR LAND POINTS                                                 RAD_ALL.3565  
      REAL      !, INTENT(IN)                                                      RAD_ALL.3566  
     &     ACCUM_SULPHATE(SULP_DIM1, SULP_DIM2)                                    RAD_ALL.3567  
!             MIXING RATIOS OF ACCUMULATION-MODE SULPHATE                          RAD_ALL.3568  
     &   , DISS_SULPHATE(SULP_DIM1, SULP_DIM2)                                     RAD_ALL.3569  
!             MIXING RATIOS OF DISSOLVED SULPHATE                                  RAD_ALL.3570  
!                                                                                  RAD_ALL.3571  
!     REPRESENTATION OF CLOUDS                                                     RAD_ALL.3572  
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.3573  
     &     I_CLOUD_REPRESENTATION                                                  RAD_ALL.3574  
!             REPRESENTATION OF CLOUDS                                             RAD_ALL.3575  
!                                                                                  RAD_ALL.3576  
!     PARAMETRIZATIONS FOR CLOUDS:                                                 RAD_ALL.3577  
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.3578  
     &     I_CONDENSED_PARAM(NPD_CLOUD_COMPONENT)                                  RAD_ALL.3579  
!             TYPES OF PARAMETRIZATION USED FOR CONDENSED                          RAD_ALL.3580  
!             COMPONENTS IN CLOUDS                                                 RAD_ALL.3581  
!     LIMITS ON SIZES OF PARTICLES                                                 RAD_ALL.3582  
      REAL      !, INTENT(IN)                                                      RAD_ALL.3583  
     &     CONDENSED_MIN_DIM(NPD_CLOUD_COMPONENT)                                  RAD_ALL.3584  
!             MINIMUM DIMENSION OF EACH CONDENSED COMPONENT                        RAD_ALL.3585  
     &   , CONDENSED_MAX_DIM(NPD_CLOUD_COMPONENT)                                  RAD_ALL.3586  
!             MAXIMUM DIMENSION OF EACH CONDENSED COMPONENT                        RAD_ALL.3587  
!                                                                                  RAD_ALL.3588  
!     ASSIGNED CLOUD FIELDS:                                                       RAD_ALL.3589  
      INTEGER   !, INTENT(OUT)                                                     RAD_ALL.3590  
     &     N_CONDENSED                                                             RAD_ALL.3591  
!             NUMBER OF CONDENSED COMPONENTS                                       RAD_ALL.3592  
     &   , TYPE_CONDENSED(NPD_CLOUD_COMPONENT)                                     RAD_ALL.3593  
!             TYPES OF CONDENSED COMPONENTS                                        RAD_ALL.3594  
      REAL      !, INTENT(OUT)                                                     RAD_ALL.3595  
     &     W_CLOUD(NPD_PROFILE, NPD_LAYER)                                         RAD_ALL.3596  
!             TOTAL AMOUNTS OF CLOUD                                               RAD_ALL.3597  
     &   , FRAC_CLOUD(NPD_PROFILE, NPD_LAYER, NPD_CLOUD_TYPE)                      RAD_ALL.3598  
!             FRACTION OF EACH TYPE OF CLOUD                                       RAD_ALL.3599  
     &   , CONDENSED_DIM_CHAR(NPD_PROFILE, 0: NPD_LAYER                            RAD_ALL.3600  
     &      , NPD_CLOUD_COMPONENT)                                                 RAD_ALL.3601  
!             CHARACTERISTIC DIMENSIONS OF CLOUDY COMPONENTS                       RAD_ALL.3602  
     &   , CONDENSED_MIX_RATIO(NPD_PROFILE, 0: NPD_LAYER                           RAD_ALL.3603  
     &      , NPD_CLOUD_COMPONENT)                                                 RAD_ALL.3604  
!             MASS MIXING RATIOS OF CONDENSED COMPONENTS                           RAD_ALL.3605  
     &   , NTOT_DIAG_G(NPD_PROFILE, NPD_LAYER)                                     RAD_ALL.3606  
!             DIAGNOSTIC ARRAY FOR NTOT (GATHERED)                                 RAD_ALL.3607  
     &   , STRAT_LWC_DIAG_G(NPD_PROFILE, NPD_LAYER)                                RAD_ALL.3608  
!             DIAGNOSTIC ARRAY FOR STRATIFORM LWC (GATHERED)                       RAD_ALL.3609  
     &   , SO4_CCN_DIAG_G(NPD_PROFILE, NPD_LAYER)                                  RAD_ALL.3610  
!             DIAGNOSTIC ARRAY FOR SO4 CCN MASS CONC (GATHERED)                    RAD_ALL.3611  
!                                                                                  RAD_ALL.3612  
!                                                                                  RAD_ALL.3613  
!     MICROPHYSICAL DIAGNOSTICS:                                                   RAD_ALL.3614  
      LOGICAL                                                                      RAD_ALL.3615  
     &     RE_CONV_FLAG                                                            RAD_ALL.3616  
!             DIAGNOSE EFFECTIVE RADIUS*WEIGHT FOR CONVECTIVE CLOUD                RAD_ALL.3617  
     &   , RE_STRAT_FLAG                                                           RAD_ALL.3618  
!             DIAGNOSE EFFECTIVE RADIUS*WEIGHT FOR STRATIFORM CLOUD                RAD_ALL.3619  
     &   , WGT_CONV_FLAG                                                           RAD_ALL.3620  
!             DIAGNOSE WEIGHT FOR CONVECTIVE CLOUD                                 RAD_ALL.3621  
     &   , WGT_STRAT_FLAG                                                          RAD_ALL.3622  
!             DIAGNOSE WEIGHT FOR STRATIFORM CLOUD                                 RAD_ALL.3623  
     &   , LWP_STRAT_FLAG                                                          RAD_ALL.3624  
!             DIAGNOSE LIQUID WATER PATH*WEIGHT FOR STRATIFORM CLOUD               RAD_ALL.3625  
     &   , NTOT_DIAG_FLAG                                                          RAD_ALL.3626  
!             DIAGNOSE DROPLET CONCENTRATION*WEIGHT                                RAD_ALL.3627  
     &   , STRAT_LWC_DIAG_FLAG                                                     RAD_ALL.3628  
!             DIAGNOSE STRATIFORM LWC*WEIGHT                                       RAD_ALL.3629  
     &   , SO4_CCN_DIAG_FLAG                                                       RAD_ALL.3630  
!             DIAGNOSE SO4 CCN MASS CONC*COND. SAMP. WEIGHT                        RAD_ALL.3631  
     &   , COND_SAMP_WGT_FLAG                                                      RAD_ALL.3632  
!             DIAGNOSE CONDITIONAL SAMPLING WEIGHT                                 RAD_ALL.3633  
!                                                                                  RAD_ALL.3634  
      REAL                                                                         RAD_ALL.3635  
     &     RE_CONV(NPD_FIELD, NCLDS)                                               RAD_ALL.3636  
!             EFFECTIVE RADIUS*WEIGHT FOR CONVECTIVE CLOUD                         RAD_ALL.3637  
     &   , RE_STRAT(NPD_FIELD, NCLDS)                                              RAD_ALL.3638  
!             EFFECTIVE RADIUS*WEIGHT FOR STRATIFORM CLOUD                         RAD_ALL.3639  
     &   , WGT_CONV(NPD_FIELD, NCLDS)                                              RAD_ALL.3640  
!             WEIGHT FOR CONVECTIVE CLOUD                                          RAD_ALL.3641  
     &   , WGT_STRAT(NPD_FIELD, NCLDS)                                             RAD_ALL.3642  
!             WEIGHT FOR STRATIFORM CLOUD                                          RAD_ALL.3643  
     &   , LWP_STRAT(NPD_FIELD, NCLDS)                                             RAD_ALL.3644  
!             LIQUID WATER PATH*WEIGHT FOR STRATIFORM CLOUD                        RAD_ALL.3645  
     &   , NTOT_DIAG(NPD_FIELD, NCLDS)                                             RAD_ALL.3646  
!             DROPLET CONCENTRATION*WEIGHT                                         RAD_ALL.3647  
     &   , STRAT_LWC_DIAG(NPD_FIELD, NCLDS)                                        RAD_ALL.3648  
!             STRATIFORM LWC*WEIGHT                                                RAD_ALL.3649  
     &   , SO4_CCN_DIAG(NPD_FIELD, NCLDS)                                          RAD_ALL.3650  
!             SO4 CCN MASS CONC*COND. SAMP. WEIGHT                                 RAD_ALL.3651  
     &   , COND_SAMP_WGT(NPD_FIELD, NCLDS)                                         RAD_ALL.3652  
!             CONDITIONAL SAMPLING WEIGHT                                          RAD_ALL.3653  
!                                                                                  RAD_ALL.3654  
!                                                                                  RAD_ALL.3655  
!                                                                                  RAD_ALL.3656  
!     LOCAL VARIABLES:                                                             RAD_ALL.3657  
      INTEGER                                                                      RAD_ALL.3658  
     &     I                                                                       RAD_ALL.3659  
!             LOOP VARIABLE                                                        RAD_ALL.3660  
     &   , J                                                                       RAD_ALL.3661  
!             LOOP VARIABLE                                                        RAD_ALL.3662  
     &   , L                                                                       RAD_ALL.3663  
!             LOOP VARIABLE                                                        RAD_ALL.3664  
     &   , LG                                                                      RAD_ALL.3665  
!             INDEX TO GATHER                                                      RAD_ALL.3666  
!                                                                                  RAD_ALL.3667  
      REAL                                                                         RAD_ALL.3668  
     &     LIQ_FRAC(NPD_PROFILE)                                                   RAD_ALL.3669  
!             FRACTION OF LIQUID CLOUD WATER                                       RAD_ALL.3670  
     &   , LIQ_FRAC_CONV(NPD_PROFILE)                                              RAD_ALL.3671  
!             FRACTION OF LIQUID WATER IN CONVECTIVE CLOUD                         RAD_ALL.3672  
     &   , T_GATHER(NPD_PROFILE)                                                   RAD_ALL.3673  
!             GATHERED TEMPERATURE FOR LSP_FOCWWIL                                 RAD_ALL.3674  
     &   , T_LIST(NPD_PROFILE)                                                     RAD_ALL.3675  
!             LIST OF TEMPERATURES                                                 RAD_ALL.3676  
     &   , TOTAL_MASS(NPD_PROFILE)                                                 RAD_ALL.3677  
!             TOTAL MASS IN CONVECTIVE CLOUD                                       RAD_ALL.3678  
     &   , CC_DEPTH(NPD_PROFILE)                                                   RAD_ALL.3679  
!             DEPTH OF CONVECTIVE CLOUD                                            RAD_ALL.3680  
     &   , DENSITY_AIR(NPD_PROFILE, NPD_LAYER)                                     RAD_ALL.3681  
!             DENSITY OF AIR                                                       RAD_ALL.3682  
     &   , CONVECTIVE_CLOUD_LAYER(NPD_PROFILE)                                     RAD_ALL.3683  
!             AMOUNT OF CONVECTIVE CLOUD IN TH CURRENT LAYER                       RAD_ALL.3684  
     &   , CONVECTIVE_CLOUD_WATER_PATH(NPD_PROFILE)                                RAD_ALL.3685  
!             WATER PATH IN CONVECTIVE CLOUD                                       RAD_ALL.3686  
     &   , CONVECTIVE_CLOUD_ICE_PATH(NPD_PROFILE)                                  RAD_ALL.3687  
!             WATER PATH IN CONVECTIVE CLOUD                                       RAD_ALL.3688  
     &   , MEAN_WATER_CONTENT                                                      RAD_ALL.3689  
!             MEAN WATER CONTENT                                                   RAD_ALL.3690  
     &   , MEAN_ICE_CONTENT                                                        RAD_ALL.3691  
!             MEAN ICE CONTENT                                                     RAD_ALL.3692  
     &   , CONDENSED_LIMIT                                                         RAD_ALL.3693  
!             LOWER LIMIT ON WATER CONTENTS                                        RAD_ALL.3694  
!                                                                                  RAD_ALL.3695  
      PARAMETER(CONDENSED_LIMIT=1.E-8)                                             RAD_ALL.3696  
!                                                                                  RAD_ALL.3697  
!                                                                                  RAD_ALL.3698  
!                                                                                  RAD_ALL.3699  
!     CHECK THE LIMITS FOR CONVECTIVE CLOUD.                                       RAD_ALL.3700  
      DO L=1, N_PROFILE                                                            RAD_ALL.3701  
         LG=I_GATHER(L)                                                            RAD_ALL.3702  
         IF ( (CCB(LG).GT.NCLDS).OR.(CCB(LG).LT.1) ) CCB(LG)=1                     RAD_ALL.3703  
         IF ( (CCT(LG).GT.NCLDS+1).OR.(CCT(LG).LT.2) ) CCT(LG)=NCLDS+1             RAD_ALL.3704  
         IF (L_3D_CCA) THEN                                                        RAD_ALL.3705  
           IF (CCA(LG,CCB(LG)).LT.TOL_TEST) CCCWP(LG)=0.0E+00                      RAD_ALL.3706  
         ELSE                                                                      RAD_ALL.3707  
           IF (CCA(LG,1).LT.TOL_TEST) CCCWP(LG)=0.0E+00                            RAD_ALL.3708  
         ENDIF                                                                     RAD_ALL.3709  
      ENDDO                                                                        RAD_ALL.3710  
!                                                                                  RAD_ALL.3711  
!                                                                                  RAD_ALL.3712  
!     SET THE COMPONENTS WITHIN THE CLOUDS. IN THE UNIFIED MODEL WE                RAD_ALL.3713  
!     HAVE FOUR COMPONENTS: STRATIFORM ICE AND WATER AND CONVECTIVE                RAD_ALL.3714  
!     ICE AND WATER.                                                               RAD_ALL.3715  
      N_CONDENSED=4                                                                RAD_ALL.3716  
      TYPE_CONDENSED(1)=IP_CLCMP_ST_WATER                                          RAD_ALL.3717  
      TYPE_CONDENSED(2)=IP_CLCMP_ST_ICE                                            RAD_ALL.3718  
      TYPE_CONDENSED(3)=IP_CLCMP_CNV_WATER                                         RAD_ALL.3719  
      TYPE_CONDENSED(4)=IP_CLCMP_CNV_ICE                                           RAD_ALL.3720  
!                                                                                  RAD_ALL.3721  
!                                                                                  RAD_ALL.3722  
!                                                                                  RAD_ALL.3723  
!     SET THE TOTAL AMOUNTS OF CLOUD AND THE FRACTIONS COMPRISED BY                RAD_ALL.3724  
!     CONVECTIVE AND STRATIFORM COMPONENTS.                                        RAD_ALL.3725  
!                                                                                  RAD_ALL.3726  
!     ZERO THE AMOUNTS OF CLOUD IN THE UPPER LAYERS.                               RAD_ALL.3727  
      DO I=1, NLEVS-NCLDS                                                          RAD_ALL.3728  
         DO L=1, N_PROFILE                                                         RAD_ALL.3729  
            W_CLOUD(L, I)=0.0E+00                                                  RAD_ALL.3730  
         ENDDO                                                                     RAD_ALL.3731  
      ENDDO                                                                        RAD_ALL.3732  
!                                                                                  RAD_ALL.3733  
      IF (I_CLOUD_REPRESENTATION.EQ.IP_CLOUD_CONV_STRAT .AND.                      RAD_ALL.3734  
     &    .NOT. L_CLOUD_WATER_PARTITION) THEN                                      RAD_ALL.3735  
!  This cloud representation not available with new cloud microphysics             RAD_ALL.3736  
!                                                                                  RAD_ALL.3737  
!        THE CLOUDS ARE DIVIDED INTO MIXED-PHASE STRATIFORM AND                    RAD_ALL.3738  
!        CONVECTIVE CLOUDS: FOCCWIL GIVES THE PARTITIONING BETWEEN                 RAD_ALL.3739  
!        THE MIXING RATIOS OF ICE AND WATER. WITHIN CONVECTIVE CLOUD               RAD_ALL.3740  
!        THE LIQUID WATER CONTENT IS DISTRIBUTED UNIFORMLY THROUGHOUT              RAD_ALL.3741  
!        THE CLOUD.                                                                RAD_ALL.3742  
!                                                                                  RAD_ALL.3743  
!        CONVECTIVE CLOUD:                                                         RAD_ALL.3744  
!                                                                                  RAD_ALL.3745  
         DO I=NLEVS+1-NCLDS, NLEVS                                                 RAD_ALL.3746  
            DO L=1, N_PROFILE                                                      RAD_ALL.3747  
               CONDENSED_MIX_RATIO(L, I, IP_CLCMP_CNV_WATER)=0.0E+00               RAD_ALL.3748  
               CONDENSED_MIX_RATIO(L, I, IP_CLCMP_CNV_ICE)=0.0E+00                 RAD_ALL.3749  
            ENDDO                                                                  RAD_ALL.3750  
         ENDDO                                                                     RAD_ALL.3751  
!                                                                                  RAD_ALL.3752  
!        PARTITION BETWEEN ICE AND WATER AS DIRECTED BY THE TEMPERATURE            RAD_ALL.3753  
!        IN THE MIDDLE OF THE TOP LAYER OF THE CLOUD.                              RAD_ALL.3754  
!                                                                                  RAD_ALL.3755  
         DO L=1, N_PROFILE                                                         RAD_ALL.3756  
            T_GATHER(L)=T(L, NLEVS+2-CCT(I_GATHER(L)))                             RAD_ALL.3757  
         ENDDO                                                                     RAD_ALL.3758  
         CALL LSP_FOCWWIL(T_GATHER, N_PROFILE, LIQ_FRAC_CONV)                      RAD_ALL.3759  
         DO L=1, N_PROFILE                                                         RAD_ALL.3760  
            LG=I_GATHER(L)                                                         RAD_ALL.3761  
            CONVECTIVE_CLOUD_WATER_PATH(L)=CCCWP(LG)*LIQ_FRAC_CONV(L)              RAD_ALL.3762  
            CONVECTIVE_CLOUD_ICE_PATH(L)=CCCWP(LG)                                 RAD_ALL.3763  
     &         *(1.0E+00-LIQ_FRAC_CONV(L))                                         RAD_ALL.3764  
            TOTAL_MASS(L)=0.0E+00                                                  RAD_ALL.3765  
         ENDDO                                                                     RAD_ALL.3766  
!                                                                                  RAD_ALL.3767  
         DO I=NLEVS+1-NCLDS, NLEVS                                                 RAD_ALL.3768  
            DO L=1, N_PROFILE                                                      RAD_ALL.3769  
               LG=I_GATHER(L)                                                      RAD_ALL.3770  
               IF ( (CCT(LG).GE.NLEVS+2-I).AND.                                    RAD_ALL.3771  
     &              (CCB(LG).LE.NLEVS+1-I) ) THEN                                  RAD_ALL.3772  
                  TOTAL_MASS(L)=TOTAL_MASS(L)+D_MASS(L, I)                         RAD_ALL.3773  
               ENDIF                                                               RAD_ALL.3774  
            ENDDO                                                                  RAD_ALL.3775  
         ENDDO                                                                     RAD_ALL.3776  
         DO I=NLEVS+1-NCLDS, NLEVS                                                 RAD_ALL.3777  
            DO L=1, N_PROFILE                                                      RAD_ALL.3778  
               LG=I_GATHER(L)                                                      RAD_ALL.3779  
               IF ( (CCT(LG).GE.NLEVS+2-I).AND.                                    RAD_ALL.3780  
     &              (CCB(LG).LE.NLEVS+1-I) ) THEN                                  RAD_ALL.3781  
                  CONDENSED_MIX_RATIO(L, I, IP_CLCMP_CNV_WATER)                    RAD_ALL.3782  
     &               =CONVECTIVE_CLOUD_WATER_PATH(L)                               RAD_ALL.3783  
     &               /(TOTAL_MASS(L)+TOL_MACHINE)                                  RAD_ALL.3784  
                  CONDENSED_MIX_RATIO(L, I, IP_CLCMP_CNV_ICE)                      RAD_ALL.3785  
     &               =CONVECTIVE_CLOUD_ICE_PATH(L)                                 RAD_ALL.3786  
     &               /(TOTAL_MASS(L)+TOL_MACHINE)                                  RAD_ALL.3787  
               ENDIF                                                               RAD_ALL.3788  
            ENDDO                                                                  RAD_ALL.3789  
         ENDDO                                                                     RAD_ALL.3790  
!                                                                                  RAD_ALL.3791  
!                                                                                  RAD_ALL.3792  
!        STRATIFORM CLOUDS:                                                        RAD_ALL.3793  
!                                                                                  RAD_ALL.3794  
!        PARTITION BETWEEN ICE AND WATER DEPENDING ON THE                          RAD_ALL.3795  
!        LOCAL TEMPERATURE.                                                        RAD_ALL.3796  
!                                                                                  RAD_ALL.3797  
         DO I=1, NCLDS                                                             RAD_ALL.3798  
            CALL LSP_FOCWWIL(T(L, NLEVS+1-I), N_PROFILE, LIQ_FRAC)                 RAD_ALL.3799  
            DO L=1, N_PROFILE                                                      RAD_ALL.3800  
               LG=I_GATHER(L)                                                      RAD_ALL.3801  
               IF (LCA(LG, I).GT.TOL_TEST) THEN                                    RAD_ALL.3802  
                  CONDENSED_MIX_RATIO(L, NLEVS+1-I, IP_CLCMP_ST_WATER)             RAD_ALL.3803  
     &               =(LCCWC1(LG, I)+LCCWC2(LG, I))                                RAD_ALL.3804  
     &               *LIQ_FRAC(L)/LCA(LG, I)                                       RAD_ALL.3805  
                  CONDENSED_MIX_RATIO(L, NLEVS+1-I, IP_CLCMP_ST_ICE)               RAD_ALL.3806  
     &               =(LCCWC1(LG, I)+LCCWC2(LG, I))                                RAD_ALL.3807  
     &               *(1.0E+00-LIQ_FRAC(L))/LCA(LG, I)                             RAD_ALL.3808  
               ELSE                                                                RAD_ALL.3809  
                  CONDENSED_MIX_RATIO(L, NLEVS+1-I, IP_CLCMP_ST_WATER)             RAD_ALL.3810  
     &               =0.0E+00                                                      RAD_ALL.3811  
                  CONDENSED_MIX_RATIO(L, NLEVS+1-I, IP_CLCMP_ST_ICE)               RAD_ALL.3812  
     &               =0.0E+00                                                      RAD_ALL.3813  
               ENDIF                                                               RAD_ALL.3814  
            ENDDO                                                                  RAD_ALL.3815  
         ENDDO                                                                     RAD_ALL.3816  
!                                                                                  RAD_ALL.3817  
!                                                                                  RAD_ALL.3818  
!        CLOUD FRACTIONS:                                                          RAD_ALL.3819  
!                                                                                  RAD_ALL.3820  
       IF (L_3D_CCA) THEN                                                          RAD_ALL.3821  
         DO I=1, NCLDS                                                             RAD_ALL.3822  
            DO L=1, N_PROFILE                                                      RAD_ALL.3823  
               LG=I_GATHER(L)                                                      RAD_ALL.3824  
               W_CLOUD(L, NLEVS+1-I)                                               RAD_ALL.3825  
     &            =CCA(LG,I)+(1.0E+00-CCA(LG,I))*LCA(LG, I)                        RAD_ALL.3826  
               FRAC_CLOUD(L, NLEVS+1-I, IP_CLOUD_TYPE_CONV)                        RAD_ALL.3827  
     &            =CCA(LG,I)/(W_CLOUD(L, NLEVS+1-I)+TOL_MACHINE)                   RAD_ALL.3828  
               FRAC_CLOUD(L, NLEVS+1-I, IP_CLOUD_TYPE_STRAT)                       RAD_ALL.3829  
     &            =1.0E+00-FRAC_CLOUD(L, NLEVS+1-I, IP_CLOUD_TYPE_CONV)            RAD_ALL.3830  
            ENDDO                                                                  RAD_ALL.3831  
         ENDDO                                                                     RAD_ALL.3832  
       ELSE                                                                        RAD_ALL.3833  
         DO I=1, NCLDS                                                             RAD_ALL.3834  
            DO L=1, N_PROFILE                                                      RAD_ALL.3835  
              LG=I_GATHER(L)                                                       RAD_ALL.3836  
               IF ( (I.LE.CCT(LG)-1).AND.(I.GE.CCB(LG)) ) THEN                     RAD_ALL.3837  
                  W_CLOUD(L, NLEVS+1-I)                                            RAD_ALL.3838  
     &               =CCA(LG,1)+(1.0E+00-CCA(LG,1))*LCA(LG, I)                     RAD_ALL.3839  
                  FRAC_CLOUD(L, NLEVS+1-I, IP_CLOUD_TYPE_CONV)                     RAD_ALL.3840  
     &               =CCA(LG,1)/(W_CLOUD(L, NLEVS+1-I)+TOL_MACHINE)                RAD_ALL.3841  
               ELSE                                                                RAD_ALL.3842  
                  W_CLOUD(L, NLEVS+1-I)=LCA(LG, I)                                 RAD_ALL.3843  
                  FRAC_CLOUD(L, NLEVS+1-I, IP_CLOUD_TYPE_CONV)=0.0E+00             RAD_ALL.3844  
               ENDIF                                                               RAD_ALL.3845  
               FRAC_CLOUD(L, NLEVS+1-I, IP_CLOUD_TYPE_STRAT)                       RAD_ALL.3846  
     &            =1.0E+00-FRAC_CLOUD(L, NLEVS+1-I, IP_CLOUD_TYPE_CONV)            RAD_ALL.3847  
            ENDDO                                                                  RAD_ALL.3848  
         ENDDO                                                                     RAD_ALL.3849  
       ENDIF                                                                       RAD_ALL.3850  
!                                                                                  RAD_ALL.3851  
!        REMOVE VERY THIN CLOUDS TO PREVENT                                        RAD_ALL.3852  
!        PROBLEMS OF ILL-CONDITIONING.                                             RAD_ALL.3853  
!                                                                                  RAD_ALL.3854  
         DO I=NLEVS+1-NCLDS, NLEVS                                                 RAD_ALL.3855  
            DO L=1, N_PROFILE                                                      RAD_ALL.3856  
               MEAN_WATER_CONTENT                                                  RAD_ALL.3857  
     &            =CONDENSED_MIX_RATIO(L, I, IP_CLCMP_ST_WATER)                    RAD_ALL.3858  
     &            +(CONDENSED_MIX_RATIO(L, I, IP_CLCMP_CNV_WATER)                  RAD_ALL.3859  
     &            -CONDENSED_MIX_RATIO(L, I, IP_CLCMP_ST_WATER))                   RAD_ALL.3860  
     &            *FRAC_CLOUD(L, I, IP_CLOUD_TYPE_CONV)                            RAD_ALL.3861  
               MEAN_ICE_CONTENT                                                    RAD_ALL.3862  
     &            =CONDENSED_MIX_RATIO(L, I, IP_CLCMP_ST_ICE)                      RAD_ALL.3863  
     &            +(CONDENSED_MIX_RATIO(L, I, IP_CLCMP_CNV_ICE)                    RAD_ALL.3864  
     &            -CONDENSED_MIX_RATIO(L, I, IP_CLCMP_ST_ICE))                     RAD_ALL.3865  
     &            *FRAC_CLOUD(L, I, IP_CLOUD_TYPE_CONV)                            RAD_ALL.3866  
               IF ( (MEAN_WATER_CONTENT.LT.CONDENSED_LIMIT)                        RAD_ALL.3867  
     &              .AND.(MEAN_ICE_CONTENT.LT.CONDENSED_LIMIT) ) THEN              RAD_ALL.3868  
                  W_CLOUD(L, I)=0.0E+00                                            RAD_ALL.3869  
               ENDIF                                                               RAD_ALL.3870  
            ENDDO                                                                  RAD_ALL.3871  
         ENDDO                                                                     RAD_ALL.3872  
!                                                                                  RAD_ALL.3873  
!                                                                                  RAD_ALL.3874  
!                                                                                  RAD_ALL.3875  
!                                                                                  RAD_ALL.3876  
      ELSE IF (I_CLOUD_REPRESENTATION.EQ.IP_CLOUD_CSIW) THEN                       RAD_ALL.3877  
!                                                                                  RAD_ALL.3878  
!        HERE THE CLOUDS ARE SPLIT INTO FOUR SEPARATE TYPES.                       RAD_ALL.3879  
!        FOCCWIL NOW DETERMINES THE FRACTION OF EACH TYPE OF                       RAD_ALL.3880  
!        CLOUD WHILE THE MIXING RATIOS OF EACH SPECIES ARE THE                     RAD_ALL.3881  
!        SAME FOR EACH PHASE.                                                      RAD_ALL.3882  
!                                                                                  RAD_ALL.3883  
!        CONVECTIVE CLOUD:                                                         RAD_ALL.3884  
!                                                                                  RAD_ALL.3885  
         DO I=NLEVS+1-NCLDS, NLEVS                                                 RAD_ALL.3886  
            DO L=1, N_PROFILE                                                      RAD_ALL.3887  
               CONDENSED_MIX_RATIO(L, I, IP_CLCMP_CNV_WATER)=0.0E+00               RAD_ALL.3888  
               CONDENSED_MIX_RATIO(L, I, IP_CLCMP_CNV_ICE)=0.0E+00                 RAD_ALL.3889  
            ENDDO                                                                  RAD_ALL.3890  
         ENDDO                                                                     RAD_ALL.3891  
!                                                                                  RAD_ALL.3892  
         DO L=1, N_PROFILE                                                         RAD_ALL.3893  
            TOTAL_MASS(L)=0.0E+00                                                  RAD_ALL.3894  
         ENDDO                                                                     RAD_ALL.3895  
!                                                                                  RAD_ALL.3896  
         DO I=NLEVS+1-NCLDS, NLEVS                                                 RAD_ALL.3897  
            DO L=1, N_PROFILE                                                      RAD_ALL.3898  
               LG=I_GATHER(L)                                                      RAD_ALL.3899  
               IF ( (CCT(LG).GE.NLEVS+2-I).AND.                                    RAD_ALL.3900  
     &              (CCB(LG).LE.NLEVS+1-I) ) THEN                                  RAD_ALL.3901  
                  TOTAL_MASS(L)=TOTAL_MASS(L)+D_MASS(L, I)                         RAD_ALL.3902  
               ENDIF                                                               RAD_ALL.3903  
            ENDDO                                                                  RAD_ALL.3904  
         ENDDO                                                                     RAD_ALL.3905  
         DO I=NLEVS+1-NCLDS, NLEVS                                                 RAD_ALL.3906  
            DO L=1, N_PROFILE                                                      RAD_ALL.3907  
               LG=I_GATHER(L)                                                      RAD_ALL.3908  
               IF ( (CCT(LG).GE.NLEVS+2-I).AND.                                    RAD_ALL.3909  
     &              (CCB(LG).LE.NLEVS+1-I) ) THEN                                  RAD_ALL.3910  
                  CONDENSED_MIX_RATIO(L, I, IP_CLCMP_CNV_WATER)                    RAD_ALL.3911  
     &               =CCCWP(LG)/(TOTAL_MASS(L)+TOL_MACHINE)                        RAD_ALL.3912  
                  CONDENSED_MIX_RATIO(L, I, IP_CLCMP_CNV_ICE)                      RAD_ALL.3913  
     &               =CCCWP(LG)/(TOTAL_MASS(L)+TOL_MACHINE)                        RAD_ALL.3914  
               ENDIF                                                               RAD_ALL.3915  
            ENDDO                                                                  RAD_ALL.3916  
         ENDDO                                                                     RAD_ALL.3917  
!                                                                                  RAD_ALL.3918  
!        STRATIFORM CLOUDS:                                                        RAD_ALL.3919  
!                                                                                  RAD_ALL.3920  
         DO I=1, NCLDS                                                             RAD_ALL.3921  
            DO L=1, N_PROFILE                                                      RAD_ALL.3922  
               LG=I_GATHER(L)                                                      RAD_ALL.3923  
               IF (LCA(LG, I).GT.TOL_TEST) THEN                                    RAD_ALL.3924  
                  CONDENSED_MIX_RATIO(L, NLEVS+1-I, IP_CLCMP_ST_WATER)             RAD_ALL.3925  
     &               =(LCCWC1(LG, I)+LCCWC2(LG, I))/LCA(LG, I)                     RAD_ALL.3926  
                  CONDENSED_MIX_RATIO(L, NLEVS+1-I, IP_CLCMP_ST_ICE)               RAD_ALL.3927  
     &               =(LCCWC1(LG, I)+LCCWC2(LG, I))/LCA(LG, I)                     RAD_ALL.3928  
               ELSE                                                                RAD_ALL.3929  
                  CONDENSED_MIX_RATIO(L, NLEVS+1-I, IP_CLCMP_ST_WATER)             RAD_ALL.3930  
     &               =0.0E+00                                                      RAD_ALL.3931  
                  CONDENSED_MIX_RATIO(L, NLEVS+1-I, IP_CLCMP_ST_ICE)               RAD_ALL.3932  
     &               =0.0E+00                                                      RAD_ALL.3933  
               ENDIF                                                               RAD_ALL.3934  
            ENDDO                                                                  RAD_ALL.3935  
         ENDDO                                                                     RAD_ALL.3936  
!                                                                                  RAD_ALL.3937  
!                                                                                  RAD_ALL.3938  
!        CLOUD FRACTIONS:                                                          RAD_ALL.3939  
!                                                                                  RAD_ALL.3940  
!        PARTITION CONVECTIVE CLOUDS USING THE TEMPERATURE IN                      RAD_ALL.3941  
!        THE MIDDLE OF THE TOP LAYER OF THE CLOUD.                                 RAD_ALL.3942  
         DO L=1, N_PROFILE                                                         RAD_ALL.3943  
            T_GATHER(L)=T(L, NLEVS+2-CCT(I_GATHER(L)))                             RAD_ALL.3944  
         ENDDO                                                                     RAD_ALL.3945  
         CALL LSP_FOCWWIL(T_GATHER, N_PROFILE, LIQ_FRAC_CONV)                      RAD_ALL.3946  
!                                                                                  RAD_ALL.3947  
!                                                                                  RAD_ALL.3948  
         DO I=NLEVS+1-NCLDS, NLEVS                                                 RAD_ALL.3949  
!                                                                                  RAD_ALL.3950  
            IF (.NOT. L_CLOUD_WATER_PARTITION)                                     RAD_ALL.3951  
!           PARTITION STRATIFORM CLOUDS USING THE LOCAL TEMPERATURE.               RAD_ALL.3952  
     &        CALL LSP_FOCWWIL(T(1, I), N_PROFILE, LIQ_FRAC)                       RAD_ALL.3953  
!                                                                                  RAD_ALL.3954  
          IF (L_3D_CCA) THEN                                                       RAD_ALL.3955  
            DO L=1, N_PROFILE                                                      RAD_ALL.3956  
               LG=I_GATHER(L)                                                      RAD_ALL.3957  
              CONVECTIVE_CLOUD_LAYER(L)=CCA(LG,I)                                  RAD_ALL.3958  
            ENDDO                                                                  RAD_ALL.3959  
          ELSE                                                                     RAD_ALL.3960  
            DO L=1, N_PROFILE                                                      RAD_ALL.3961  
            LG=I_GATHER(L)                                                         RAD_ALL.3962  
               IF ( (CCT(LG).GE.NLEVS+2-I).AND.                                    RAD_ALL.3963  
     &              (CCB(LG).LE.NLEVS+1-I) ) THEN                                  RAD_ALL.3964  
                CONVECTIVE_CLOUD_LAYER(L)=CCA(LG,1)                                RAD_ALL.3965  
               ELSE                                                                RAD_ALL.3966  
                  CONVECTIVE_CLOUD_LAYER(L)=0.0E+00                                RAD_ALL.3967  
               ENDIF                                                               RAD_ALL.3968  
            ENDDO                                                                  RAD_ALL.3969  
          ENDIF                                                                    RAD_ALL.3970  
!                                                                                  RAD_ALL.3971  
            DO L=1, N_PROFILE                                                      RAD_ALL.3972  
            LG=I_GATHER(L)                                                         RAD_ALL.3973  
               W_CLOUD(L, I)                                                       RAD_ALL.3974  
     &            =CONVECTIVE_CLOUD_LAYER(L)                                       RAD_ALL.3975  
     &            +(1.0E+00-CONVECTIVE_CLOUD_LAYER(L))                             RAD_ALL.3976  
     &            *LCA(LG, NLEVS+1-I)                                              RAD_ALL.3977  
!                                                                                  RAD_ALL.3978  
               IF (L_CLOUD_WATER_PARTITION) THEN                                   RAD_ALL.3979  
!  PARTITION STRATIFORM CLOUDS USING THE RATIO OF CLOUD WATER CONTENTS.            RAD_ALL.3980  
                 IF (LCA(LG, NLEVS+1-I).GT.TOL_TEST) THEN                          RAD_ALL.3981  
                   LIQ_FRAC(L) = LCCWC1(LG, NLEVS+1-I) /                           RAD_ALL.3982  
     &              (LCCWC1(LG, NLEVS+1-I) + LCCWC2(LG, NLEVS+1-I))                RAD_ALL.3983  
                 ELSE                                                              RAD_ALL.3984  
                   LIQ_FRAC(L) = 0.0E+00                                           RAD_ALL.3985  
                 ENDIF                                                             RAD_ALL.3986  
               ENDIF                                                               RAD_ALL.3987  
!                                                                                  RAD_ALL.3988  
               FRAC_CLOUD(L, I, IP_CLOUD_TYPE_SW)                                  RAD_ALL.3989  
     &            =LIQ_FRAC(L)*(1.0E+00-CONVECTIVE_CLOUD_LAYER(L))                 RAD_ALL.3990  
     &            *LCA(LG, NLEVS+1-I)                                              RAD_ALL.3991  
     &            /(W_CLOUD(L, I)+TOL_MACHINE)                                     RAD_ALL.3992  
               FRAC_CLOUD(L, I, IP_CLOUD_TYPE_SI)                                  RAD_ALL.3993  
     &            =(1.0E+00-LIQ_FRAC(L))                                           RAD_ALL.3994  
     &            *(1.0E+00-CONVECTIVE_CLOUD_LAYER(L))                             RAD_ALL.3995  
     &            *LCA(LG, NLEVS+1-I)/(W_CLOUD(L, I)+TOL_MACHINE)                  RAD_ALL.3996  
               FRAC_CLOUD(L, I, IP_CLOUD_TYPE_CW)                                  RAD_ALL.3997  
     &            =LIQ_FRAC_CONV(L)*CONVECTIVE_CLOUD_LAYER(L)                      RAD_ALL.3998  
     &            /(W_CLOUD(L, I)+TOL_MACHINE)                                     RAD_ALL.3999  
               FRAC_CLOUD(L, I, IP_CLOUD_TYPE_CI)                                  RAD_ALL.4000  
     &            =(1.0E+00-LIQ_FRAC_CONV(L))*CONVECTIVE_CLOUD_LAYER(L)            RAD_ALL.4001  
     &            /(W_CLOUD(L, I)+TOL_MACHINE)                                     RAD_ALL.4002  
!                                                                                  RAD_ALL.4003  
            ENDDO                                                                  RAD_ALL.4004  
         ENDDO                                                                     RAD_ALL.4005  
!                                                                                  RAD_ALL.4006  
!                                                                                  RAD_ALL.4007  
!        REMOVE VERY THIN CLOUDS TO PREVENT                                        RAD_ALL.4008  
!        PROBLEMS OF ILL-CONDITIONING.                                             RAD_ALL.4009  
!                                                                                  RAD_ALL.4010  
         DO I=NLEVS+1-NCLDS, NLEVS                                                 RAD_ALL.4011  
            DO L=1, N_PROFILE                                                      RAD_ALL.4012  
               MEAN_WATER_CONTENT                                                  RAD_ALL.4013  
     &            =CONDENSED_MIX_RATIO(L, I, IP_CLCMP_ST_WATER)                    RAD_ALL.4014  
     &            *FRAC_CLOUD(L, I, IP_CLOUD_TYPE_SW)                              RAD_ALL.4015  
     &            +CONDENSED_MIX_RATIO(L, I, IP_CLCMP_CNV_WATER)                   RAD_ALL.4016  
     &            *FRAC_CLOUD(L, I, IP_CLOUD_TYPE_CW)                              RAD_ALL.4017  
               MEAN_ICE_CONTENT                                                    RAD_ALL.4018  
     &            =CONDENSED_MIX_RATIO(L, I, IP_CLCMP_ST_ICE)                      RAD_ALL.4019  
     &            *FRAC_CLOUD(L, I, IP_CLOUD_TYPE_SI)                              RAD_ALL.4020  
     &            +CONDENSED_MIX_RATIO(L, I, IP_CLCMP_CNV_ICE)                     RAD_ALL.4021  
     &            *FRAC_CLOUD(L, I, IP_CLOUD_TYPE_CI)                              RAD_ALL.4022  
               IF ( (MEAN_WATER_CONTENT.LT.CONDENSED_LIMIT)                        RAD_ALL.4023  
     &              .AND.(MEAN_ICE_CONTENT.LT.CONDENSED_LIMIT) ) THEN              RAD_ALL.4024  
                  W_CLOUD(L, I)=0.0E+00                                            RAD_ALL.4025  
               ENDIF                                                               RAD_ALL.4026  
            ENDDO                                                                  RAD_ALL.4027  
         ENDDO                                                                     RAD_ALL.4028  
!                                                                                  RAD_ALL.4029  
!                                                                                  RAD_ALL.4030  
      ENDIF                                                                        RAD_ALL.4031  
!                                                                                  RAD_ALL.4032  
!                                                                                  RAD_ALL.4033  
!                                                                                  RAD_ALL.4034  
!     EFFECTIVE RADII OF WATER CLOUDS: A MICROPHYSICAL PARAMETRIZATION             RAD_ALL.4035  
!     IS AVAILABLE; OTHERWISE STANDARD VALUES ARE USED.                            RAD_ALL.4036  
!                                                                                  RAD_ALL.4037  
      IF (L_MICROPHYSICS) THEN                                                     RAD_ALL.4038  
!                                                                                  RAD_ALL.4039  
!        STANDARD VALUES ARE USED FOR ICE CRYSTALS, BUT                            RAD_ALL.4040  
!        A PARAMETRIZATION PROVIDED BY UMIST AND MRF                               RAD_ALL.4041  
!        IS USED FOR DROPLETS.                                                     RAD_ALL.4042  
!                                                                                  RAD_ALL.4043  
!        CALCULATE THE DENSITY OF AIR.                                             RAD_ALL.4044  
         DO I=NLEVS+1-NCLDS, NLEVS                                                 RAD_ALL.4045  
            DO L=1, N_PROFILE                                                      RAD_ALL.4046  
               DENSITY_AIR(L, I)=P(L, I)/(R*T(L, I))                               RAD_ALL.4047  
            ENDDO                                                                  RAD_ALL.4048  
         ENDDO                                                                     RAD_ALL.4049  
!                                                                                  RAD_ALL.4050  
         DO L=1, N_PROFILE                                                         RAD_ALL.4051  
            CC_DEPTH(L)=0.0E+00                                                    RAD_ALL.4052  
         ENDDO                                                                     RAD_ALL.4053  
!                                                                                  RAD_ALL.4054  
         DO L=1, N_PROFILE                                                         RAD_ALL.4055  
            LG=I_GATHER(L)                                                         RAD_ALL.4056  
            DO I=NLEVS+2-CCT(LG), NLEVS+1-CCB(LG)                                  RAD_ALL.4057  
               CC_DEPTH(L)=CC_DEPTH(L)+D_MASS(L, I)/DENSITY_AIR(L, I)              RAD_ALL.4058  
            ENDDO                                                                  RAD_ALL.4059  
         ENDDO                                                                     RAD_ALL.4060  
!                                                                                  RAD_ALL.4061  
         CALL R2_RE_MRF_UMIST(N_PROFILE, NLEVS, NCLDS                              RAD_ALL.4062  
     &      , I_GATHER                                                             RAD_ALL.4063  
     &      , L_AEROSOL_CCN                                                        RAD_ALL.4064  
     &      , ACCUM_SULPHATE, DISS_SULPHATE                                        RAD_ALL.4065  
     &      , I_CLOUD_REPRESENTATION                                               RAD_ALL.4066  
     &      , LAND_G, DENSITY_AIR, CONDENSED_MIX_RATIO, CC_DEPTH                   RAD_ALL.4067  
     &      , CONDENSED_DIM_CHAR                                                   RAD_ALL.4068  
     &      , NTOT_DIAG_G                                                          RAD_ALL.4069  
     &      , STRAT_LWC_DIAG_G                                                     RAD_ALL.4070  
     &      , SO4_CCN_DIAG_G                                                       RAD_ALL.4071  
     &      , SULP_DIM1, SULP_DIM2                                                 RAD_ALL.4072  
     &      , NPD_FIELD, NPD_PROFILE, NPD_LAYER, NPD_AEROSOL_SPECIES               RAD_ALL.4073  
     &      )                                                                      RAD_ALL.4074  
!                                                                                  RAD_ALL.4075  
!        CONSTRAIN THE SIZES OF DROPLETS TO LIE WITHIN THE RANGE OF                RAD_ALL.4076  
!        VALIDITY OF THE PARAMETRIZATION SCHEME.                                   RAD_ALL.4077  
         DO I=NLEVS+1-NCLDS, NLEVS                                                 RAD_ALL.4078  
            DO L=1, N_PROFILE                                                      RAD_ALL.4079  
               CONDENSED_DIM_CHAR(L, I, IP_CLCMP_ST_WATER)                         RAD_ALL.4080  
     &            =MAX(CONDENSED_MIN_DIM(IP_CLCMP_ST_WATER)                        RAD_ALL.4081  
     &            , MIN(CONDENSED_MAX_DIM(IP_CLCMP_ST_WATER)                       RAD_ALL.4082  
     &            , CONDENSED_DIM_CHAR(L, I, IP_CLCMP_ST_WATER)))                  RAD_ALL.4083  
               CONDENSED_DIM_CHAR(L, I, IP_CLCMP_CNV_WATER)                        RAD_ALL.4084  
     &            =MAX(CONDENSED_MIN_DIM(IP_CLCMP_CNV_WATER)                       RAD_ALL.4085  
     &            , MIN(CONDENSED_MAX_DIM(IP_CLCMP_CNV_WATER)                      RAD_ALL.4086  
     &            , CONDENSED_DIM_CHAR(L, I, IP_CLCMP_CNV_WATER)))                 RAD_ALL.4087  
            ENDDO                                                                  RAD_ALL.4088  
         ENDDO                                                                     RAD_ALL.4089  
!                                                                                  RAD_ALL.4090  
!                                                                                  RAD_ALL.4091  
!        SET MICROPHYSICAL DIAGNOSTICS. WEIGHTS FOR CLOUD CALCULATED               RAD_ALL.4092  
!        HERE ARE USED SOLELY FOR THE MICROPHYSICS AND DO NOT HAVE                 RAD_ALL.4093  
!        AN INDEPENDENT MEANING.                                                   RAD_ALL.4094  
!                                                                                  RAD_ALL.4095  
         IF (WGT_CONV_FLAG) THEN                                                   RAD_ALL.4096  
            IF (I_CLOUD_REPRESENTATION.EQ.IP_CLOUD_CONV_STRAT) THEN                RAD_ALL.4097  
               DO I=1, NCLDS                                                       RAD_ALL.4098  
                  DO L=1, N_PROFILE                                                RAD_ALL.4099  
                     LG=I_GATHER(L)                                                RAD_ALL.4100  
                     WGT_CONV(LG, I)=W_CLOUD(L, NLEVS+1-I)                         RAD_ALL.4101  
     &                  *FRAC_CLOUD(L, NLEVS+1-I, IP_CLOUD_TYPE_CONV)              RAD_ALL.4102  
                  ENDDO                                                            RAD_ALL.4103  
               ENDDO                                                               RAD_ALL.4104  
            ELSE IF (I_CLOUD_REPRESENTATION.EQ.IP_CLOUD_CSIW) THEN                 RAD_ALL.4105  
               DO I=1, NCLDS                                                       RAD_ALL.4106  
                  DO L=1, N_PROFILE                                                RAD_ALL.4107  
                     LG=I_GATHER(L)                                                RAD_ALL.4108  
                     WGT_CONV(LG, I)=W_CLOUD(L, NLEVS+1-I)                         RAD_ALL.4109  
     &                  *FRAC_CLOUD(L, NLEVS+1-I, IP_CLOUD_TYPE_CW)                RAD_ALL.4110  
                  ENDDO                                                            RAD_ALL.4111  
               ENDDO                                                               RAD_ALL.4112  
            ENDIF                                                                  RAD_ALL.4113  
         ENDIF                                                                     RAD_ALL.4114  
!                                                                                  RAD_ALL.4115  
         IF (RE_CONV_FLAG) THEN                                                    RAD_ALL.4116  
            DO I=1, NCLDS                                                          RAD_ALL.4117  
               DO L=1, N_PROFILE                                                   RAD_ALL.4118  
                  LG=I_GATHER(L)                                                   RAD_ALL.4119  
!                 EFFECTIVE RADII ARE GIVEN IN MICRONS.                            RAD_ALL.4120  
                  RE_CONV(LG, I)                                                   RAD_ALL.4121  
     &               =CONDENSED_DIM_CHAR(L, NLEVS+1-I                              RAD_ALL.4122  
     &               , IP_CLCMP_CNV_WATER)                                         RAD_ALL.4123  
     &               *WGT_CONV(LG, I)*1.0E+06                                      RAD_ALL.4124  
               ENDDO                                                               RAD_ALL.4125  
            ENDDO                                                                  RAD_ALL.4126  
         ENDIF                                                                     RAD_ALL.4127  
!                                                                                  RAD_ALL.4128  
         IF (WGT_STRAT_FLAG) THEN                                                  RAD_ALL.4129  
            IF (I_CLOUD_REPRESENTATION.EQ.IP_CLOUD_CONV_STRAT) THEN                RAD_ALL.4130  
               DO I=1, NCLDS                                                       RAD_ALL.4131  
                  DO L=1, N_PROFILE                                                RAD_ALL.4132  
                     LG=I_GATHER(L)                                                RAD_ALL.4133  
                     WGT_STRAT(LG, I)=W_CLOUD(L, NLEVS+1-I)                        RAD_ALL.4134  
     &                  *FRAC_CLOUD(L, NLEVS+1-I, IP_CLOUD_TYPE_STRAT)             RAD_ALL.4135  
                  ENDDO                                                            RAD_ALL.4136  
               ENDDO                                                               RAD_ALL.4137  
            ELSE IF (I_CLOUD_REPRESENTATION.EQ.IP_CLOUD_CSIW) THEN                 RAD_ALL.4138  
               DO I=1, NCLDS                                                       RAD_ALL.4139  
                  DO L=1, N_PROFILE                                                RAD_ALL.4140  
                     LG=I_GATHER(L)                                                RAD_ALL.4141  
                     WGT_STRAT(LG, I)=W_CLOUD(L, NLEVS+1-I)                        RAD_ALL.4142  
     &                  *FRAC_CLOUD(L, NLEVS+1-I, IP_CLOUD_TYPE_SW)                RAD_ALL.4143  
                  ENDDO                                                            RAD_ALL.4144  
               ENDDO                                                               RAD_ALL.4145  
            ENDIF                                                                  RAD_ALL.4146  
         ENDIF                                                                     RAD_ALL.4147  
!                                                                                  RAD_ALL.4148  
         IF (RE_STRAT_FLAG) THEN                                                   RAD_ALL.4149  
            DO I=1, NCLDS                                                          RAD_ALL.4150  
               DO L=1, N_PROFILE                                                   RAD_ALL.4151  
                  LG=I_GATHER(L)                                                   RAD_ALL.4152  
!                 EFFECTIVE RADII ARE GIVEN IN MICRONS.                            RAD_ALL.4153  
                  RE_STRAT(LG, I)                                                  RAD_ALL.4154  
     &               =CONDENSED_DIM_CHAR(L, NLEVS+1-I                              RAD_ALL.4155  
     &               , IP_CLCMP_ST_WATER)                                          RAD_ALL.4156  
     &               *WGT_STRAT(LG, I)*1.0E+06                                     RAD_ALL.4157  
               ENDDO                                                               RAD_ALL.4158  
            ENDDO                                                                  RAD_ALL.4159  
         ENDIF                                                                     RAD_ALL.4160  
                                                                                   RAD_ALL.4161  
         IF (LWP_STRAT_FLAG) THEN                                                  RAD_ALL.4162  
            DO I=1, NCLDS                                                          RAD_ALL.4163  
               DO L=1, N_PROFILE                                                   RAD_ALL.4164  
                  LG=I_GATHER(L)                                                   RAD_ALL.4165  
                  LWP_STRAT(LG, I)                                                 RAD_ALL.4166  
     &               =CONDENSED_MIX_RATIO(L, NLEVS+1-I                             RAD_ALL.4167  
     &               , IP_CLCMP_ST_WATER)*D_MASS(L, NLEVS+1-I)                     RAD_ALL.4168  
     &               *WGT_STRAT(LG, I)                                             RAD_ALL.4169  
               ENDDO                                                               RAD_ALL.4170  
            ENDDO                                                                  RAD_ALL.4171  
         ENDIF                                                                     RAD_ALL.4172  
                                                                                   RAD_ALL.4173  
         IF (NTOT_DIAG_FLAG) THEN                                                  RAD_ALL.4174  
            DO I=1, NCLDS                                                          RAD_ALL.4175  
               DO L=1, N_PROFILE                                                   RAD_ALL.4176  
                  LG=I_GATHER(L)                                                   RAD_ALL.4177  
                  NTOT_DIAG(LG, I)                                                 RAD_ALL.4178  
     &               =NTOT_DIAG_G(L, NLEVS+1-I)*WGT_STRAT(LG, I)                   RAD_ALL.4179  
               ENDDO                                                               RAD_ALL.4180  
            ENDDO                                                                  RAD_ALL.4181  
         ENDIF                                                                     RAD_ALL.4182  
                                                                                   RAD_ALL.4183  
         IF (STRAT_LWC_DIAG_FLAG) THEN                                             RAD_ALL.4184  
            DO I=1, NCLDS                                                          RAD_ALL.4185  
               DO L=1, N_PROFILE                                                   RAD_ALL.4186  
                  LG=I_GATHER(L)                                                   RAD_ALL.4187  
                  STRAT_LWC_DIAG(LG, I)                                            RAD_ALL.4188  
     &               =STRAT_LWC_DIAG_G(L, NLEVS+1-I)*WGT_STRAT(LG, I)              RAD_ALL.4189  
               ENDDO                                                               RAD_ALL.4190  
            ENDDO                                                                  RAD_ALL.4191  
         ENDIF                                                                     RAD_ALL.4192  
                                                                                   RAD_ALL.4193  
! Non-cloud diagnostics are "weighted" by the conditional sampling                 RAD_ALL.4194  
! weight COND_SAMP_WGT, but as this is 1.0 if the SW radiation is                  RAD_ALL.4195  
! active, and 0.0 if it is not, there is no need to actually                       RAD_ALL.4196  
! multiply by it.                                                                  RAD_ALL.4197  
                                                                                   RAD_ALL.4198  
         IF (COND_SAMP_WGT_FLAG) THEN                                              RAD_ALL.4199  
            DO I=1, NCLDS                                                          RAD_ALL.4200  
               DO L=1, N_PROFILE                                                   RAD_ALL.4201  
                  LG=I_GATHER(L)                                                   RAD_ALL.4202  
                  COND_SAMP_WGT(LG, I)=1.0                                         RAD_ALL.4203  
               ENDDO                                                               RAD_ALL.4204  
            ENDDO                                                                  RAD_ALL.4205  
         ENDIF                                                                     RAD_ALL.4206  
                                                                                   RAD_ALL.4207  
         IF (SO4_CCN_DIAG_FLAG) THEN                                               RAD_ALL.4208  
            DO I=1, NCLDS                                                          RAD_ALL.4209  
               DO L=1, N_PROFILE                                                   RAD_ALL.4210  
                  LG=I_GATHER(L)                                                   RAD_ALL.4211  
                  SO4_CCN_DIAG(LG, I)                                              RAD_ALL.4212  
     &                    =SO4_CCN_DIAG_G(L, NLEVS+1-I)                            RAD_ALL.4213  
               ENDDO                                                               RAD_ALL.4214  
            ENDDO                                                                  RAD_ALL.4215  
         ENDIF                                                                     RAD_ALL.4216  
!                                                                                  RAD_ALL.4217  
!                                                                                  RAD_ALL.4218  
      ELSE                                                                         RAD_ALL.4219  
!                                                                                  RAD_ALL.4220  
!        ALL EFFECTIVE RADII ARE SET TO STANDARD VALUES.                           RAD_ALL.4221  
!                                                                                  RAD_ALL.4222  
         DO I=NLEVS+1-NCLDS, NLEVS                                                 RAD_ALL.4223  
            DO L=1, N_PROFILE                                                      RAD_ALL.4224  
               CONDENSED_DIM_CHAR(L, I, IP_CLCMP_ST_WATER)=7.E-6                   RAD_ALL.4225  
               CONDENSED_DIM_CHAR(L, I, IP_CLCMP_CNV_WATER)=7.E-6                  RAD_ALL.4226  
            ENDDO                                                                  RAD_ALL.4227  
         ENDDO                                                                     RAD_ALL.4228  
!                                                                                  RAD_ALL.4229  
      ENDIF                                                                        RAD_ALL.4230  
!                                                                                  RAD_ALL.4231  
!                                                                                  RAD_ALL.4232  
!                                                                                  RAD_ALL.4233  
!     SET THE CHARACTERISTIC DIMENSIONS OF ICE CRYSTALS:                           RAD_ALL.4234  
!                                                                                  RAD_ALL.4235  
!     ICE CRYSTALS IN STRATIFORM CLOUDS:                                           RAD_ALL.4236  
!                                                                                  RAD_ALL.4237  
      IF (I_CONDENSED_PARAM(IP_CLCMP_ST_ICE).EQ.                                   RAD_ALL.4238  
     &   IP_SLINGO_SCHRECKER_ICE) THEN                                             RAD_ALL.4239  
!                                                                                  RAD_ALL.4240  
!        THIS PARAMETRIZATION IS BASED ON THE EFFECTIVE RADIUS                     RAD_ALL.4241  
!        AND A STANDARD VALUE OF 30-MICRONS IS ASSUMED.                            RAD_ALL.4242  
!                                                                                  RAD_ALL.4243  
         DO I=NLEVS+1-NCLDS, NLEVS                                                 RAD_ALL.4244  
            DO L=1, N_PROFILE                                                      RAD_ALL.4245  
               CONDENSED_DIM_CHAR(L, I, IP_CLCMP_ST_ICE)=30.E-6                    RAD_ALL.4246  
            ENDDO                                                                  RAD_ALL.4247  
         ENDDO                                                                     RAD_ALL.4248  
!                                                                                  RAD_ALL.4249  
      ELSE IF (I_CONDENSED_PARAM(IP_CLCMP_ST_ICE).EQ.                              RAD_ALL.4250  
     &   IP_ICE_ADT) THEN                                                          RAD_ALL.4251  
!                                                                                  RAD_ALL.4252  
!        THIS PARAMETRIZATION IS BASED ON THE MEAN MAXIMUM                         RAD_ALL.4253  
!        DIMENSION OF THE CRYSTAL, DETERMINED AS A FUNCTION OF                     RAD_ALL.4254  
!        THE LOCAL TEMPERATURE. THE SIZE IS LIMITED TO ITS VALUE                   RAD_ALL.4255  
!        AT THE FREEZING LEVEL.                                                    RAD_ALL.4256  
!                                                                                  RAD_ALL.4257  
         DO I=NLEVS+1-NCLDS, NLEVS                                                 RAD_ALL.4258  
            DO L=1, N_PROFILE                                                      RAD_ALL.4259  
               CONDENSED_DIM_CHAR(L, I, IP_CLCMP_ST_ICE)                           RAD_ALL.4260  
     &            =MIN(7.198755E-04                                                RAD_ALL.4261  
     &            , EXP(5.522E-02*(T(L, I)-2.7965E+02))/9.702E+02)                 RAD_ALL.4262  
            ENDDO                                                                  RAD_ALL.4263  
         ENDDO                                                                     RAD_ALL.4264  
!                                                                                  RAD_ALL.4265  
      ENDIF                                                                        RAD_ALL.4266  
!                                                                                  RAD_ALL.4267  
!                                                                                  RAD_ALL.4268  
!     ICE CRYSTALS IN CONVECTIVE CLOUDS:                                           RAD_ALL.4269  
!                                                                                  RAD_ALL.4270  
      IF (I_CONDENSED_PARAM(IP_CLCMP_CNV_ICE).EQ.                                  RAD_ALL.4271  
     &   IP_SLINGO_SCHRECKER_ICE) THEN                                             RAD_ALL.4272  
!                                                                                  RAD_ALL.4273  
!        THIS PARAMETRIZATION IS BASED ON THE EFFECTIVE RADIUS                     RAD_ALL.4274  
!        AND A STANDARD VALUE OF 30-MICRONS IS ASSUMED.                            RAD_ALL.4275  
!                                                                                  RAD_ALL.4276  
         DO I=NLEVS+1-NCLDS, NLEVS                                                 RAD_ALL.4277  
            DO L=1, N_PROFILE                                                      RAD_ALL.4278  
               CONDENSED_DIM_CHAR(L, I, IP_CLCMP_CNV_ICE)=30.E-6                   RAD_ALL.4279  
            ENDDO                                                                  RAD_ALL.4280  
         ENDDO                                                                     RAD_ALL.4281  
!                                                                                  RAD_ALL.4282  
      ELSE IF (I_CONDENSED_PARAM(IP_CLCMP_CNV_ICE).EQ.                             RAD_ALL.4283  
     &   IP_ICE_ADT) THEN                                                          RAD_ALL.4284  
!                                                                                  RAD_ALL.4285  
!        THIS PARAMETRIZATION IS BASED ON THE MEAN MAXIMUM                         RAD_ALL.4286  
!        DIMENSION OF THE CRYSTAL, DETERMINED AS A FUNCTION OF                     RAD_ALL.4287  
!        THE LOCAL TEMPERATURE. THE SIZE IS LIMITED TO ITS VALUE                   RAD_ALL.4288  
!        AT THE FREEZING LEVEL.                                                    RAD_ALL.4289  
!                                                                                  RAD_ALL.4290  
         DO I=NLEVS+1-NCLDS, NLEVS                                                 RAD_ALL.4291  
            DO L=1, N_PROFILE                                                      RAD_ALL.4292  
               CONDENSED_DIM_CHAR(L, I, IP_CLCMP_CNV_ICE)                          RAD_ALL.4293  
     &            =MIN(7.198755E-04                                                RAD_ALL.4294  
     &            , EXP(5.522E-02*(T(L, I)-2.7965E+02))/9.702E+02)                 RAD_ALL.4295  
            ENDDO                                                                  RAD_ALL.4296  
         ENDDO                                                                     RAD_ALL.4297  
!                                                                                  RAD_ALL.4298  
      ENDIF                                                                        RAD_ALL.4299  
!                                                                                  RAD_ALL.4300  
!                                                                                  RAD_ALL.4301  
!                                                                                  RAD_ALL.4302  
!     CONSTRAIN THE SIZES OF ICE CRYSTALS TO LIE WITHIN THE RANGE                  RAD_ALL.4303  
!     OF VALIDITY OF THE PARAMETRIZATION SCHEME.                                   RAD_ALL.4304  
      DO I=NLEVS+1-NCLDS, NLEVS                                                    RAD_ALL.4305  
         DO L=1, N_PROFILE                                                         RAD_ALL.4306  
            CONDENSED_DIM_CHAR(L, I, IP_CLCMP_ST_ICE)                              RAD_ALL.4307  
     &         =MAX(CONDENSED_MIN_DIM(IP_CLCMP_ST_ICE)                             RAD_ALL.4308  
     &         , MIN(CONDENSED_MAX_DIM(IP_CLCMP_ST_ICE)                            RAD_ALL.4309  
     &         , CONDENSED_DIM_CHAR(L, I, IP_CLCMP_ST_ICE)))                       RAD_ALL.4310  
            CONDENSED_DIM_CHAR(L, I, IP_CLCMP_CNV_ICE)                             RAD_ALL.4311  
     &         =MAX(CONDENSED_MIN_DIM(IP_CLCMP_CNV_ICE)                            RAD_ALL.4312  
     &         , MIN(CONDENSED_MAX_DIM(IP_CLCMP_CNV_ICE)                           RAD_ALL.4313  
     &         , CONDENSED_DIM_CHAR(L, I, IP_CLCMP_CNV_ICE)))                      RAD_ALL.4314  
         ENDDO                                                                     RAD_ALL.4315  
      ENDDO                                                                        RAD_ALL.4316  
!                                                                                  RAD_ALL.4317  
!                                                                                  RAD_ALL.4318  
!                                                                                  RAD_ALL.4319  
      RETURN                                                                       RAD_ALL.4320  
      END 
