C (c) CROWN COPYRIGHT 1995, METEOROLOGICAL OFFICE, All Rights Reserved.            RAD_ALL.7842  
C                                                                                  RAD_ALL.7843  
C Use, duplication or disclosure of this code is subject to the                    RAD_ALL.7844  
C restrictions as set forth in the contract.                                       RAD_ALL.7845  
C                                                                                  RAD_ALL.7846  
C                Meteorological Office                                             RAD_ALL.7847  
C                London Road                                                       RAD_ALL.7848  
C                BRACKNELL                                                         RAD_ALL.7849  
C                Berkshire UK                                                      RAD_ALL.7850  
C                RG12 2SZ                                                          RAD_ALL.7851  
C                                                                                  RAD_ALL.7852  
C If no contract has been raised with this copy of the code, the use,              RAD_ALL.7853  
C duplication or disclosure of it is strictly prohibited.  Permission              RAD_ALL.7854  
C to do so must first be obtained in writing from the Head of Numerical            RAD_ALL.7855  
C Modelling at the above address.                                                  RAD_ALL.7856  
C ******************************COPYRIGHT******************************            RAD_ALL.7857  
C                                                                                  RAD_ALL.7858  
!+ Subroutine to calculate grey extinctions.                                       RAD_ALL.7859  
!                                                                                  RAD_ALL.7860  
! Method:                                                                          RAD_ALL.7861  
!       For each activated optical process, excluding gaseous                      RAD_ALL.7862  
!       absorption, increments are calculated for the total and                    RAD_ALL.7863  
!       scattering extinctions, and the products of the asymmetry                  RAD_ALL.7864  
!       factor and the forward scattering factor in clear and                      RAD_ALL.7865  
!       cloudy regions. These increments are summed, and the grey                  RAD_ALL.7866  
!       total and scattering extinctions and the asymmetry and forward             RAD_ALL.7867  
!       scattering factors are thus calculated.                                    RAD_ALL.7868  
!                                                                                  RAD_ALL.7869  
! Current Owner of Code: J. M. Edwards                                             RAD_ALL.7870  
!                                                                                  RAD_ALL.7871  
! History:                                                                         RAD_ALL.7872  
!       Version         Date                    Comment                            RAD_ALL.7873  
!       4.0             27-07-95                Original Code                      RAD_ALL.7874  
!                                               (J. M. Edwards)                    RAD_ALL.7875  
!       4.1             06-06-96                Indentation made                   RAD_ALL.7876  
!                                               consistent                         RAD_ALL.7877  
!                                               (J. M. Edwards)                    RAD_ALL.7878  
!       4.2             Nov. 96   T3E migration: CALL WHENFGT replaced             RAD_ALL.7879  
!                                  by portable fortran code.                       RAD_ALL.7880  
!                                                S.J.Swarbrick                     RAD_ALL.7881  
!       4.4             30-09-96                Effective radius                   RAD_ALL.7882  
!                                               relabelled as                      RAD_ALL.7883  
!                                               characteristic                     RAD_ALL.7884  
!                                               dimension for                      RAD_ALL.7885  
!                                               generality to cover                RAD_ALL.7886  
!                                               parametrizations                   RAD_ALL.7887  
!                                               of non-spherical                   RAD_ALL.7888  
!                                               ice.                               RAD_ALL.7889  
!                                               (J. M. Edwards)                    RAD_ALL.7890  
!                                                                                  RAD_ALL.7891  
! Description of Code:                                                             RAD_ALL.7892  
!   FORTRAN 77  with extensions listed in documentation.                           RAD_ALL.7893  
!                                                                                  RAD_ALL.7894  
!- ---------------------------------------------------------------------           RAD_ALL.7895  
      SUBROUTINE GREY_EXTINCTION(IERR                                              RAD_ALL.7896  
     &   , N_PROFILE, N_LAYER, L_LAYER, P, T, DENSITY                              RAD_ALL.7897  
     &   , L_RESCALE                                                               RAD_ALL.7898  
     &   , L_RAYLEIGH, RAYLEIGH_COEFF                                              RAD_ALL.7899  
     &   , L_CONTINUUM, N_CONTINUUM, I_CONTINUUM_POINTER, K_CONTINUUM              RAD_ALL.7900  
     &   , AMOUNT_CONTINUUM                                                        RAD_ALL.7901  
     &   , L_AEROSOL, N_AEROSOL, AEROSOL_MIX_RATIO                                 RAD_ALL.7902  
     &   , I_AEROSOL_PARAMETRIZATION                                               RAD_ALL.7903  
     &   , I_HUMIDITY_POINTER, HUMIDITIES, DELTA_HUMIDITY                          RAD_ALL.7904  
     &   , MEAN_REL_HUMIDITY                                                       RAD_ALL.7905  
     &   , AEROSOL_ABSORPTION, AEROSOL_SCATTERING, AEROSOL_ASYMMETRY               RAD_ALL.7906  
     &   , L_CLOUD, N_CLOUD_PROFILE, I_CLOUD_PROFILE, N_CLOUD_TOP                  RAD_ALL.7907  
     &   , L_CLOUD_LAYER, I_CLOUD                                                  RAD_ALL.7908  
     &   , N_CONDENSED, L_CLOUD_CMP, I_PHASE_CMP                                   RAD_ALL.7909  
     &   , I_CONDENSED_PARAM, CONDENSED_PARAM_LIST                                 RAD_ALL.7910  
     &   , CONDENSED_MIX_RATIO, CONDENSED_DIM_CHAR                                 RAD_ALL.7911  
     &   , N_CLOUD_TYPE, I_CLOUD_TYPE                                              RAD_ALL.7912  
     &   , K_EXT_TOT_FREE, K_EXT_SCAT_FREE, ASYMMETRY_FREE                         RAD_ALL.7913  
     &   , FORWARD_SCATTER_FREE                                                    RAD_ALL.7914  
     &   , K_EXT_TOT_CLOUD, K_EXT_SCAT_CLOUD                                       RAD_ALL.7915  
     &   , ASYMMETRY_CLOUD, FORWARD_SCATTER_CLOUD                                  RAD_ALL.7916  
     &   , NPD_PROFILE, NPD_LAYER, NPD_CONTINUUM                                   RAD_ALL.7917  
     &   , NPD_AEROSOL_SPECIES, NPD_HUMIDITIES                                     RAD_ALL.7918  
     &   , NPD_CLOUD_PARAMETER                                                     RAD_ALL.7919  
     &   )                                                                         RAD_ALL.7920  
!                                                                                  RAD_ALL.7921  
!                                                                                  RAD_ALL.7922  
!                                                                                  RAD_ALL.7923  
      IMPLICIT NONE                                                                RAD_ALL.7924  
!                                                                                  RAD_ALL.7925  
!                                                                                  RAD_ALL.7926  
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.7927  
     &     NPD_PROFILE                                                             RAD_ALL.7928  
!             MAXIMUM NUMBER OF PROFILES                                           RAD_ALL.7929  
     &   , NPD_LAYER                                                               RAD_ALL.7930  
!             MAXIMUM NUMBER OF LAYERS                                             RAD_ALL.7931  
     &   , NPD_AEROSOL_SPECIES                                                     RAD_ALL.7932  
!             MAXIMUM NUMBER OF AEROSOLS                                           RAD_ALL.7933  
     &   , NPD_HUMIDITIES                                                          RAD_ALL.7934  
!             MAXIMUM NUMBER OF HUMIDITIES                                         RAD_ALL.7935  
     &   , NPD_CONTINUUM                                                           RAD_ALL.7936  
!             MAXIMUM NUMBER OF CONTINUA                                           RAD_ALL.7937  
     &   , NPD_CLOUD_PARAMETER                                                     RAD_ALL.7938  
!             MAXIMUM NUMBER OF CLOUD PARAMETERS                                   RAD_ALL.7939  
!                                                                                  RAD_ALL.7940  
!     INCLUDE COMDECKS                                                             RAD_ALL.7941  
!     ------------------------------------------------------------------           STDIO3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       STDIO3A.3     
!                                                                                  STDIO3A.4     
!     MODULE TO SET UNIT NUMBERS FOR STANDARD I/O.                                 STDIO3A.5     
!                                                                                  STDIO3A.6     
      INTEGER                                                                      STDIO3A.7     
     &     IU_STDIN                                                                STDIO3A.8     
!             UNIT NUMBER FOR STANDARD INPUT                                       STDIO3A.9     
     &   , IU_STDOUT                                                               STDIO3A.10    
!             UNIT NUMBER FOR STANDARD OUTPUT                                      STDIO3A.11    
     *   , IU_ERR                                                                  STDIO3A.12    
!             UNIT NUMBER FOR ERROR MESSAGES                                       STDIO3A.13    
!                                                                                  STDIO3A.14    
      PARAMETER(                                                                   STDIO3A.15    
     &     IU_STDIN=5                                                              STDIO3A.16    
     &   , IU_STDOUT=6                                                             STDIO3A.17    
     *   , IU_ERR=6                                                                STDIO3A.18    
     &   )                                                                         STDIO3A.19    
!                                                                                  STDIO3A.20    
!     ------------------------------------------------------------------           STDIO3A.21    
!     ------------------------------------------------------------------           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    
!     ------------------------------------------------------------------           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    
!     ------------------------------------------------------------------           AERPRM3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       AERPRM3A.3     
!                                                                                  AERPRM3A.4     
!     MODULE TO SET THE AEROSOL PARAMETRIZATIONS.                                  AERPRM3A.5     
!                                                                                  AERPRM3A.6     
      INTEGER                                                                      AERPRM3A.7     
     &     IP_AEROSOL_PARAM_DRY                                                    AERPRM3A.8     
!             PARAMETRIZATION FOR DRY AEROSOLS                                     AERPRM3A.9     
     &   , IP_AEROSOL_PARAM_MOIST                                                  AERPRM3A.10    
!             PARAMETRIZATION FOR MOIST AEROSOLS                                   AERPRM3A.11    
     &   , IP_AEROSOL_UNPARAMETRIZED                                               AERPRM3A.12    
!             OBSERVATIONAL AEROSOL DATA                                           AERPRM3A.13    
!                                                                                  AERPRM3A.14    
      PARAMETER(                                                                   AERPRM3A.15    
     &     IP_AEROSOL_PARAM_DRY=1                                                  AERPRM3A.16    
     &   , IP_AEROSOL_PARAM_MOIST=2                                                AERPRM3A.17    
     &   , IP_AEROSOL_UNPARAMETRIZED=3                                             AERPRM3A.18    
     &   )                                                                         AERPRM3A.19    
!                                                                                  AERPRM3A.20    
!     ------------------------------------------------------------------           AERPRM3A.21    
!     ------------------------------------------------------------------           CLSCHM3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       CLSCHM3A.3     
!                                                                                  CLSCHM3A.4     
!     MODULE TO DEFINE REFERENCE NUMBERS FOR CLOUD SCHEMES.                        CLSCHM3A.5     
!                                                                                  CLSCHM3A.6     
      INTEGER                                                                      CLSCHM3A.7     
     &     IP_CLOUD_SCHMETZ                                                        CLSCHM3A.8     
!             SCHMETZ'S SCHEME                                                     CLSCHM3A.9     
     &   , IP_CLOUD_MIX_MAX                                                        CLSCHM3A.10    
!             MAXIMUM/RANDOM OVERLAP IN A MIXED COLUMN                             CLSCHM3A.11    
     &   , IP_CLOUD_MIX_RANDOM                                                     CLSCHM3A.12    
!             RANDOM OVERLAP IN A MIXED COLUMN                                     CLSCHM3A.13    
     &   , IP_CLOUD_COLUMN_MAX                                                     CLSCHM3A.14    
!             MAXIMUM OVERLAP IN A COLUMN MODEL                                    CLSCHM3A.15    
     &   , IP_CLOUD_CLEAR                                                          CLSCHM3A.16    
!             CLEAR COLUMN                                                         CLSCHM3A.17    
     &   , IP_CLOUD_TRIPLE                                                         CLSCHM3A.18    
!             MIXED COLUMN WITH SPLIT BETWEEN                                      CLSCHM3A.19    
!             CONVECTIVE AND LAYER CLOUD.                                          CLSCHM3A.20    
!                                                                                  CLSCHM3A.21    
      PARAMETER(                                                                   CLSCHM3A.22    
     &     IP_CLOUD_SCHMETZ=1                                                      CLSCHM3A.23    
     &   , IP_CLOUD_MIX_MAX=2                                                      CLSCHM3A.24    
     &   , IP_CLOUD_MIX_RANDOM=4                                                   CLSCHM3A.25    
     &   , IP_CLOUD_COLUMN_MAX=3                                                   CLSCHM3A.26    
     &   , IP_CLOUD_CLEAR=5                                                        CLSCHM3A.27    
     &   , IP_CLOUD_TRIPLE=6                                                       CLSCHM3A.28    
     &   )                                                                         CLSCHM3A.29    
!                                                                                  CLSCHM3A.30    
!     ------------------------------------------------------------------           CLSCHM3A.31    
!     ------------------------------------------------------------------           PHASE3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       PHASE3A.3     
!                                                                                  PHASE3A.4     
!     MODULE TO SET INDICES FOR PHASES.                                            PHASE3A.5     
!                                                                                  PHASE3A.6     
      INTEGER                                                                      PHASE3A.7     
     &     IP_PHASE_WATER                                                          PHASE3A.8     
!             LIQUID PHASE                                                         PHASE3A.9     
     &   , IP_PHASE_ICE                                                            PHASE3A.10    
!             ICE PHASE                                                            PHASE3A.11    
!                                                                                  PHASE3A.12    
      PARAMETER(                                                                   PHASE3A.13    
     &     IP_PHASE_WATER=1                                                        PHASE3A.14    
     &   , IP_PHASE_ICE=2                                                          PHASE3A.15    
     &   )                                                                         PHASE3A.16    
!                                                                                  PHASE3A.17    
!     ------------------------------------------------------------------           PHASE3A.18    
!     ------------------------------------------------------------------           ERROR3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       ERROR3A.3     
!                                                                                  ERROR3A.4     
!     MODULE TO SET ERROR FLAGS IN THE RADIATION CODE.                             ERROR3A.5     
!                                                                                  ERROR3A.6     
      INTEGER                                                                      ERROR3A.7     
     &     I_NORMAL                                                                ERROR3A.8     
!             ERROR FREE CONDITION                                                 ERROR3A.9     
     &   , I_ERR_FATAL                                                             ERROR3A.10    
!             FATAL ERROR: IMMEDIATE RETURN                                        ERROR3A.11    
     &   , I_ABORT_CALCULATION                                                     ERROR3A.12    
!             CALCULATION ABORTED                                                  ERROR3A.13    
     &   , I_MISSING_DATA                                                          ERROR3A.14    
!             MISSING DATA ERROR: CONDITIONAL                                      ERROR3A.15    
     &   , I_ERR_IO                                                                ERROR3A.16    
!             I/O ERROR                                                            ERROR3A.17    
     &   , I_ERR_RANGE                                                             ERROR3A.18    
!             INTERPOLATION RANGE ERROR                                            ERROR3A.19    
     &   , I_ERR_EXIST                                                             ERROR3A.20    
!             EXISTENCE ERROR                                                      ERROR3A.21    
!                                                                                  ERROR3A.22    
      PARAMETER(                                                                   ERROR3A.23    
     &     I_NORMAL=0                                                              ERROR3A.24    
     &   , I_ERR_FATAL=1                                                           ERROR3A.25    
     &   , I_ABORT_CALCULATION=2                                                   ERROR3A.26    
     &   , I_MISSING_DATA=3                                                        ERROR3A.27    
     &   , I_ERR_IO=4                                                              ERROR3A.28    
     &   , I_ERR_RANGE=5                                                           ERROR3A.29    
     &   , I_ERR_EXIST=6                                                           ERROR3A.30    
     &   )                                                                         ERROR3A.31    
!                                                                                  ERROR3A.32    
!     ------------------------------------------------------------------           ERROR3A.33    
!                                                                                  RAD_ALL.7950  
!                                                                                  RAD_ALL.7951  
!                                                                                  RAD_ALL.7952  
!     DUMMY ARGUMENTS.                                                             RAD_ALL.7953  
      INTEGER   !, INTENT(OUT)                                                     RAD_ALL.7954  
     &     IERR                                                                    RAD_ALL.7955  
!             ERROR FLAG                                                           RAD_ALL.7956  
!                                                                                  RAD_ALL.7957  
!                                                                                  RAD_ALL.7958  
!     BASIC ATMOSPHERIC PROPERTIES:                                                RAD_ALL.7959  
!                                                                                  RAD_ALL.7960  
      LOGICAL   !, INTENT(IN)                                                      RAD_ALL.7961  
     &     L_LAYER                                                                 RAD_ALL.7962  
!             VARIABLES GIVEN IN LAYERS                                            RAD_ALL.7963  
!                                                                                  RAD_ALL.7964  
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.7965  
     &     N_PROFILE                                                               RAD_ALL.7966  
!             NUMBER OF PROFILES                                                   RAD_ALL.7967  
     &   , N_LAYER                                                                 RAD_ALL.7968  
!             NUMBER OF LAYERS                                                     RAD_ALL.7969  
!                                                                                  RAD_ALL.7970  
      REAL      !, INTENT(IN)                                                      RAD_ALL.7971  
     &     P(NPD_PROFILE, 0: NPD_LAYER)                                            RAD_ALL.7972  
!             PRESSURE                                                             RAD_ALL.7973  
     &   , T(NPD_PROFILE, 0: NPD_LAYER)                                            RAD_ALL.7974  
!             TEMPERATURE                                                          RAD_ALL.7975  
     &   , DENSITY(NPD_PROFILE, 0: NPD_LAYER)                                      RAD_ALL.7976  
!             DENSITY AT LEVELS                                                    RAD_ALL.7977  
!                                                                                  RAD_ALL.7978  
!                                                                                  RAD_ALL.7979  
!     OPTICAL SWITCHES:                                                            RAD_ALL.7980  
      LOGICAL   !, INTENT(IN)                                                      RAD_ALL.7981  
     &     L_RESCALE                                                               RAD_ALL.7982  
!             DELTA-RESCALING REQUIRED                                             RAD_ALL.7983  
!                                                                                  RAD_ALL.7984  
!                                                                                  RAD_ALL.7985  
!     RAYLEIGH SCATTERING:                                                         RAD_ALL.7986  
!                                                                                  RAD_ALL.7987  
      LOGICAL   !, INTENT(IN)                                                      RAD_ALL.7988  
     &     L_RAYLEIGH                                                              RAD_ALL.7989  
!             RAYLEIGH SCATTERING ACTIVATED                                        RAD_ALL.7990  
!                                                                                  RAD_ALL.7991  
      REAL      !, INTENT(IN)                                                      RAD_ALL.7992  
     &     RAYLEIGH_COEFF                                                          RAD_ALL.7993  
!             RAYLEIGH COEFFICIENT                                                 RAD_ALL.7994  
!                                                                                  RAD_ALL.7995  
!                                                                                  RAD_ALL.7996  
!     CONTINUUM PROCESSES:                                                         RAD_ALL.7997  
      LOGICAL   !, INTENT(IN)                                                      RAD_ALL.7998  
     &     L_CONTINUUM                                                             RAD_ALL.7999  
!             CONTINUUM ABSORPTION ACTIVATED                                       RAD_ALL.8000  
!                                                                                  RAD_ALL.8001  
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.8002  
     &     N_CONTINUUM                                                             RAD_ALL.8003  
!             NUMBER OF CONTINUA                                                   RAD_ALL.8004  
     &   , I_CONTINUUM_POINTER(NPD_CONTINUUM)                                      RAD_ALL.8005  
!             POINTERS TO ACTIVE CONTINUA                                          RAD_ALL.8006  
!                                                                                  RAD_ALL.8007  
      REAL      !, INTENT(IN)                                                      RAD_ALL.8008  
     &     K_CONTINUUM(NPD_CONTINUUM)                                              RAD_ALL.8009  
!             CONTINUUM EXTINCTION                                                 RAD_ALL.8010  
     &   , AMOUNT_CONTINUUM(NPD_PROFILE, 0: NPD_LAYER, NPD_CONTINUUM)              RAD_ALL.8011  
!             AMOUNTS FOR CONTINUA                                                 RAD_ALL.8012  
!                                                                                  RAD_ALL.8013  
!                                                                                  RAD_ALL.8014  
!     PROPERTIES OF AEROSOLS:                                                      RAD_ALL.8015  
!                                                                                  RAD_ALL.8016  
      LOGICAL   !, INTENT(IN)                                                      RAD_ALL.8017  
     &     L_AEROSOL                                                               RAD_ALL.8018  
!             AEROSOLS ACTIVATED                                                   RAD_ALL.8019  
!                                                                                  RAD_ALL.8020  
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.8021  
     &     N_AEROSOL                                                               RAD_ALL.8022  
!             NUMBER OF AEROSOL SPECIES                                            RAD_ALL.8023  
     &   , I_AEROSOL_PARAMETRIZATION(NPD_AEROSOL_SPECIES)                          RAD_ALL.8024  
!             PARAMETRIZATIONS OF AEROSOLS                                         RAD_ALL.8025  
     &   , I_HUMIDITY_POINTER(NPD_PROFILE,  NPD_LAYER)                             RAD_ALL.8026  
!             POINTER TO AEROSOL LOOK-UP TABLE                                     RAD_ALL.8027  
!                                                                                  RAD_ALL.8028  
      REAL      !, INTENT(IN)                                                      RAD_ALL.8029  
     &     AEROSOL_MIX_RATIO(NPD_PROFILE, 0: NPD_LAYER                             RAD_ALL.8030  
     &        , NPD_AEROSOL_SPECIES)                                               RAD_ALL.8031  
!             NUMBER DENSTY OF AEROSOLS                                            RAD_ALL.8032  
     &   , AEROSOL_ABSORPTION(NPD_HUMIDITIES, NPD_AEROSOL_SPECIES)                 RAD_ALL.8033  
!             AEROSOL ABSORPTION IN BAND/MIX RT.                                   RAD_ALL.8034  
     &   , AEROSOL_SCATTERING(NPD_HUMIDITIES, NPD_AEROSOL_SPECIES)                 RAD_ALL.8035  
!             AEROSOL SCATTERING IN BAND/MIX RT.                                   RAD_ALL.8036  
     &   , AEROSOL_ASYMMETRY(NPD_HUMIDITIES, NPD_AEROSOL_SPECIES)                  RAD_ALL.8037  
!             AEROSOL ASYMMETRY IN BAND                                            RAD_ALL.8038  
     &   , HUMIDITIES(NPD_HUMIDITIES, NPD_AEROSOL_SPECIES)                         RAD_ALL.8039  
!             ARRAY OF HUMIDITIES                                                  RAD_ALL.8040  
     &   , DELTA_HUMIDITY                                                          RAD_ALL.8041  
!             INCREMENT IN HUMIDITY                                                RAD_ALL.8042  
     &   , MEAN_REL_HUMIDITY(NPD_PROFILE, NPD_LAYER)                               RAD_ALL.8043  
!             MIXING RATIO OF WATER VAPOUR                                         RAD_ALL.8044  
!                                                                                  RAD_ALL.8045  
!                                                                                  RAD_ALL.8046  
!                                                                                  RAD_ALL.8047  
!     PROPERTIES OF CLOUDS:                                                        RAD_ALL.8048  
!                                                                                  RAD_ALL.8049  
      LOGICAL   !, INTENT(IN)                                                      RAD_ALL.8050  
     &     L_CLOUD                                                                 RAD_ALL.8051  
!             CLOUDS ACTIVATED                                                     RAD_ALL.8052  
!                                                                                  RAD_ALL.8053  
!     GEOMETRY OF CLOUDS:                                                          RAD_ALL.8054  
!                                                                                  RAD_ALL.8055  
      LOGICAL   !, INTENT(IN)                                                      RAD_ALL.8056  
     &     L_CLOUD_LAYER                                                           RAD_ALL.8057  
!             CLOUD VARIABLES GIVEN IN LAYERS                                      RAD_ALL.8058  
!                                                                                  RAD_ALL.8059  
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.8060  
     &     N_CLOUD_TOP                                                             RAD_ALL.8061  
!             TOPMOST CLOUDY LAYER                                                 RAD_ALL.8062  
     &   , I_CLOUD                                                                 RAD_ALL.8063  
!             CLOUD SCHEME TO BE USED                                              RAD_ALL.8064  
     &   , N_CLOUD_TYPE                                                            RAD_ALL.8065  
!             NUMBER OF TYPES OF CLOUDS                                            RAD_ALL.8066  
     &   , N_CLOUD_PROFILE(NPD_LAYER)                                              RAD_ALL.8067  
!             NUMBER OF CLOUDY PROFILES IN EACH LAYER                              RAD_ALL.8068  
     &   , I_CLOUD_PROFILE(NPD_PROFILE, NPD_LAYER)                                 RAD_ALL.8069  
!             PROFILES CONTAINING CLOUDS                                           RAD_ALL.8070  
     &   , I_CLOUD_TYPE(NPD_CLOUD_COMPONENT)                                       RAD_ALL.8071  
!             TYPES OF CLOUD TO WHICH EACH COMPONENT CONTRIBUTES                   RAD_ALL.8072  
!                                                                                  RAD_ALL.8073  
!     MICROPHYSICAL QUANTITIES:                                                    RAD_ALL.8074  
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.8075  
     &     N_CONDENSED                                                             RAD_ALL.8076  
!             NUMBER OF CONDENSED COMPONENTS                                       RAD_ALL.8077  
     &   , I_PHASE_CMP(NPD_CLOUD_COMPONENT)                                        RAD_ALL.8078  
!             PHASES OF CLOUDY COMPONENTS                                          RAD_ALL.8079  
     &   , I_CONDENSED_PARAM(NPD_CLOUD_COMPONENT)                                  RAD_ALL.8080  
!             PARAMETRIZATION SCHEMES FOR CLOUDY COMPONENTS                        RAD_ALL.8081  
!                                                                                  RAD_ALL.8082  
      LOGICAL   !, INTENT(IN)                                                      RAD_ALL.8083  
     &     L_CLOUD_CMP(NPD_CLOUD_COMPONENT)                                        RAD_ALL.8084  
!             FLAGS TO ACTIVATE CLOUDY COMPONENTS                                  RAD_ALL.8085  
!                                                                                  RAD_ALL.8086  
      REAL      !, INTENT(IN)                                                      RAD_ALL.8087  
     &     CONDENSED_PARAM_LIST(NPD_CLOUD_PARAMETER                                RAD_ALL.8088  
     &        , NPD_CLOUD_COMPONENT)                                               RAD_ALL.8089  
!             COEFFICIENTS IN PARAMETRIZATION SCHEMES                              RAD_ALL.8090  
     &   , CONDENSED_MIX_RATIO(NPD_PROFILE, 0: NPD_LAYER                           RAD_ALL.8091  
     &        , NPD_CLOUD_COMPONENT)                                               RAD_ALL.8092  
!             MIXING RATIOS OF CLOUDY COMPONENTS                                   RAD_ALL.8093  
     &   , CONDENSED_DIM_CHAR(NPD_PROFILE, 0: NPD_LAYER                            RAD_ALL.8094  
     &      , NPD_CLOUD_COMPONENT)                                                 RAD_ALL.8095  
!             EFFECTIVE RADII OF CLOUDY COMPONENTS                                 RAD_ALL.8096  
!                                                                                  RAD_ALL.8097  
!                                                                                  RAD_ALL.8098  
!                                                                                  RAD_ALL.8099  
!     CALCULATED OPTICAL PROPETIES:                                                RAD_ALL.8100  
!                                                                                  RAD_ALL.8101  
      REAL      !, INTENT(OUT)                                                     RAD_ALL.8102  
     &     K_EXT_SCAT_FREE(NPD_PROFILE, NPD_LAYER)                                 RAD_ALL.8103  
!             FREE SCATTERING EXTINCTION                                           RAD_ALL.8104  
     &   , K_EXT_TOT_FREE(NPD_PROFILE, NPD_LAYER)                                  RAD_ALL.8105  
!             TOTAL FREE EXTINCTION                                                RAD_ALL.8106  
     &   , ASYMMETRY_FREE(NPD_PROFILE, NPD_LAYER)                                  RAD_ALL.8107  
!             FREE ASYMMETRIES                                                     RAD_ALL.8108  
     &   , FORWARD_SCATTER_FREE(NPD_PROFILE, NPD_LAYER)                            RAD_ALL.8109  
!             FREE FORWARD SCATTERING                                              RAD_ALL.8110  
     &   , K_EXT_SCAT_CLOUD(NPD_PROFILE, NPD_LAYER, NPD_CLOUD_TYPE)                RAD_ALL.8111  
!             CLOUDY SCATTERING EXTINCTION                                         RAD_ALL.8112  
     &   , K_EXT_TOT_CLOUD(NPD_PROFILE, NPD_LAYER, NPD_CLOUD_TYPE)                 RAD_ALL.8113  
!             TOTAL CLOUDY EXTINCTION                                              RAD_ALL.8114  
     &   , ASYMMETRY_CLOUD(NPD_PROFILE, NPD_LAYER, NPD_CLOUD_TYPE)                 RAD_ALL.8115  
!             CLOUDY ASYMMETRIES                                                   RAD_ALL.8116  
     &   , FORWARD_SCATTER_CLOUD(NPD_PROFILE, NPD_LAYER, NPD_CLOUD_TYPE)           RAD_ALL.8117  
!             CLOUDY FORWARD SCATTERING                                            RAD_ALL.8118  
!                                                                                  RAD_ALL.8119  
!                                                                                  RAD_ALL.8120  
!                                                                                  RAD_ALL.8121  
!     LOCAL VARIABLES.                                                             RAD_ALL.8122  
      INTEGER                                                                      RAD_ALL.8123  
     &     I_CONTINUUM                                                             RAD_ALL.8124  
!             TEMPORARY CONTINUUM INDEX                                            RAD_ALL.8125  
     &   , I_POINTER                                                               RAD_ALL.8126  
!             TEMPORARY POINTER                                                    RAD_ALL.8127  
     &   , L                                                                       RAD_ALL.8128  
!             LOOP VARIABLE                                                        RAD_ALL.8129  
     &   , LL                                                                      RAD_ALL.8130  
!             LOOP VARIABLE                                                        RAD_ALL.8131  
     &   , I                                                                       RAD_ALL.8132  
!             LOOP VARIABLE                                                        RAD_ALL.8133  
     &   , J                                                                       RAD_ALL.8134  
!             LOOP VARIABLE                                                        RAD_ALL.8135  
     &   , K                                                                       RAD_ALL.8136  
!             LOOP VARIABLE                                                        RAD_ALL.8137  
     &   , N_INDEX                                                                 RAD_ALL.8138  
!             NUMBER OF INDICES SATISFYING TEST                                    RAD_ALL.8139  
     &   , INDEX(NPD_PROFILE)                                                      RAD_ALL.8140  
!             INDICES OF TESTED POINTS                                             RAD_ALL.8141  
!                                                                                  RAD_ALL.8142  
!     TEMPORARY OPTICAL PROPERTIES:                                                RAD_ALL.8143  
!                                                                                  RAD_ALL.8144  
      REAL                                                                         RAD_ALL.8145  
     &     K_EXT_SCAT_CLOUD_COMP(NPD_PROFILE, NPD_LAYER)                           RAD_ALL.8146  
!             SCATTERING EXTINCTION OF CLOUDY COMPONENT                            RAD_ALL.8147  
     &   , K_EXT_TOT_CLOUD_COMP(NPD_PROFILE, NPD_LAYER)                            RAD_ALL.8148  
!             TOTAL EXTINCTION OF CLOUDY COMPONENT                                 RAD_ALL.8149  
     &   , ASYMMETRY_CLOUD_COMP(NPD_PROFILE, NPD_LAYER)                            RAD_ALL.8150  
!             ASYMMETRIES OF CLOUDY COMPONENT                                      RAD_ALL.8151  
     &   , FORWARD_SCATTER_CLOUD_COMP(NPD_PROFILE, NPD_LAYER)                      RAD_ALL.8152  
!             FORWARD SCATTERING OF CLOUDY COMPONENT                               RAD_ALL.8153  
     &   , K_SCATTER(NPD_PROFILE)                                                  RAD_ALL.8154  
!             SCATTERING VARIABLE                                                  RAD_ALL.8155  
     &   , ASYMMETRY_PROCESS(NPD_PROFILE)                                          RAD_ALL.8156  
!             ASYMMETRY FACTOR FOR CURRENT PROC.                                   RAD_ALL.8157  
!                                                                                  RAD_ALL.8158  
!                                                                                  RAD_ALL.8159  
      REAL                                                                         RAD_ALL.8160  
     &     WEIGHT_UPPER                                                            RAD_ALL.8161  
!             UPPER WEIGHT FOR INTERPOLATION                                       RAD_ALL.8162  
     &   , WEIGHT_LOWER                                                            RAD_ALL.8163  
!             LOWER WEIGHT FOR INTERPOLATION                                       RAD_ALL.8164  
!                                                                                  RAD_ALL.8165  
!     SUBROUTINES CALLED:                                                          RAD_ALL.8166  
      EXTERNAL                                                                     RAD_ALL.8167  
     &     OPT_PROP_WATER_CLOUD, OPT_PROP_ICE_CLOUD                                RAD_ALL.8168  
!                                                                                  RAD_ALL.8169  
!     CRAY DIRECTIVES FOR THE WHOLE ROUTINE:                                       RAD_ALL.8170  
!     POINTS ARE NOT REPEATED IN THE INDEXING ARRAY, SO IT IS SAFE                 RAD_ALL.8171  
!     TO VECTORIZE OVER INDIRECTLY ADDRESSED ARRAYS.                               RAD_ALL.8172  
Cfpp$ NODEPCHK R                                                                   RAD_ALL.8173  
!                                                                                  RAD_ALL.8174  
!                                                                                  RAD_ALL.8175  
!                                                                                  RAD_ALL.8176  
!     INITIALIZE THE EXTINCTION COEFFICIENTS AND THE ASYMMETRY PRODUCT.            RAD_ALL.8177  
      DO I=1, N_LAYER                                                              RAD_ALL.8178  
         DO L=1, N_PROFILE                                                         RAD_ALL.8179  
            K_EXT_TOT_FREE(L, I)=0.0E+00                                           RAD_ALL.8180  
            K_EXT_SCAT_FREE(L, I)=0.0E+00                                          RAD_ALL.8181  
            ASYMMETRY_FREE(L, I)=0.0E+00                                           RAD_ALL.8182  
         ENDDO                                                                     RAD_ALL.8183  
      ENDDO                                                                        RAD_ALL.8184  
!     FORWARD SCATTERING IS REQUIRED ONLY IN THE VISIBLE WHERE                     RAD_ALL.8185  
!     DELTA-RESCALING IS PERFORMED.                                                RAD_ALL.8186  
      IF (L_RESCALE) THEN                                                          RAD_ALL.8187  
         DO I=1, N_LAYER                                                           RAD_ALL.8188  
            DO L=1, N_PROFILE                                                      RAD_ALL.8189  
               FORWARD_SCATTER_FREE(L, I)=0.0E+00                                  RAD_ALL.8190  
            ENDDO                                                                  RAD_ALL.8191  
         ENDDO                                                                     RAD_ALL.8192  
      ENDIF                                                                        RAD_ALL.8193  
!                                                                                  RAD_ALL.8194  
      IF (L_RAYLEIGH) THEN                                                         RAD_ALL.8195  
!        INCLUDE RAYLEIGH SCATTERING.                                              RAD_ALL.8196  
         DO I=1, N_LAYER                                                           RAD_ALL.8197  
            DO L=1, N_PROFILE                                                      RAD_ALL.8198  
               K_EXT_SCAT_FREE(L, I)                                               RAD_ALL.8199  
     &             =K_EXT_SCAT_FREE(L, I)+RAYLEIGH_COEFF                           RAD_ALL.8200  
            ENDDO                                                                  RAD_ALL.8201  
         ENDDO                                                                     RAD_ALL.8202  
      ENDIF                                                                        RAD_ALL.8203  
!                                                                                  RAD_ALL.8204  
      IF (L_AEROSOL) THEN                                                          RAD_ALL.8205  
!        INCLUDE THE EFFECTS OF AEROSOL.                                           RAD_ALL.8206  
         DO J=1, N_AEROSOL                                                         RAD_ALL.8207  
            IF (I_AEROSOL_PARAMETRIZATION(J)                                       RAD_ALL.8208  
     &         .EQ.IP_AEROSOL_PARAM_DRY) THEN                                      RAD_ALL.8209  
               DO I=1, N_LAYER                                                     RAD_ALL.8210  
                  DO L=1, N_PROFILE                                                RAD_ALL.8211  
                     K_EXT_TOT_FREE(L, I)=K_EXT_TOT_FREE(L, I)                     RAD_ALL.8212  
     &                  +AEROSOL_MIX_RATIO(L, I, J)                                RAD_ALL.8213  
     &                  *AEROSOL_ABSORPTION(1, J)                                  RAD_ALL.8214  
                     K_SCATTER(L)=AEROSOL_MIX_RATIO(L, I, J)                       RAD_ALL.8215  
     &                  *AEROSOL_SCATTERING(1, J)                                  RAD_ALL.8216  
                     K_EXT_SCAT_FREE(L, I)=K_EXT_SCAT_FREE(L, I)                   RAD_ALL.8217  
     &                  +K_SCATTER(L)                                              RAD_ALL.8218  
                     ASYMMETRY_FREE(L, I)=ASYMMETRY_FREE(L, I)                     RAD_ALL.8219  
     &                  +K_SCATTER(L)*AEROSOL_ASYMMETRY(1, J)                      RAD_ALL.8220  
                  ENDDO                                                            RAD_ALL.8221  
                  IF (L_RESCALE) THEN                                              RAD_ALL.8222  
!                    THIS BLOCK IS PLACED WITHIN THE LOOP OVER I TO SAVE           RAD_ALL.8223  
!                    STORAGE. THE COST OF RE-EXECUTING THE TEST IS QUITE           RAD_ALL.8224  
!                    SMALL.                                                        RAD_ALL.8225  
                     DO L=1, N_PROFILE                                             RAD_ALL.8226  
                        FORWARD_SCATTER_FREE(L, I)                                 RAD_ALL.8227  
     &                     =FORWARD_SCATTER_FREE(L, I)+K_SCATTER(L)                RAD_ALL.8228  
     &                     *(AEROSOL_ASYMMETRY(1, J))**2                           RAD_ALL.8229  
                     ENDDO                                                         RAD_ALL.8230  
                  ENDIF                                                            RAD_ALL.8231  
               ENDDO                                                               RAD_ALL.8232  
            ELSE IF (I_AEROSOL_PARAMETRIZATION(J)                                  RAD_ALL.8233  
     &         .EQ.IP_AEROSOL_PARAM_MOIST) THEN                                    RAD_ALL.8234  
               DO I=1, N_LAYER                                                     RAD_ALL.8235  
                  DO L=1, N_PROFILE                                                RAD_ALL.8236  
                     I_POINTER=I_HUMIDITY_POINTER(L, I)                            RAD_ALL.8237  
                     WEIGHT_UPPER=(MEAN_REL_HUMIDITY(L, I)                         RAD_ALL.8238  
     &                 -HUMIDITIES(I_POINTER, J))                                  RAD_ALL.8239  
     &                 /DELTA_HUMIDITY                                             RAD_ALL.8240  
                     WEIGHT_LOWER=1.0E+00-WEIGHT_UPPER                             RAD_ALL.8241  
                     K_EXT_TOT_FREE(L, I)=K_EXT_TOT_FREE(L, I)                     RAD_ALL.8242  
     &                  +AEROSOL_MIX_RATIO(L, I, J)                                RAD_ALL.8243  
     &                  *(AEROSOL_ABSORPTION(I_POINTER, J)                         RAD_ALL.8244  
     &                  *WEIGHT_LOWER+WEIGHT_UPPER                                 RAD_ALL.8245  
     &                  *AEROSOL_ABSORPTION(I_POINTER+1, J))                       RAD_ALL.8246  
                     K_SCATTER(L)=                                                 RAD_ALL.8247  
     &                  AEROSOL_MIX_RATIO(L, I, J)                                 RAD_ALL.8248  
     &                  *(AEROSOL_SCATTERING(I_POINTER, J)                         RAD_ALL.8249  
     &                  *WEIGHT_LOWER+WEIGHT_UPPER                                 RAD_ALL.8250  
     &                  *AEROSOL_SCATTERING(I_POINTER+1, J))                       RAD_ALL.8251  
                     K_EXT_SCAT_FREE(L, I)=K_EXT_SCAT_FREE(L, I)                   RAD_ALL.8252  
     &                  +K_SCATTER(L)                                              RAD_ALL.8253  
                     ASYMMETRY_PROCESS(L)=                                         RAD_ALL.8254  
     &                  AEROSOL_ASYMMETRY(I_POINTER, J)                            RAD_ALL.8255  
     &                  *WEIGHT_LOWER+WEIGHT_UPPER                                 RAD_ALL.8256  
     &                  *AEROSOL_ASYMMETRY(I_POINTER+1, J)                         RAD_ALL.8257  
                     ASYMMETRY_FREE(L, I)=ASYMMETRY_FREE(L, I)                     RAD_ALL.8258  
     &                  +K_SCATTER(L)*ASYMMETRY_PROCESS(L)                         RAD_ALL.8259  
                  ENDDO                                                            RAD_ALL.8260  
                  IF (L_RESCALE) THEN                                              RAD_ALL.8261  
                     DO L=1, N_PROFILE                                             RAD_ALL.8262  
                        FORWARD_SCATTER_FREE(L, I)                                 RAD_ALL.8263  
     &                     =FORWARD_SCATTER_FREE(L, I)+K_SCATTER(L)                RAD_ALL.8264  
     &                     *(ASYMMETRY_PROCESS(L))**2                              RAD_ALL.8265  
                     ENDDO                                                         RAD_ALL.8266  
                  ENDIF                                                            RAD_ALL.8267  
               ENDDO                                                               RAD_ALL.8268  
            ELSE                                                                   RAD_ALL.8269  
               WRITE(IU_ERR, '(/A, I3, A)')                                        RAD_ALL.8270  
     &            '*** ERROR : I_AEROSOL_PARAMETRIZATION FOR SPECIES '             RAD_ALL.8271  
     &            , J, ' HAS BEEN SET TO AN ILLEGAL VALUE.'                        RAD_ALL.8272  
               IERR=I_ERR_FATAL                                                    RAD_ALL.8273  
               RETURN                                                              RAD_ALL.8274  
                                                                                   RAD_ALL.8275  
            ENDIF                                                                  RAD_ALL.8276  
         ENDDO                                                                     RAD_ALL.8277  
      ENDIF                                                                        RAD_ALL.8278  
!                                                                                  RAD_ALL.8279  
      IF (L_CONTINUUM) THEN                                                        RAD_ALL.8280  
!        INCLUDE CONTINUUM ABSORPTION.                                             RAD_ALL.8281  
         DO J=1, N_CONTINUUM                                                       RAD_ALL.8282  
            I_CONTINUUM=I_CONTINUUM_POINTER(J)                                     RAD_ALL.8283  
            DO I=1, N_LAYER                                                        RAD_ALL.8284  
               DO L=1, N_PROFILE                                                   RAD_ALL.8285  
                  K_EXT_TOT_FREE(L, I)=K_EXT_TOT_FREE(L, I)                        RAD_ALL.8286  
     &               +K_CONTINUUM(I_CONTINUUM)                                     RAD_ALL.8287  
     &               *AMOUNT_CONTINUUM(L, I, I_CONTINUUM)                          RAD_ALL.8288  
               ENDDO                                                               RAD_ALL.8289  
            ENDDO                                                                  RAD_ALL.8290  
         ENDDO                                                                     RAD_ALL.8291  
      ENDIF                                                                        RAD_ALL.8292  
!                                                                                  RAD_ALL.8293  
!                                                                                  RAD_ALL.8294  
!     ADD THE SCATTERING ON TO THE TOTAL EXTINCTION. THE FINAL FREE                RAD_ALL.8295  
!     ASYMMETRY IS NOT CALCULATED HERE SINCE THE PRODUCT OF ASYMMETRY              RAD_ALL.8296  
!     AND SCATTERING IS ALSO NEEDED TO CALCULATE THE CLOUDY ASYMMETRY.             RAD_ALL.8297  
      DO I=1, N_LAYER                                                              RAD_ALL.8298  
         DO L=1, N_PROFILE                                                         RAD_ALL.8299  
            K_EXT_TOT_FREE(L, I)=K_EXT_TOT_FREE(L, I)                              RAD_ALL.8300  
     &         +K_EXT_SCAT_FREE(L, I)                                              RAD_ALL.8301  
         ENDDO                                                                     RAD_ALL.8302  
      ENDDO                                                                        RAD_ALL.8303  
!                                                                                  RAD_ALL.8304  
!                                                                                  RAD_ALL.8305  
!     IF THERE ARE NO CLOUDS CALCULATE THE FINAL OPTICAL PROPERTIES                RAD_ALL.8306  
!     AND RETURN TO THE CALLING ROUTINE.                                           RAD_ALL.8307  
!                                                                                  RAD_ALL.8308  
      IF (.NOT.L_CLOUD) THEN                                                       RAD_ALL.8309  
!                                                                                  RAD_ALL.8310  
         DO I=1, N_LAYER                                                           RAD_ALL.8311  
            DO L=1, N_PROFILE                                                      RAD_ALL.8312  
               IF (K_EXT_SCAT_FREE(L, I).GT.TOL_DIV) THEN                          RAD_ALL.8313  
                  ASYMMETRY_FREE(L, I)=ASYMMETRY_FREE(L, I)                        RAD_ALL.8314  
     &               /K_EXT_SCAT_FREE(L, I)                                        RAD_ALL.8315  
               ENDIF                                                               RAD_ALL.8316  
            ENDDO                                                                  RAD_ALL.8317  
         ENDDO                                                                     RAD_ALL.8318  
         IF (L_RESCALE) THEN                                                       RAD_ALL.8319  
            DO I=1, N_LAYER                                                        RAD_ALL.8320  
               DO L=1, N_PROFILE                                                   RAD_ALL.8321  
                  IF (K_EXT_SCAT_FREE(L, I).GT.TOL_DIV) THEN                       RAD_ALL.8322  
                     FORWARD_SCATTER_FREE(L, I)                                    RAD_ALL.8323  
     &                  =FORWARD_SCATTER_FREE(L, I)                                RAD_ALL.8324  
     &                  /K_EXT_SCAT_FREE(L, I)                                     RAD_ALL.8325  
                  ENDIF                                                            RAD_ALL.8326  
               ENDDO                                                               RAD_ALL.8327  
            ENDDO                                                                  RAD_ALL.8328  
!                                                                                  RAD_ALL.8329  
         ENDIF                                                                     RAD_ALL.8330  
!                                                                                  RAD_ALL.8331  
         RETURN                                                                    RAD_ALL.8332  
!                                                                                  RAD_ALL.8333  
      ENDIF                                                                        RAD_ALL.8334  
!                                                                                  RAD_ALL.8335  
!                                                                                  RAD_ALL.8336  
!                                                                                  RAD_ALL.8337  
!                                                                                  RAD_ALL.8338  
!     ADDITION OF CLOUDY PROPERTIES:                                               RAD_ALL.8339  
!                                                                                  RAD_ALL.8340  
!                                                                                  RAD_ALL.8341  
!     ADD IN BACKGROUND CONTIBUTIONS:                                              RAD_ALL.8342  
!                                                                                  RAD_ALL.8343  
      IF (I_CLOUD.NE.IP_CLOUD_SCHMETZ) THEN                                        RAD_ALL.8344  
!                                                                                  RAD_ALL.8345  
!        ALL THE PROCESSES OCCURRING OUTSIDE CLOUDS ALSO OCCUR                     RAD_ALL.8346  
!        WITHIN THEM.                                                              RAD_ALL.8347  
         DO K=1, N_CLOUD_TYPE                                                      RAD_ALL.8348  
            DO I=1, N_LAYER                                                        RAD_ALL.8349  
               DO L=1, N_PROFILE                                                   RAD_ALL.8350  
                  K_EXT_TOT_CLOUD(L, I, K)=K_EXT_TOT_FREE(L, I)                    RAD_ALL.8351  
                  K_EXT_SCAT_CLOUD(L, I, K)=K_EXT_SCAT_FREE(L, I)                  RAD_ALL.8352  
                  ASYMMETRY_CLOUD(L, I, K)=ASYMMETRY_FREE(L, I)                    RAD_ALL.8353  
                  FORWARD_SCATTER_CLOUD(L, I, K)                                   RAD_ALL.8354  
     &               =FORWARD_SCATTER_FREE(L, I)                                   RAD_ALL.8355  
               ENDDO                                                               RAD_ALL.8356  
            ENDDO                                                                  RAD_ALL.8357  
         ENDDO                                                                     RAD_ALL.8358  
!                                                                                  RAD_ALL.8359  
      ELSE IF (I_CLOUD.EQ.IP_CLOUD_SCHMETZ) THEN                                   RAD_ALL.8360  
!                                                                                  RAD_ALL.8361  
!        IN SCHEMTZ'S ALGORITHM THE CLOUDY FLUXES SUBSEQUENTLY PASS                RAD_ALL.8362  
!        THROUGH THE FREE PART OF THE LAYER, SO THE CLOUDY OPTICAL                 RAD_ALL.8363  
!        PROPERTIES MUST BE DERIVED ONLY FROM THE PURELY CLOUDY                    RAD_ALL.8364  
!        CONTRIBUTIONS.                                                            RAD_ALL.8365  
         DO K=1, N_CLOUD_TYPE                                                      RAD_ALL.8366  
            DO I=1, N_LAYER                                                        RAD_ALL.8367  
               DO L=1, N_PROFILE                                                   RAD_ALL.8368  
                  K_EXT_TOT_CLOUD(L, I, K)=0.0E+00                                 RAD_ALL.8369  
                  K_EXT_SCAT_CLOUD(L, I, K)=0.0E+00                                RAD_ALL.8370  
                  ASYMMETRY_CLOUD(L, I, K)=0.0E+00                                 RAD_ALL.8371  
                  FORWARD_SCATTER_CLOUD(L, I, K)=0.0E+00                           RAD_ALL.8372  
               ENDDO                                                               RAD_ALL.8373  
            ENDDO                                                                  RAD_ALL.8374  
         ENDDO                                                                     RAD_ALL.8375  
!                                                                                  RAD_ALL.8376  
      ENDIF                                                                        RAD_ALL.8377  
!                                                                                  RAD_ALL.8378  
!                                                                                  RAD_ALL.8379  
!     ADD ON THE TERMS REPRESENTING PROCESSES WITHIN CLOUDS.                       RAD_ALL.8380  
!                                                                                  RAD_ALL.8381  
!     LOOP OVER THE CONDENSED COMPONENTS, CALCULATING THEIR OPTICAL                RAD_ALL.8382  
!     PROPERTIES AND THEN ASSIGN THEM TO THE ARRAYS FOR THE TYPES OF               RAD_ALL.8383  
!     CLOUD.                                                                       RAD_ALL.8384  
!                                                                                  RAD_ALL.8385  
      DO K=1, N_CONDENSED                                                          RAD_ALL.8386  
!                                                                                  RAD_ALL.8387  
!        FLAGS FOR DEALING WITH COMPONENTS WERE SET IN THE SUBROUTINE              RAD_ALL.8388  
!        SET_CLOUD_POINTER. WE NOW DETERMINE WHETHER THE COMPONENT IS              RAD_ALL.8389  
!        TO BE INCLUDED AND CALCULATE ITS OPTICAL PROPERTIES ACCORDING             RAD_ALL.8390  
!        TO THE PHASE OF THE COMPONENT. THESE CONTRIBUTIONS ARE ADDED              RAD_ALL.8391  
!        TO THE ARRAYS FOR THE SELECTED TYPE OF CLOUD.                             RAD_ALL.8392  
!                                                                                  RAD_ALL.8393  
         IF (L_CLOUD_CMP(K)) THEN                                                  RAD_ALL.8394  
!                                                                                  RAD_ALL.8395  
            IF (I_PHASE_CMP(K).EQ.IP_PHASE_WATER) THEN                             RAD_ALL.8396  
!                                                                                  RAD_ALL.8397  
!              INCLUDE SCATTERING BY WATER DROPLETS.                               RAD_ALL.8398  
!                                                                                  RAD_ALL.8399  
               CALL OPT_PROP_WATER_CLOUD(IERR                                      RAD_ALL.8400  
     &            , N_PROFILE, N_LAYER, N_CLOUD_TOP                                RAD_ALL.8401  
     &            , N_CLOUD_PROFILE, I_CLOUD_PROFILE                               RAD_ALL.8402  
     &            , L_RESCALE, L_LAYER, L_CLOUD_LAYER                              RAD_ALL.8403  
     &            , I_CONDENSED_PARAM(K), CONDENSED_PARAM_LIST(1, K)               RAD_ALL.8404  
     &            , CONDENSED_MIX_RATIO(1, 0, K)                                   RAD_ALL.8405  
     &            , CONDENSED_DIM_CHAR(1, 0, K)                                    RAD_ALL.8406  
     &            , K_EXT_TOT_CLOUD_COMP, K_EXT_SCAT_CLOUD_COMP                    RAD_ALL.8407  
     &            , ASYMMETRY_CLOUD_COMP, FORWARD_SCATTER_CLOUD_COMP               RAD_ALL.8408  
     &            , NPD_PROFILE, NPD_LAYER                                         RAD_ALL.8409  
     &            , NPD_CLOUD_PARAMETER                                            RAD_ALL.8410  
     &            )                                                                RAD_ALL.8411  
!                                                                                  RAD_ALL.8412  
 2          ELSE IF (I_PHASE_CMP(K).EQ.IP_PHASE_ICE) THEN                          RAD_ALL.8413  
!                                                                                  RAD_ALL.8414  
!              INCLUDE SCATTERING BY ICE CRYSTALS.                                 RAD_ALL.8415  
!                                                                                  RAD_ALL.8416  
               CALL OPT_PROP_ICE_CLOUD(IERR                                        RAD_ALL.8417  
     &            , N_PROFILE, N_LAYER, N_CLOUD_TOP                                RAD_ALL.8418  
     &            , N_CLOUD_PROFILE, I_CLOUD_PROFILE                               RAD_ALL.8419  
     &            , L_RESCALE, L_LAYER, L_CLOUD_LAYER                              RAD_ALL.8420  
     &            , I_CONDENSED_PARAM(K), CONDENSED_PARAM_LIST(1, K)               RAD_ALL.8421  
     &            , CONDENSED_MIX_RATIO(1, 0, K)                                   RAD_ALL.8422  
     &            , CONDENSED_DIM_CHAR(1, 0, K)                                    RAD_ALL.8423  
     &            , T, DENSITY                                                     RAD_ALL.8424  
     &            , K_EXT_TOT_CLOUD_COMP, K_EXT_SCAT_CLOUD_COMP                    RAD_ALL.8425  
     &            , ASYMMETRY_CLOUD_COMP, FORWARD_SCATTER_CLOUD_COMP               RAD_ALL.8426  
     &            , NPD_PROFILE, NPD_LAYER                                         RAD_ALL.8427  
     &            , NPD_CLOUD_PARAMETER                                            RAD_ALL.8428  
     &            )                                                                RAD_ALL.8429  
!                                                                                  RAD_ALL.8430  
            ENDIF                                                                  RAD_ALL.8431  
!                                                                                  RAD_ALL.8432  
!                                                                                  RAD_ALL.8433  
!                                                                                  RAD_ALL.8434  
!           INCREMENT THE ARRAYS OF OPTICAL PROPERTIES.                            RAD_ALL.8435  
!                                                                                  RAD_ALL.8436  
!                                                                                  RAD_ALL.8437  
            DO I=N_CLOUD_TOP, N_LAYER                                              RAD_ALL.8438  
               DO LL=1, N_CLOUD_PROFILE(I)                                         RAD_ALL.8439  
                  L=I_CLOUD_PROFILE(LL, I)                                         RAD_ALL.8440  
                  K_EXT_TOT_CLOUD(L, I, I_CLOUD_TYPE(K))                           RAD_ALL.8441  
     &               =K_EXT_TOT_CLOUD(L, I, I_CLOUD_TYPE(K))                       RAD_ALL.8442  
     &               +K_EXT_TOT_CLOUD_COMP(L, I)                                   RAD_ALL.8443  
                  K_EXT_SCAT_CLOUD(L, I, I_CLOUD_TYPE(K))                          RAD_ALL.8444  
     &               =K_EXT_SCAT_CLOUD(L, I, I_CLOUD_TYPE(K))                      RAD_ALL.8445  
     &               +K_EXT_SCAT_CLOUD_COMP(L, I)                                  RAD_ALL.8446  
                  ASYMMETRY_CLOUD(L, I, I_CLOUD_TYPE(K))                           RAD_ALL.8447  
     &               =ASYMMETRY_CLOUD(L, I, I_CLOUD_TYPE(K))                       RAD_ALL.8448  
     &               +ASYMMETRY_CLOUD_COMP(L, I)                                   RAD_ALL.8449  
               ENDDO                                                               RAD_ALL.8450  
            ENDDO                                                                  RAD_ALL.8451  
            IF (L_RESCALE) THEN                                                    RAD_ALL.8452  
               DO I=N_CLOUD_TOP, N_LAYER                                           RAD_ALL.8453  
                  DO LL=1, N_CLOUD_PROFILE(I)                                      RAD_ALL.8454  
                     L=I_CLOUD_PROFILE(LL, I)                                      RAD_ALL.8455  
                     FORWARD_SCATTER_CLOUD(L, I, I_CLOUD_TYPE(K))                  RAD_ALL.8456  
     &                  =FORWARD_SCATTER_CLOUD(L, I, I_CLOUD_TYPE(K))              RAD_ALL.8457  
     &                  +FORWARD_SCATTER_CLOUD_COMP(L, I)                          RAD_ALL.8458  
                  ENDDO                                                            RAD_ALL.8459  
               ENDDO                                                               RAD_ALL.8460  
            ENDIF                                                                  RAD_ALL.8461  
!                                                                                  RAD_ALL.8462  
         ENDIF                                                                     RAD_ALL.8463  
!                                                                                  RAD_ALL.8464  
      ENDDO                                                                        RAD_ALL.8465  
!                                                                                  RAD_ALL.8466  
!                                                                                  RAD_ALL.8467  
!                                                                                  RAD_ALL.8468  
!                                                                                  RAD_ALL.8469  
!     CALCULATE THE FINAL OPTICAL PROPERTIES.                                      RAD_ALL.8470  
!     THE SCATTERING WAS INCLUDED IN THE FREE TOTAL EXTINCTION EARLIER,            RAD_ALL.8471  
!     BUT WE HAVE YET TO DIVIDE THE PRODUCT OF THE ASYMMETRY AND THE               RAD_ALL.8472  
!     SCATTERING BY THE MEAN SCATTERING.                                           RAD_ALL.8473  
!                                                                                  RAD_ALL.8474  
      DO I=1, N_LAYER                                                              RAD_ALL.8475  
!                                                                                  RAD_ALL.8476  
         N_INDEX=0                                                                 RAD_ALL.8477  
         DO L   =1,N_PROFILE                                                       RAD_ALL.8478  
           IF (K_EXT_SCAT_FREE(L,I).GT.TOL_DIV) THEN                               RAD_ALL.8479  
             N_INDEX       =N_INDEX+1                                              RAD_ALL.8480  
             INDEX(N_INDEX)=L                                                      RAD_ALL.8481  
           END IF                                                                  RAD_ALL.8482  
         END DO                                                                    RAD_ALL.8483  
!                                                                                  RAD_ALL.8484  
         DO K=1, N_INDEX                                                           RAD_ALL.8485  
               ASYMMETRY_FREE(INDEX(K), I)=ASYMMETRY_FREE(INDEX(K), I)             RAD_ALL.8486  
     &            /K_EXT_SCAT_FREE(INDEX(K), I)                                    RAD_ALL.8487  
         ENDDO                                                                     RAD_ALL.8488  
!                                                                                  RAD_ALL.8489  
         IF (L_RESCALE) THEN                                                       RAD_ALL.8490  
            DO K=1, N_INDEX                                                        RAD_ALL.8491  
               FORWARD_SCATTER_FREE(INDEX(K), I)                                   RAD_ALL.8492  
     &            =FORWARD_SCATTER_FREE(INDEX(K), I)                               RAD_ALL.8493  
     &            /K_EXT_SCAT_FREE(INDEX(K), I)                                    RAD_ALL.8494  
            ENDDO                                                                  RAD_ALL.8495  
         ENDIF                                                                     RAD_ALL.8496  
      ENDDO                                                                        RAD_ALL.8497  
!                                                                                  RAD_ALL.8498  
!                                                                                  RAD_ALL.8499  
!     REPEAT FOR CLOUDS.                                                           RAD_ALL.8500  
      DO K=1, N_CLOUD_TYPE                                                         RAD_ALL.8501  
         DO I=N_CLOUD_TOP, N_LAYER                                                 RAD_ALL.8502  
!                                                                                  RAD_ALL.8503  
            J      =1                                                              RAD_ALL.8504  
            N_INDEX=0                                                              RAD_ALL.8505  
            DO L   =1,N_PROFILE                                                    RAD_ALL.8506  
              IF (K_EXT_SCAT_CLOUD(L,I,K).GT.TOL_DIV) THEN                         RAD_ALL.8507  
                INDEX(J)=L                                                         RAD_ALL.8508  
                J       =J+1                                                       RAD_ALL.8509  
                N_INDEX =N_INDEX+1                                                 RAD_ALL.8510  
              END IF                                                               RAD_ALL.8511  
            END DO                                                                 RAD_ALL.8512  
                                                                                   RAD_ALL.8513  
            DO J=1, N_INDEX                                                        RAD_ALL.8514  
               ASYMMETRY_CLOUD(INDEX(J), I, K)                                     RAD_ALL.8515  
     &            =ASYMMETRY_CLOUD(INDEX(J), I, K)                                 RAD_ALL.8516  
     &            /K_EXT_SCAT_CLOUD(INDEX(J), I, K)                                RAD_ALL.8517  
            ENDDO                                                                  RAD_ALL.8518  
            IF (L_RESCALE) THEN                                                    RAD_ALL.8519  
               DO J=1, N_INDEX                                                     RAD_ALL.8520  
                  FORWARD_SCATTER_CLOUD(INDEX(J), I, K)                            RAD_ALL.8521  
     &               =FORWARD_SCATTER_CLOUD(INDEX(J), I, K)                        RAD_ALL.8522  
     &               /K_EXT_SCAT_CLOUD(INDEX(J), I, K)                             RAD_ALL.8523  
               ENDDO                                                               RAD_ALL.8524  
            ENDIF                                                                  RAD_ALL.8525  
         ENDDO                                                                     RAD_ALL.8526  
      ENDDO                                                                        RAD_ALL.8527  
!                                                                                  RAD_ALL.8528  
!                                                                                  RAD_ALL.8529  
!                                                                                  RAD_ALL.8530  
!                                                                                  RAD_ALL.8531  
      RETURN                                                                       RAD_ALL.8532  
      END    
