      SUBROUTINE PAMDRIV(OEDNROW,OERCROW,OIDNROW,OIRCROW,SVVBROW, &
                         PSVVROW,SVMBROW,SVCBROW,PNVBROW,PNMBROW, &
                         PNCBROW,PSVBROW,PSMBROW,PSCBROW,QNVBROW, &
                         QNMBROW,QNCBROW,QSVBROW,QSMBROW,QSCBROW, &
                         QGVBROW,QGMBROW,QGCBROW,QDVBROW,QDMBROW, &
                         QDCBROW,ONVBROW,ONMBROW,ONCBROW,OSVBROW, &
                         OSMBROW,OSCBROW,OGVBROW,OGMBROW,OGCBROW, &
                         DEVBROW,PDEVROW,DEMBROW,DECBROW,DIVBROW, &
                         PDIVROW,DIMBROW,DICBROW,REVBROW,PREVROW, &
                         REMBROW,RECBROW,RIVBROW,PRIVROW,RIMBROW, &
                         RICBROW, &
                         XROW,SFRCROL,IAIND,ILG,ILEVP1,NTRAC,MSGP2, &
                         IL1,IL2,ISO2,IHPO,IGS6,IGSP,NTRACP, &
                         ILEV,ICAN,MSGP1,ZH,ZF,PH,PF,DP,THROW,QROW, &
                         QTN,HMN,RHC,RHT,WG,WSUB,ZMRATEP,ZMLWC,ZFSNOW, &
                         ZFRAIN,ZCLF,CLRFR,CLRFS,ZFEVAP,ZFSUBL, &
                         PBLTROW,SMFRAC,FCS,FGS,FC,FG, &
                         ZSPD,ZSPDSO,ZSPDSBS,CDML,CDMNL,USTARBS, &
                         FLND,FOCN,SICN,GTROW,FNROL, &
                         FCANROW,SPOTROW,ST02ROW,ST03ROW,ST04ROW, &
                         ST06ROW,ST13ROW,ST14ROW,ST15ROW,ST16ROW, &
                         ST17ROW,SUZ0ROW,BSFRAC,PDSFROW,ATAU,ZFS,PFS, &
                         SGPP,OGPP,DOCEM1,DOCEM2,DOCEM3,DOCEM4,DBCEM1, &
                         DBCEM2,DBCEM3,DBCEM4,DSUEM1,DSUEM2,DSUEM3, &
                         DSUEM4,O3ROW,HNO3ROW,NH3ROW,NH4ROW,TIMST, &
                         CO2_PPM,KOUNT,TMIN,ZCDNROW,BCICROW,DEPBROL, &
                         CORNROW,CORMROW,RSN1ROW,RSM1ROW, &
                         VRN1ROW,VRM1ROW,RSN2ROW,RSM2ROW,VRN2ROW, &
                         VRM2ROW,RSN3ROW,RSM3ROW,VRN3ROW,VRM3ROW, &
                         VNCNROW,VASNROW,VSCDROW,VGSPROW,SNCNROW, &
                         SSUNROW,SCNDROW,SGSPROW,DEFXROW,DEFNROW, &
                         ACASROW,ACOAROW,ACBCROW,ACSSROW,ACMDROW, &
                         NTROW,N20ROW,N50ROW,N100ROW,N200ROW, &
                         WTROW,W20ROW,W50ROW,W100ROW,W200ROW,CCNROW, &
                         CCNEROW,CC02ROW,CC04ROW,CC08ROW,CC16ROW, &
                         RCRIROW,SUPSROW,VOAEROW,VBCEROW,VASEROW, &
                         VMDEROW,VSSEROW,VOAWROW,VBCWROW,VASWROW, &
                         VMDWROW,VSSWROW,VOADROW,VBCDROW,VASDROW, &
                         VMDDROW,VSSDROW,VOAGROW,VBCGROW,VASGROW, &
                         VMDGROW,VSSGROW,VASIROW,VAS1ROW,VAS2ROW, &
                         VAS3ROW,HENRROW,O3FROW,H2O2FROW,WPARROW, &
                         VCCNROW,VCNEROW,DMACROW,DMCOROW,DNACROW, &
                         DNCOROW,DUWDROW,DUSTROW,DUTHROW,FALLROW, &
                         FA10ROW,FA2ROW ,FA1ROW ,USMKROW,DEFAROW, &
                         DEFCROW,SICN_CRT,SAVERAD,ISVDUST,LEVA)
!-----------------------------------------------------------------------
!     PURPOSE:
!     --------
!     DRIVER FOR PLA AEROSOL MODEL (PAM).
!
!     HISTORY:
!     --------
!     * SEP 26/2017 - K.VONSALZEN   UPDATED FOR CANAM5
!     * APR 17/2015 - K.VONSALZEN   ADDITION OF DIAGNOSTIC FIELDS
!     *                             FOR CN NUMBER CONCENTRATION
!     * AUG 18/2014 - K.VONSALZEN   VERSION 2 OF PAM FOR CANAM4.3:
!     *                             CHANGES RELATED TO LAND-SURFACE,
!     *                             CLOUD MICROPHYSICS, AND DIAGNOSTICS
!     * JUN 10/2014 - K.VONSALZEN   CHANGES TO SUPPORT EXTRA CLOUD FIELDS,
!     *                             ACCUMULATION OF RESULTS
!     * JUL 17/2013 - M.LAZARE.     PASS IN "ISVDUST" AND USE THIS
!     *                             SWITCH INSTEAD OF "KXTRA2" TO
!     *                             CONTROL SAVING OF:
!     *                             {USMK,DUWD,DUST,DUTH,FALL,FA1,FA2,FA10}.
!     * FEB 20/2012 - K.VONSALZEN   NEW.
!
!-----------------------------------------------------------------------
!-----------------------------------------------------------------------
!
!     LIST OF VARIABLES (TYPE, I: INPUT, O: OUTPUT, IO: IN+OUTPUT)
!
!     NAME     TYPE DESCRIPTION (UNITS)
!-----------------------------------------------------------------------
!     OEDNROW  IO   PLA INTERNAL ARRAY
!     OERCROW  IO   PLA INTERNAL ARRAY
!     OIDNROW  IO   PLA INTERNAL ARRAY
!     OIRCROW  IO   PLA INTERNAL ARRAY
!     SVVBROW  IO   PLA INTERNAL ARRAY
!     PSVVROW  IO   PLA INTERNAL ARRAY
!     SVMBROW  IO   PLA INTERNAL ARRAY
!     SVCBROW  IO   PLA INTERNAL ARRAY
!     PNVBROW  IO   PLA INTERNAL ARRAY
!     PNMBROW  IO   PLA INTERNAL ARRAY
!     PNCBROW  IO   PLA INTERNAL ARRAY
!     PSVBROW  IO   PLA INTERNAL ARRAY
!     PSMBROW  IO   PLA INTERNAL ARRAY
!     PSCBROW  IO   PLA INTERNAL ARRAY
!     QNVBROW  IO   PLA INTERNAL ARRAY
!     QNMBROW  IO   PLA INTERNAL ARRAY
!     QNCBROW  IO   PLA INTERNAL ARRAY
!     QSVBROW  IO   PLA INTERNAL ARRAY
!     QSMBROW  IO   PLA INTERNAL ARRAY
!     QSCBROW  IO   PLA INTERNAL ARRAY
!     QGVBROW  IO   PLA INTERNAL ARRAY
!     QGMBROW  IO   PLA INTERNAL ARRAY
!     QGCBROW  IO   PLA INTERNAL ARRAY
!     QDVBROW  IO   PLA INTERNAL ARRAY
!     QDMBROW  IO   PLA INTERNAL ARRAY
!     QDCBROW  IO   PLA INTERNAL ARRAY
!     ONVBROW  IO   PLA INTERNAL ARRAY
!     ONMBROW  IO   PLA INTERNAL ARRAY
!     ONCBROW  IO   PLA INTERNAL ARRAY
!     OSVBROW  IO   PLA INTERNAL ARRAY
!     OSMBROW  IO   PLA INTERNAL ARRAY
!     OSCBROW  IO   PLA INTERNAL ARRAY
!     OGVBROW  IO   PLA INTERNAL ARRAY
!     OGMBROW  IO   PLA INTERNAL ARRAY
!     OGCBROW  IO   PLA INTERNAL ARRAY
!     DEVBROW  IO   PLA INTERNAL ARRAY
!     PDEVROW  IO   PLA INTERNAL ARRAY
!     DEMBROW  IO   PLA INTERNAL ARRAY
!     DECBROW  IO   PLA INTERNAL ARRAY
!     DIVBROW  IO   PLA INTERNAL ARRAY
!     PDIVROW  IO   PLA INTERNAL ARRAY
!     DIMBROW  IO   PLA INTERNAL ARRAY
!     DICBROW  IO   PLA INTERNAL ARRAY
!     REVBROW  IO   PLA INTERNAL ARRAY
!     PREVROW  IO   PLA INTERNAL ARRAY
!     REMBROW  IO   PLA INTERNAL ARRAY
!     RECBROW  IO   PLA INTERNAL ARRAY
!     RIVBROW  IO   PLA INTERNAL ARRAY
!     PRIVROW  IO   PLA INTERNAL ARRAY
!     RIMBROW  IO   PLA INTERNAL ARRAY
!     RICBROW  IO   PLA INTERNAL ARRAY
!     XROW     IO   GRID-CELL MEAN TRACER MASS MIXING RATIO (KG/KG)
!     SFRCROL  IO   PLA INTERNAL ARRAY
!     IAIND    I    AEROSOL TRACER INDEX ARRAY
!     ILG      I    HORIZONTAL (LAT/LON) GRID CELL INDEX
!     ILEVP1   I    NUMBER OF VERTICAL GRID CELLS
!     NTRAC    I    NUMBER OF TRACERS
!     MSGP2    I    INDEX OF HIGHEST VERTICAL GRID CELL
!     IL1      I    START INDEX OF FIRST HORIZONTAL GRID CELL
!     IL2      I    INDEX OF LAST HORIZONTAL GRID CELL
!     ISO2     I    TRACER INDEX FOR SULPHUR DIOXIDE GAS
!     IHPO     I    TRACER INDEX FOR HYDROGEN PEROXIDE GAS
!     IGS6     I    TRACER INDEX FOR SULPHURIC ACID GAS
!     IGSP     I    TRACER INDEX FOR SECONDARY ORGANIC AEROSOL PRECURSOR GAS
!     NTRACP   I    NUMBER OF AEROSOL TRACERS
!     ILEV     I    NUMBER OF VERTICAL GRID CELLS
!     ICAN     I    NUMBER OF LAND SURFACE SCHEME CANOPY TYPES
!     MSGP1    I    CURRENTLY UNUSED PARAMETER
!     ZH       I    HEIGHT OF GRID CELL CENTRES
!     ZF       I    HEIGHT OF GRID CELL INTERFACES (M)
!     PH       I    PRESSURE OF GRID CELL CENTRES (PA)
!     PF       I    PRESSURE OF GRID CELL INTERFACES (PA)
!     DP       I    DEPTH OF GRID CELLS (PA)
!     THROW    I    GRID-CELL MEAN TEMPERATURE OF AIR (K)
!     QROW     I    GRID-CELL MEAN WATER VAPOUR MASS MIXING RATIO (KG/KG)
!     QTN      I    TOTAL WATER MASS MIXING RATIO IN CLOUD UPDRAFT (KG/KG)
!     HMN      I    CLOUD WATER STATIC ENERGY IN CLOUD UPDRAFT (J/KG)
!     RHC      I    RELATIVE HUMIDITY FOR CLEAR SKY PORTION OF GRID CELL
!     RHT      I    GRID-CELL MEAN RELATIVE HUMIDITY
!     WG       I    GRID-CELL MEAN VERTICAL VELOCITY (M/SEC)
!     WSUB     I    SUBGRID-SCALE COMPONENT OF VERTICAL VELOCITY IN CLOUD UPDRAFT (M/SEC)
!     ZMRATEP  I    AUTOCONVERSION + ACCRETION RATE IN CLOUDY PORTION OF GRID CELL
!     ZMLWC    I    CLOUD LIQUID WATER MASS MIXING RATIO IN CLOUDY PORTION OF GRID CELL
!                   (KG/KG)
!     ZFSNOW   I    GRID-CELL MEAN SNOWFALL RATE (KG/M2/SEC), AT BOTTOM OF EACH GRID CELL
!     ZFRAIN   I    GRID-CELL MEAN RAINFALL RATE (KG/M2/SEC), AT BOTTOM OF EACH GRID CELL
!     ZCLF     I    CLOUD FRACTION
!     CLRFR    I    RAIN FRACTION (CLEAR-SKY PART OF GRID CELL THAT CONTAINS RAIN)
!     CLRFS    I    SNOW FRACTION (CLEAR-SKY PART OF GRID CELL THAT CONTAINS SNOW)
!     ZFEVAP   I    FRACTION OF RAIN THAT EVAPORATES IN A MODEL TIME STEP
!     ZFSUBL   I    FRACTION OF SNOW THAT SUBLIMATES IN A MODEL TIME STEP
!     PBLTROW  I    VERTICAL INDEX OF GRID CELL IMMEDIATELY BELOW THE PLANETARY
!                   BOUNDARY LAYER
!     SMFRAC   I    SOIL MOISTURE FRACTION
!     FCS      I    FRACTION OF CANOPY OVER SNOW ON GROUND IN A GRID CELL
!     FGS      I    FRACTION OF SNOW ON BARE GROUND IN A GRID CELL
!     FC       I    FRACTION OF SNOW-FREE CANOPY IN A GRID CELL
!     FG       I    FRACTION OF SNOW-FREE BARE GROUND IN A GRID CELL
!     ZSPD     I    MODEL SURFACE HORIZONTAL WIND SPEED (M/SEC)
!     ZSPDSO   I    MODEL SURFACE HORIZONTAL WIND SPEED OVER OPEN OCEAN (M/SEC)
!     ZSPDSBS  I    MODEL SURFACE HORIZONTAL WIND SPEED OVER BARE GROUND (M/SEC)
!     CDML     I    SURFACE DRAG COEFFICIENT OVER LAND (M2/SEC2)
!     CDMNL    I    SURFACE DRAG COEFFICIENT OVER WATER, ICE, AND OPEN OCEAN (M2/SEC2)
!     USTARBS  I    FRICTION VELOCITY OVER BARE GROUND (M/SEC)
!     FLND     I    FRACTION OF LAND IN A GRID CELL
!     FOCN     I    FRACTION OF OPEN OCEAN IN A GRID CELL
!     SICN     I    SEA ICE FRACTION
!     GTROW    I    TEMPERATURE IN BARE GROUND (K)
!     FNROL    I    FRACTION OF SNOW ON GROUND
!     FCANROW  I    FRACTION OF CANOPY TYPE (1: TALL CONIFEROUS, 2: TALL BROADLEAF,
!                   3: ARABLE AND CROPS, 4: GRASS, SWAMP AND TUNDRA)
!     SPOTROW  I    FRACTION OF PALEO LAKE BEDS
!     ST02ROW  I    FRACTION OF BARE GROUND WITH MEDIUM GRAIN SIZE
!     ST03ROW  I    FRACTION OF BARE GROUND WITH FINE GRAIN SIZE
!     ST04ROW  I    FRACTION OF BARE GROUND WITH COARSE TO MEDIUM GRAIN SIZE
!     ST06ROW  I    FRACTION OF BARE GROUND WITH FINE TO MEDIUM GRAIN SIZE
!     ST13ROW  I    FRACTION OF BARE GROUND FOR ASIAN TAKLIMAKAN
!     ST14ROW  I    FRACTION OF BARE GROUND FOR ASIAN LOESS
!     ST15ROW  I    FRACTION OF BARE GROUND FOR ASIAN GOBI
!     ST16ROW  I    FRACTION OF BARE GROUND FOR ASIAN DESERT AND SANDLAND
!     ST17ROW  I    FRACTION OF BARE GROUND FOR ASIAN OTHER MIXTURE SOIL
!     SUZ0ROW  I    AERODYNAMIC ROUGHNESS LENGTH FOR BARE GROUND
!     BSFRAC   I    FRACTION OF BARE GROUND, METHOD 1 (DEFAULT)
!     PDSFROW  I    FRACTION OF BARE GROUND, METHOD 2
!     ATAU     I    AGING TIME SCALE OF HYDROPHOBIC BLACK CARBON (SEC)
!     ZFS      I    HEIGHT OF SURFACE (BOTTOM OF ATMOSPHERE) (M)
!     PFS      I    PRESSURE AT SURFACE (BOTTOM OF ATMOSPHERE) (PA)
!     SGPP     I    SULPHURIC ACID (GAS) CHEMICAL PRODUCTION OR EMISSION RATE
!                   (KG OF SULPHUR/KG/SEC)
!     OGPP     I    SECONDARY ORGANIC AEROSOL PRECURSOR GAS CHEMICAL PRODUCTION
!                   OR EMISSION RATE (KG/KG/SEC)
!     DOCEM1   I    ORGANIC AEROSOL EMISSION RATE FOR OPEN VEGETATION AND BIOFUEL
!                   BURNING (KG/KG/SEC)
!     DOCEM2   I    ORGANIC AEROSOL EMISSION RATE FOR FOSSIL FUEL BURNING (KG/KG/SEC)
!     DOCEM3   I    ORGANIC AEROSOL EMISSION RATE FOR AIRCRAFT (KG/KG/SEC)
!     DOCEM4   I    ORGANIC AEROSOL EMISSION RATE FOR SHIPPING (KG/KG/SEC)
!     DBCEM1   I    BLACK AEROSOL EMISSION RATE FOR OPEN VEGETATION AND BIOFUEL
!                   BURNING (KG/KG/SEC)
!     DBCEM2   I    BLACK AEROSOL EMISSION RATE FOR FOSSIL FUEL BURNING (KG/KG/SEC)
!     DBCEM3   I    BLACK AEROSOL EMISSION RATE FOR AIRCRAFT (KG/KG/SEC)
!     DBCEM4   I    BLACK AEROSOL EMISSION RATE FOR SHIPPING (KG/KG/SEC)
!     DSUEM1   I    AMMONIUM SULPHATE EMISSION RATE FOR OPEN VEGETATION AND BIOFUEL
!                   BURNING (KG/KG/SEC)
!     DSUEM2   I    AMMONIUM SULPHATE EMISSION RATE FOR FOSSIL FUEL BURNING (KG/KG/SEC)
!     DSUEM3   I    AMMONIUM SULPHATE EMISSION RATE FOR AIRCRAFT (KG/KG/SEC)
!     DSUEM4   I    AMMONIUM SULPHATE EMISSION RATE FOR SHIPPING (KG/KG/SEC)
!     O3ROW    I    OZONE VOLUME MIXING RATIO (M3/M3)
!     HNO3ROW  I    NITRIC ACID VOLUME MIXING RATIO (M3/M3)
!     NH3ROW   I    AMMONIA VOLUME MIXING RATIO (M3/M3)
!     NH4ROW   I    AMMONIUM VOLUME MIXING RATIO (M3/M3)
!     TIMST    I    MODEL TIME STEP
!     CO2_PPM  I    CARBON DIOXIDE VOLUME MIXING RATIO (PPM)
!     KOUNT    I    TIME STEP NUMBER
!     TMIN     I    MINIMUM TRACER MASS MIXING RATIO (KG/KG)
!     ZCDNROW  O    CLOUD DROPLET NUMBER CONCENTRATION, HOLE-FILLED AND TIME INTEPOLATED (1/M3)
!     BCICROW  O    ACTIVATED BLACK CARBON MASS MIXING RATIO IN CLOUDY PORTION
!                   OF GRID CELL (KG/KG)
!     DEPBROL  IO   TOTAL (DRY + WET) BLACK CARBON DEPOSITION FLUX (KG/M2/SEC)
!     CORNROW  IO   PLA NUMERICAL DIAGNOSTIC ARRAY (NUMBER CORRECTION)
!     CORMROW  IO   PLA NUMERICAL DIAGNOSTIC ARRAY (MASS CORRECTION)
!     RSN1ROW  IO   PLA NUMERICAL DIAGNOSTIC ARRAY (NUMBER RESIDUUM 1)
!     RSM1ROW  IO   PLA NUMERICAL DIAGNOSTIC ARRAY (MASS RESIDUUM 1)
!     VRN1ROW  IO   PLA NUMERICAL DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED NUMBER RESIDUUM 1)
!     VRM1ROW  IO   PLA NUMERICAL DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED MASS RESIDUUM 1)
!     RSN2ROW  IO   PLA NUMERICAL DIAGNOSTIC ARRAY (NUMBER RESIDUUM 2)
!     RSM2ROW  IO   PLA NUMERICAL DIAGNOSTIC ARRAY (MASS RESIDUUM 2)
!     VRN2ROW  IO   PLA NUMERICAL DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED NUMBER RESIDUUM 2)
!     VRM2ROW  IO   PLA NUMERICAL DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED MASS RESIDUUM 2)
!     RSN3ROW  IO   PLA NUMERICAL DIAGNOSTIC ARRAY (NUMBER RESIDUUM 3)
!     RSM3ROW  IO   PLA NUMERICAL DIAGNOSTIC ARRAY (MASS RESIDUUM 3)
!     VRN3ROW  IO   PLA NUMERICAL DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED NUMBER RESIDUUM 3)
!     VRM3ROW  IO   PLA NUMERICAL DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED MASS RESIDUUM 3)
!     VNCNROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED NUCLEATION RATE
!                                         FOR AMMONIUM SULPHATE NUMBER) (/M2/SEC)
!     VASNROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED NUCLEATION RATE
!                                         FOR AMMOINUM SULPHATE MASS) (KG/M2/SEC)
!     VSCDROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED CONDENSATION RATE
!                                         FOR AMMONIUM SULPHATE MASS) (KG/M2/SEC)
!     VGSPROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED GAS-PHASE PRODUCTION
!                                         RATE OF SULPHURIC ACID) (KG/M2/SEC)
!     SNCNROW  O    PLA DIAGNOSTIC ARRAY (NUCLEATION RATE FOR AMMONIUM SULPHATE NUMBER)
!                                        (/M3/SEC)
!     SSUNROW  IO   PLA DIAGNOSTIC ARRAY (NUCLEATION RATE FOR AMMONIUM SULPHATE MASS)
!                                        (KG/M3/SEC)
!     SCNDROW  O    PLA DIAGNOSTIC ARRAY (CONDENSATION RATE FOR AMMONIUM SULPHATE MASS)
!                                        (KG/M3/SEC)
!     SGSPROW  O    PLA DIAGNOSTIC ARRAY (GAS-PHASE PRODUCTION RATE OF SULPHURIC ACID)
!                                        (KG/M3/SEC)
!     DEFXROW  IO   PLA DIAGNOSTIC ARRAY (EMISSION SIZE DISTRIBUTION FOR MINERAL DUST
!                                         MASS) (MICRO-G/M3)
!     DEFNROW  IO   PLA DIAGNOSTIC ARRAY (EMISSION SIZE DISTRIBUTION FOR MINERAL DUST
!                                         NUMBER) (/CM3)
!     ACASROW  IO   PLA DIAGNOSTIC ARRAY (AMMONIUM SULPHATE MASS MIXING RATIO) (KG/KG)
!     ACOAROW  IO   PLA DIAGNOSTIC ARRAY (ORGANIC AEROSOL MASS MIXING RATIO) (KG/KG)
!     ACBCROW  IO   PLA DIAGNOSTIC ARRAY (BLACK CARBON MASS MIXING RATIO) (KG/KG)
!     ACSSROW  IO   PLA DIAGNOSTIC ARRAY (SEA SALT MASS MIXING RATIO) (KG/KG)
!     ACMDROW  IO   PLA DIAGNOSTIC ARRAY (MINERAL DUST MASS MIXING RATIO) (KG/KG)
!     NTROW    IO   PLA DIAGNOSTIC ARRAY (AEROSOL NUMBER CONCENTRATION) (/CM3)
!     N20ROW   IO   PLA DIAGNOSTIC ARRAY (AEROSOL NUMBER CONCENTRATION, DIAMETER > 20NM) (/CM3)
!     N50ROW   IO   PLA DIAGNOSTIC ARRAY (AEROSOL NUMBER CONCENTRATION, DIAMETER > 50NM) (/CM3)
!     N100ROW  IO   PLA DIAGNOSTIC ARRAY (AEROSOL NUMBER CONCENTRATION, DIAMETER > 100NM) (/CM3)
!     N200ROW  IO   PLA DIAGNOSTIC ARRAY (AEROSOL NUMBER CONCENTRATION, DIAMETER > 200NM) (/CM3)
!     WTROW    IO   PLA DIAGNOSTIC ARRAY (WET AEROSOL NUMBER CONCENTRATION) (/CM3)
!     W20ROW   IO   PLA DIAGNOSTIC ARRAY (WET AEROSOL NUMBER CONCENTRATION, DIAMETER > 20NM) (/CM3)
!     W50ROW   IO   PLA DIAGNOSTIC ARRAY (WET AEROSOL NUMBER CONCENTRATION, DIAMETER > 50NM) (/CM3)
!     W100ROW  IO   PLA DIAGNOSTIC ARRAY (WET AEROSOL NUMBER CONCENTRATION, DIAMETER > 100NM) (/CM3)
!     W200ROW  IO   PLA DIAGNOSTIC ARRAY (WET AEROSOL NUMBER CONCENTRATION, DIAMETER > 200NM) (/CM3)
!     CCNROW   O    PLA DIAGNOSTIC ARRAY (INSTANTANEOUS CLOUD DROPLET NUMBER CONCENTRATION) (/CM3)
!     CCNEROW  O    PLA DIAGNOSTIC ARRAY (CLOUD DROPLET NUMBER CONCENTRATION, EMPIRICAL APPROACH)
!                                        (/CM3)
!     CC02ROW  IO   PLA DIAGNOSTIC ARRAY (CLOUD CONDENSATION NUCLEI CONCENTRATION AT 0.2%
!                                         SUPERSATURATION) (/CM3)
!     CC04ROW  IO   PLA DIAGNOSTIC ARRAY (CLOUD CONDENSATION NUCLEI CONCENTRATION AT 0.4%
!                                         SUPERSATURATION) (/CM3)
!     CC08ROW  IO   PLA DIAGNOSTIC ARRAY (CLOUD CONDENSATION NUCLEI CONCENTRATION AT 0.8%
!                                         SUPERSATURATION) (/CM3)
!     CC16ROW  IO   PLA DIAGNOSTIC ARRAY (CLOUD CONDENSATION NUCLEI CONCENTRATION AT 1.6%
!                                         SUPERSATURATION) (/CM3)
!     RCRIROW  O    PLA DIAGNOSTIC ARRAY (CRITICAL AEROSOL RADIUS FOR CLOUD ACTIVATION) (M)
!     SUPSROW  O    PLA DIAGNOSTIC ARRAY (MAXIMUM WATER VAPOUR SUPERSATURATION IN CLOUD) (%)
!     VOAEROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED EMISSION FLUX OF ORGANIC AEROSOL)
!                                        (KG/M2/SEC)
!     VBCEROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED EMISSION FLUX OF BLACK CARBON)
!                                        (KG/M2/SEC)
!     VASEROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED EMISSION FLUX OF AMMONIUM SULPHATE)
!                                        (KG/M2/SEC)
!     VMDEROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED EMISSION FLUX OF MINERAL DUST)
!                                        (KG/M2/SEC)
!     VSSEROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED EMISSION FLUX OF SEA SALT)
!                                        (KG/M2/SEC)
!     VOAWROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED WET DEPOSITION FLUX OF ORGANIC
!                                         AEROSOL) (KG/M2/SEC)
!     VBCWROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED WET DEPOSITION FLUX OF BLACK
!                                         CARBON) (KG/M2/SEC)
!     VASWROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED WET DEPOSITION FLUX OF AMMONIUM
!                                         SULPHATE) (KG/M2/SEC)
!     VMDWROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED WET DEPOSITION FLUX OF MINERAL
!                                         DUST) (KG/M2/SEC)
!     VSSWROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED WET DEPOSITION FLUX OF SEA SALT)
!                                        (KG/M2/SEC)
!     VOADROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED DRY DEPOSITION FLUX OF ORGANIC
!                                         AEROSOL) (KG/M2/SEC)
!     VBCDROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED DRY DEPOSITION FLUX OF BLACK
!                                         CARBON) (KG/M2/SEC)
!     VASDROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED DRY DEPOSITION FLUX OF AMMONIUM
!                                         SULPHATE) (KG/M2/SEC)
!     VMDDROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED DRY DEPOSITION FLUX OF MINERAL
!                                         DUST) (KG/M2/SEC)
!     VSSDROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED DRY DEPOSITION FLUX OF SEA SALT)
!                                        (KG/M2/SEC)
!     VOAGROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED GAS-TO-PARTICLE CONVERSION
!                                         FLUX OF ORGANIC AEROSOL) (KG/M2/SEC)
!     VBCGROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED GAS-TO-PARTICLE CONVERSION
!                                         FLUX OF BLACK CARBON) (KG/M2/SEC)
!     VASGROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED GAS-TO-PARTICLE CONVERSION
!                                         FLUX OF AMMONIUM SULPHATE) (KG/M2/SEC)
!     VMDGROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED GAS-TO-PARTICLE CONVERSION
!                                         FLUX OF MINERAL DUST) (KG/M2/SEC)
!     VSSGROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED GAS-TO-PARTICLE CONVERSION
!                                         FLUX OF SEA SALT) (KG/M2/SEC)
!     VASIROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED IN-CLOUD OXIDATION FLUX OF
!                                         AMMONIUM SULPHATE) (KG/M2/SEC)
!     VAS1ROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED IN-CLOUD SCAVENGING FLUX OF
!                                         AMMONIUM SULPHATE) (KG/M2/SEC)
!     VAS2ROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED BELOW-CLOUD SCAVENGING FLUX
!                                         OF AMMONIUM SULPHATE) (KG/M2/SEC)
!     VAS3ROW  IO   PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED RE-EVAPORATION OF AMMONIUM
!                                         SULPHATE IN RAIN) (KG/M2/SEC)
!     HENRROW  O    PLA DIAGNOSTIC ARRAY (HENRYS LAW CONSTANT FOR SULPHUR DIOXIDE)
!     O3FROW   O    PLA DIAGNOSTIC ARRAY (AMMONIUM SULPHATE PRODUCTION RATE DUE TO IN-CLOUD 
!                                         OZONE OXIDATION) (KG/KG/SEC)
!     H2O2FROW O    PLA DIAGNOSTIC ARRAY (AMMONIUM SULPHATE PRODUCTION RATE DUE TO IN-CLOUD 
!                                         HYDROGEN PEROXIDE OXIDATION) (KG/KG/SEC)
!     WPARROW  O    PLA DIAGNOSTIC ARRAY (VERTICAL VELOCITY IN CLOUD UPDRAFT) (M/SEC)
!     VCCNROW  O    PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED INSTANTANEOUS CLOUD DROPLET
!                                         NUMBER CONCENTRATION) (/M2)
!     VCNEROW  O    PLA DIAGNOSTIC ARRAY (VERTICALLY INTEGRATED INSTANTANEOUS CLOUD DROPLET
!                                         NUMBER CONCENTRATION, EMPIRICAL APPROACH) (/M2)
!     DMACROW  IO   PLA DIAGNOSTIC ARRAY (EMISSION MASS SIZE DISTRIBUTION FLUX FOR MINERAL
!                                         DUST 1) (KG/M2/SEC)
!     DMCOROW  IO   PLA DIAGNOSTIC ARRAY (EMISSION MASS SIZE DISTRIBUTION FLUX FOR MINERAL
!                                         DUST 2) (KG/M2/SEC)
!     DNACROW  IO   PLA DIAGNOSTIC ARRAY (EMISSION NUMBER SIZE DISTRIBUTION FLUX FOR MINERAL
!                                         DUST 1) (KG/M2/SEC)
!     DNCOROW  IO   PLA DIAGNOSTIC ARRAY (EMISSION NUMBER SIZE DISTRIBUTION FLUX FOR MINERAL
!                                         DUST 2) (KG/M2/SEC)
!     DUWDROW  IO   PLA DIAGNOSTIC ARRAY (WIND SPEED IN MINERAL DUST CALCULATION) (M/SEC)
!     DUSTROW  IO   PLA DIAGNOSTIC ARRAY (FRICTION VELOCITY IN MINERAL DUST CALCULATION (M/SEC)
!     DUTHROW  IO   PLA DIAGNOSTIC ARRAY (FRICTION VELOCITY THRESHOLD IN MINERAL DUST
!                                         CALCULATION) (M/SEC)
!     FALLROW  IO   PLA DIAGNOSTIC ARRAY (FLUXALL ARRAY IN MINERAL DUST CALCULATION)
!     FA10ROW  IO   PLA DIAGNOSTIC ARRAY (FA10 ARRAY IN MINERAL DUST CALCULATION)
!     FA2ROW   IO   PLA DIAGNOSTIC ARRAY (FA2 ARRAY IN MINERAL DUST CALCULATION)
!     FA1ROW   IO   PLA DIAGNOSTIC ARRAY (FA1 ARRAY IN MINERAL DUST CALCULATION)
!     USMKROW  IO   PLA DIAGNOSTIC ARRAY (TIME FRACTION OF THRESHOLD EXCEEDENCE IN MINERAL
!                                         DUST CALCULATION)
!     DEFAROW  IO   PLA DIAGNOSTIC ARRAY (EMISSION FLUX OF MINERAL DUST MASS FOR
!                                         ACCUMULATION MODE) (KG/M2/SEC)
!     DEFCROW  IO   PLA DIAGNOSTIC ARRAY (EMISSION FLUX OF MINERAL DUST MASS FOR
!                                         COARSE MODE) (KG/M2/SEC)
!     SICN_CRT I    CRITICAL SEA ICE FRACTION
!     SAVERAD  I    WEIGHTING FACTOR FOR TIME INTEGRATION OF PLA DIAGNOSTIC
!                   RESULTS OVER 1/SAVERAD NUMBER OF MODEL TIME STEPS
!     ISVDUST  I    SWITCH FOR TURNING ON/OFF EXTRA DIAGNOSTIC CALCULATIONS
!                   FOR MINERAL DUST PROCESSES
!
      USE SDPARM
      USE COMPAR
      USE DUPARM1
!
      IMPLICIT REAL (A-H,O-Z),INTEGER (I-N)
!
!-----------------------------------------------------------------------
!     * INPUT VARIABLES.
!
      INTEGER, INTENT(IN), DIMENSION(NTRACP) :: IAIND
      INTEGER, INTENT(IN) :: ISVDUST
      REAL, INTENT(IN) :: TIMST
      REAL, INTENT(IN) :: SICN_CRT,SAVERAD
      REAL, INTENT(IN), DIMENSION(NTRAC) :: TMIN
      REAL, INTENT(IN), DIMENSION(ILG,ILEVP1) :: THROW,QROW
      REAL, INTENT(IN), DIMENSION(ILG,ILEV) :: ZH,ZF,PH,PF,DP,QTN, &
                                               HMN,RHC,RHT,WG,WSUB
      REAL, INTENT(IN), DIMENSION(ILG,ILEV) :: ZMRATEP,ZMLWC,ZFSNOW, &
                                               ZFRAIN,ZCLF,CLRFR,CLRFS, &
                                               ZFEVAP,ZFSUBL
      REAL, INTENT(IN), DIMENSION(ILG,ILEV) :: SGPP,OGPP,DOCEM1, &
                                               DOCEM2,DOCEM3,DOCEM4, &
                                               DBCEM1,DBCEM2,DBCEM3, &
                                               DBCEM4,DSUEM1,DSUEM2, &
                                               DSUEM3,DSUEM4
      REAL, INTENT(IN), DIMENSION(ILG,ILEV) :: O3ROW,HNO3ROW,NH3ROW, &
                                               NH4ROW
      REAL, INTENT(IN), DIMENSION(ILG,ICAN+1) :: FCANROW
      REAL, INTENT(IN), DIMENSION(ILG) :: SMFRAC,FCS,FGS,FC,FG,PBLTROW, &
                                          ZSPD,ZSPDSO,ZSPDSBS, &
                                          CDML,CDMNL,USTARBS
      REAL, INTENT(IN), DIMENSION(ILG) :: FLND,FOCN,SICN,GTROW,FNROL
!
      REAL, INTENT(IN), DIMENSION(ILG) :: &
                                       SUZ0ROW,SPOTROW,ST02ROW,ST03ROW, &
                                       ST04ROW,ST06ROW,ST13ROW,ST14ROW, &
                                       ST15ROW,ST16ROW,ST17ROW,BSFRAC, &
                                       PDSFROW,ATAU,ZFS,PFS
!
!     * INPUT/OUTPUT VARIABLES.
!
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV,KEXTT) :: OEDNROW,OERCROW
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV) :: OIDNROW,OIRCROW, &
                                                  SVVBROW,PSVVROW
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV,NRMFLD) :: &
                                                        SVMBROW,SVCBROW
!
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV,ISAINTT) :: PNVBROW
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV,ISAINTT,NRMFLD) :: &
                                                        PNMBROW,PNCBROW
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV,ISAINTT,KINTT) :: PSVBROW
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV,ISAINTT,KINTT,NRMFLD) :: &
                                                        PSMBROW,PSCBROW
!
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV,ISAINTT) :: QNVBROW
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV,ISAINTT,NRMFLD) :: &
                                                        QNMBROW,QNCBROW
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV,ISAINTT,KINTT) :: QSVBROW
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV,ISAINTT,KINTT,NRMFLD) :: &
                                                        QSMBROW,QSCBROW
!
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV) :: QGVBROW
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV,NRMFLD) :: &
                                                        QGMBROW,QGCBROW
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV) :: QDVBROW
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV,NRMFLD) :: &
                                                        QDMBROW,QDCBROW
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV,ISAINTT) :: ONVBROW
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV,ISAINTT,NRMFLD) :: &
                                                        ONMBROW,ONCBROW
!
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV,ISAINTT,KINTT) :: OSVBROW
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV,ISAINTT,KINTT,NRMFLD) :: &
                                                        OSMBROW,OSCBROW
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV) :: OGVBROW
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV,NRMFLD) :: &
                                                        OGMBROW,OGCBROW
!
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV,KEXTT) :: DEVBROW,PDEVROW
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV,KEXTT,NRMFLD) :: DEMBROW, &
                                                               DECBROW
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV) :: DIVBROW,PDIVROW
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV,NRMFLD) :: &
                                                        DIMBROW,DICBROW
!
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV,KEXTT) :: REVBROW,PREVROW
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV,KEXTT,NRMFLD) :: REMBROW, &
                                                               RECBROW
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV) :: RIVBROW,PRIVROW
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV,NRMFLD) :: &
                                                       RIMBROW,RICBROW
!
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV) :: &
                                      CORNROW,CORMROW,RSN1ROW,RSM1ROW, &
                                      RSN2ROW,RSM2ROW,RSN3ROW,RSM3ROW
      REAL, INTENT(INOUT), DIMENSION(ILG)   :: &
                                      VRN1ROW,VRM1ROW,VRN2ROW,VRM2ROW, &
                                      VRN3ROW,VRM3ROW
      REAL, INTENT(INOUT), DIMENSION(ILG) :: &
                                      VNCNROW,VASNROW,VSCDROW,VGSPROW
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEVP1,NTRAC) :: XROW
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV,NTRAC) :: SFRCROL
!
!     * OUTPUT VARIABLES.
!
      REAL, INTENT(OUT), DIMENSION(ILG,ILEV) :: ZCDNROW,BCICROW
      REAL, INTENT(INOUT), DIMENSION(ILG,ILEV) :: &
                                                SNCNROW,SSUNROW,SCNDROW, &
                                                SGSPROW,CCNROW ,CCNEROW, &
                                                CC02ROW,CC04ROW,CC08ROW, &
                                                CC16ROW,RCRIROW,SUPSROW, &
                                                HENRROW,O3FROW,WPARROW, &
                                                NTROW,N20ROW,N50ROW, &
                                                N100ROW,N200ROW,WTROW, &
                                                W20ROW,W50ROW,W100ROW, &
                                                W200ROW,ACASROW,ACOAROW, &
                                                ACBCROW,ACSSROW,ACMDROW, &
                                                H2O2FROW
      REAL, INTENT(INOUT), DIMENSION(ILG) :: DEPBROL
      REAL, INTENT(INOUT), DIMENSION(ILG,ISDIAG) :: DEFXROW,DEFNROW
      REAL, INTENT(INOUT), DIMENSION(ILG) :: &
                                       VOAEROW,VBCEROW,VASEROW,VMDEROW, &
                                       VSSEROW,VOAWROW,VBCWROW,VASWROW, &
                                       VMDWROW,VSSWROW,VOADROW,VBCDROW, &
                                       VASDROW,VMDDROW,VSSDROW,VOAGROW, &
                                       VBCGROW,VASGROW,VMDGROW,VSSGROW, &
                                       VASIROW,VAS1ROW,VAS2ROW,VAS3ROW, &
                                       VCCNROW,VCNEROW
      REAL, INTENT(INOUT), DIMENSION(ILG,ISDUST) :: &
                                       DMACROW,DMCOROW,DNACROW,DNCOROW
      REAL, INTENT(INOUT), DIMENSION(ILG) :: &
                                       DUWDROW,DUSTROW,DUTHROW,FALLROW, &
                                       FA10ROW,FA2ROW ,FA1ROW ,USMKROW, &
                                       DEFAROW,DEFCROW
!
!     * PAM IN/OUTPUT VARIABLES AND PARAMETERS
!
      INTEGER, ALLOCATABLE, DIMENSION(:,:,:,:)   :: QNCBIO
      INTEGER, ALLOCATABLE, DIMENSION(:,:,:,:,:) :: QSCBIO
      INTEGER, ALLOCATABLE, DIMENSION(:,:,:,:)   :: ONCBIO
      INTEGER, ALLOCATABLE, DIMENSION(:,:,:,:,:) :: OSCBIO
      INTEGER, ALLOCATABLE, DIMENSION(:,:,:,:)   :: PNCBIO
      INTEGER, ALLOCATABLE, DIMENSION(:,:,:,:,:) :: PSCBIO
      INTEGER, ALLOCATABLE, DIMENSION(:,:,:)     :: QGCBIO
      INTEGER, ALLOCATABLE, DIMENSION(:,:,:)     :: QDCBIO
      INTEGER, ALLOCATABLE, DIMENSION(:,:,:)     :: OGCBIO
      INTEGER, ALLOCATABLE, DIMENSION(:,:,:)     :: SVCBIO
      INTEGER, ALLOCATABLE, DIMENSION(:,:,:,:)   :: DECBIO
      INTEGER, ALLOCATABLE, DIMENSION(:,:,:)     :: DICBIO
      INTEGER, ALLOCATABLE, DIMENSION(:,:,:,:)   :: RECBIO
      INTEGER, ALLOCATABLE, DIMENSION(:,:,:)     :: RICBIO
!
      REAL, ALLOCATABLE, DIMENSION(:,:,:)     :: TRAC,TRRAT
      REAL, ALLOCATABLE, DIMENSION(:,:,:)     :: OEDNIO,OERCIO
      REAL, ALLOCATABLE, DIMENSION(:,:)       :: OIDNIO,OIRCIO,SVVBIO, &
                                                 PSVVIO
      REAL, ALLOCATABLE, DIMENSION(:,:,:)     :: SVMBIO
      REAL, ALLOCATABLE, DIMENSION(:,:,:)     :: PNVBIO
      REAL, ALLOCATABLE, DIMENSION(:,:,:,:)   :: PNMBIO
      REAL, ALLOCATABLE, DIMENSION(:,:,:,:)   :: PSVBIO
      REAL, ALLOCATABLE, DIMENSION(:,:,:,:,:) :: PSMBIO
      REAL, ALLOCATABLE, DIMENSION(:,:,:)     :: QNVBIO
      REAL, ALLOCATABLE, DIMENSION(:,:,:,:)   :: QNMBIO
      REAL, ALLOCATABLE, DIMENSION(:,:,:,:)   :: QSVBIO
      REAL, ALLOCATABLE, DIMENSION(:,:,:,:,:) :: QSMBIO
      REAL, ALLOCATABLE, DIMENSION(:,:)       :: QGVBIO
      REAL, ALLOCATABLE, DIMENSION(:,:,:)     :: QGMBIO
      REAL, ALLOCATABLE, DIMENSION(:,:)       :: QDVBIO
      REAL, ALLOCATABLE, DIMENSION(:,:,:)     :: QDMBIO
      REAL, ALLOCATABLE, DIMENSION(:,:,:)     :: ONVBIO
      REAL, ALLOCATABLE, DIMENSION(:,:,:,:)   :: ONMBIO
      REAL, ALLOCATABLE, DIMENSION(:,:,:,:)   :: OSVBIO
      REAL, ALLOCATABLE, DIMENSION(:,:,:,:,:) :: OSMBIO
      REAL, ALLOCATABLE, DIMENSION(:,:)       :: OGVBIO
      REAL, ALLOCATABLE, DIMENSION(:,:,:)     :: OGMBIO
      REAL, ALLOCATABLE, DIMENSION(:,:,:)     :: DEVBIO
      REAL, ALLOCATABLE, DIMENSION(:,:,:)     :: PDEVIO
      REAL, ALLOCATABLE, DIMENSION(:,:,:,:)   :: DEMBIO
      REAL, ALLOCATABLE, DIMENSION(:,:)       :: DIVBIO
      REAL, ALLOCATABLE, DIMENSION(:,:)       :: PDIVIO
      REAL, ALLOCATABLE, DIMENSION(:,:,:)     :: DIMBIO
      REAL, ALLOCATABLE, DIMENSION(:,:,:)     :: REVBIO
      REAL, ALLOCATABLE, DIMENSION(:,:,:)     :: PREVIO
      REAL, ALLOCATABLE, DIMENSION(:,:,:,:)   :: REMBIO
      REAL, ALLOCATABLE, DIMENSION(:,:)       :: RIVBIO
      REAL, ALLOCATABLE, DIMENSION(:,:)       :: PRIVIO
      REAL, ALLOCATABLE, DIMENSION(:,:,:)     :: RIMBIO
!
!     * PAM INPUT VARIABLES AND PARAMETERS.
!
      INTEGER :: ICANA,LEVA,ILGA,KNT
      REAL :: DT,CO2
      REAL, ALLOCATABLE, DIMENSION(:,:) :: ZHA,ZFA,PHA,PFA,DPA,TA, &
                                           RVA,QTNA,HMNA,RHA,RHTA,WCTA
      REAL, ALLOCATABLE, DIMENSION(:,:) :: SPMREP,SZMLWC,SPFSNOW, &
                                           SPFRAIN,SZCLF,SCLRFR, &
                                           SCLRFS,SPFEVAP,SPFSUBL
      REAL, ALLOCATABLE, DIMENSION(:,:) :: SGPR,SOAP,DOCEM1S,DOCEM2S, &
                                           DOCEM3S,DOCEM4S,DBCEM1S, &
                                           DBCEM2S,DBCEM3S,DBCEM4S, &
                                           DSUEM1S,DSUEM2S,DSUEM3S, &
                                           DSUEM4S
      REAL, ALLOCATABLE, DIMENSION(:,:) :: XO3,XNA,XAM,XNH3
      REAL, ALLOCATABLE, DIMENSION(:,:) :: FCANA
      REAL, ALLOCATABLE, DIMENSION(:)  :: SMFRDU,FCSA,FGSA,FCA,FGA, &
                                          ATAUS,ZSPDDD,ZSPDSS,ZSPDDU, &
                                          CDMLA,CDMNLA,USTARD
      REAL, ALLOCATABLE, DIMENSION(:)  :: FLNDDU,FOCNDU, &
                                          SICNDU,GTRDU,FNDU,ZFSA,PFSA
      REAL, ALLOCATABLE, DIMENSION(:)   :: SUZ0,SLAI,SPOT,ST02, &
                                           ST03,ST04,ST06,ST13, &
                                           ST14,ST15,ST16,ST17
      INTEGER, ALLOCATABLE, DIMENSION(:) :: PBLTS
!
!     * PAM OUTPUT VARIABLES.
!
      REAL, ALLOCATABLE, DIMENSION(:,:) :: CDNC,BCIC
      REAL, ALLOCATABLE, DIMENSION(:,:) :: CORN,CORM,RSN1,RSM1,RSN2, &
                                           RSM2,RSN3,RSM3
      REAL, ALLOCATABLE, DIMENSION(:)   :: VRN1,VRM1,VRN2,VRM2,VRN3, &
                                           VRM3
      REAL, ALLOCATABLE, DIMENSION(:)   :: VNCN,VASN,VCND,VGSP
      REAL, ALLOCATABLE, DIMENSION(:,:) :: SNCN,SSUN,SCND,SGSP, &
                                           CCN ,CCNE,CC02,CC04, &
                                           CC08,CC16,RCRI,SUPS, &
                                           HENR,O3FRC,H2O2FRC
      REAL, ALLOCATABLE, DIMENSION(:,:) :: CNT,CN20,CN50,CN100,CN200, &
                                           CNTW,CN20W,CN50W,CN100W, &
                                           CN200W
      REAL, ALLOCATABLE, DIMENSION(:,:) :: ACAS,ACOA,ACBC,ACSS,ACMD
      REAL, ALLOCATABLE, DIMENSION(:,:) :: DEFX,DEFN
      REAL, ALLOCATABLE, DIMENSION(:) ::   VOAE,VBCE,VASE,VMDE, &
                                           VSSE,VOAW,VBCW,VASW, &
                                           VMDW,VSSW,VOAD,VBCD, &
                                           VASD,VMDD,VSSD,VOAG, &
                                           VBCG,VASG,VMDG,VSSG, &
                                           VASI,VAS1,VAS2,VAS3, &
                                           VCCN,VCNE
      REAL, ALLOCATABLE, DIMENSION(:,:) :: DMAC,DMCO,DNAC,DNCO
      REAL, ALLOCATABLE, DIMENSION(:) :: &
                                           DUWD,DUST,DUTH,FALL, &
                                           FA10,FA2 ,FA1 ,USMK, &
                                           DEFA,DEFC
!
!     * INTERNAL VARIABLES.
!
      LOGICAL :: KAVGS
      REAL, ALLOCATABLE, DIMENSION(:,:) :: DSA
!
      INTEGER*4 MYNODE
      COMMON /MPINFO/ MYNODE
!
!-----------------------------------------------------------------------
!     * SIZE OF PLA ARRAYS. THE SIZE OF THE VERTICAL DOMAIN IS
!     * DETERMINED BY LEVA (TOTAL NUMBER OF GRID POINTS, STARTING
!     * AT THE BOTTOM OF THE DOMAIN).
!
!      LEVA=ILEV-1
      IF ( LEVA > ILEV ) CALL XIT('PAMDRIV',-1)
      ILGA=IL2-IL1+1
      ICANA=ICAN
!
!     * INITIALIZATIONS OF SCALARS.
!
      ALLOCATE(DSA(ILGA,LEVA))
      DSA=1.
      KNT=KOUNT
      DT=TIMST
      CO2=CO2_PPM
!
!     * TEST WHETHER NUMBER OF TRACERS IS SUFFICIENT. EXIT IF
!     * INSUFFICIENT MEMORY (INCREASE NTRACS IN THAT CASE). WARNING
!     * IF ACTUAL NUMBER OF TRACERS IS LESS THAN THE NUMBER OF
!     * TRACERS THAT ARE AVAILABLE (REDUCE NTRACS TO REDUCE MEMORY,
!     * IF NECESSARY).
!
      IF ( NTRACS > NTRACP .OR. NTRACS < 1 ) THEN
        IF ( MYNODE.EQ.0 ) WRITE(6,'(A17,I3,1X,I3)') &
                                     '  NTRACS,NTRACP = ',NTRACS,NTRACP
        CALL XIT ('PAMDRIV',-2)
      ENDIF
      IF ( NTRACS < NTRACP .AND. MYNODE.EQ.0 ) THEN
        WRITE(6,'(A17,I3,1X,I3)')    '  NTRACS,NTRACP = ',NTRACS,NTRACP
        CALL WRN('PAMDRIV',-2)
      ENDIF
!
!-----------------------------------------------------------------------
!     * ALLOCATE MEMORY FOR TRACER ARRAYS.
!
      ALLOCATE(TRAC (ILGA,LEVA,NTRACT))
      ALLOCATE(TRRAT(ILGA,LEVA,NTRACT))
!
!     * ALLOCATE MEMORY FOR OTHER INPUT/OUTPUT ARRAYS.
!
      ALLOCATE(ZHA    (ILGA,LEVA))
      ALLOCATE(ZFA    (ILGA,LEVA))
      ALLOCATE(PHA    (ILGA,LEVA))
      ALLOCATE(PFA    (ILGA,LEVA))
      ALLOCATE(DPA    (ILGA,LEVA))
      ALLOCATE(TA     (ILGA,LEVA))
      ALLOCATE(RVA    (ILGA,LEVA))
      ALLOCATE(QTNA   (ILGA,LEVA))
      ALLOCATE(HMNA   (ILGA,LEVA))
      ALLOCATE(RHA    (ILGA,LEVA))
      ALLOCATE(RHTA   (ILGA,LEVA))
      ALLOCATE(WCTA   (ILGA,LEVA))
      ALLOCATE(SPMREP (ILGA,LEVA))
      ALLOCATE(SZMLWC (ILGA,LEVA))
      ALLOCATE(SPFSNOW(ILGA,LEVA))
      ALLOCATE(SPFRAIN(ILGA,LEVA))
      ALLOCATE(SZCLF  (ILGA,LEVA))
      ALLOCATE(SCLRFR (ILGA,LEVA))
      ALLOCATE(SCLRFS (ILGA,LEVA))
      ALLOCATE(SPFEVAP(ILGA,LEVA))
      ALLOCATE(SPFSUBL(ILGA,LEVA))
      ALLOCATE(SGPR   (ILGA,LEVA))
      ALLOCATE(SOAP   (ILGA,LEVA))
      ALLOCATE(DOCEM1S(ILGA,LEVA))
      ALLOCATE(DOCEM2S(ILGA,LEVA))
      ALLOCATE(DOCEM3S(ILGA,LEVA))
      ALLOCATE(DOCEM4S(ILGA,LEVA))
      ALLOCATE(DBCEM1S(ILGA,LEVA))
      ALLOCATE(DBCEM2S(ILGA,LEVA))
      ALLOCATE(DBCEM3S(ILGA,LEVA))
      ALLOCATE(DBCEM4S(ILGA,LEVA))
      ALLOCATE(DSUEM1S(ILGA,LEVA))
      ALLOCATE(DSUEM2S(ILGA,LEVA))
      ALLOCATE(DSUEM3S(ILGA,LEVA))
      ALLOCATE(DSUEM4S(ILGA,LEVA))
      ALLOCATE(XO3    (ILGA,LEVA))
      ALLOCATE(XNA    (ILGA,LEVA))
      ALLOCATE(XAM    (ILGA,LEVA))
      ALLOCATE(XNH3   (ILGA,LEVA))
      ALLOCATE(FCANA  (ILGA,ICANA+1))
      ALLOCATE(ATAUS  (ILGA))
      ALLOCATE(SMFRDU (ILGA))
      ALLOCATE(FCSA   (ILGA))
      ALLOCATE(FGSA   (ILGA))
      ALLOCATE(FCA    (ILGA))
      ALLOCATE(FGA    (ILGA))
      ALLOCATE(ZSPDDD (ILGA))
      ALLOCATE(ZSPDSS (ILGA))
      ALLOCATE(ZSPDDU (ILGA))
      ALLOCATE(CDMLA  (ILGA))
      ALLOCATE(CDMNLA (ILGA))
      ALLOCATE(USTARD (ILGA))
      ALLOCATE(PBLTS  (ILGA))
      ALLOCATE(FLNDDU (ILGA))
      ALLOCATE(FOCNDU (ILGA))
      ALLOCATE(SICNDU (ILGA))
      ALLOCATE(GTRDU  (ILGA))
      ALLOCATE(FNDU   (ILGA))
      ALLOCATE(ZFSA   (ILGA))
      ALLOCATE(PFSA   (ILGA))
!
      ALLOCATE(SPOT   (ILGA))
      ALLOCATE(ST02   (ILGA))
      ALLOCATE(ST03   (ILGA))
      ALLOCATE(ST04   (ILGA))
      ALLOCATE(ST06   (ILGA))
      ALLOCATE(ST13   (ILGA))
      ALLOCATE(ST14   (ILGA))
      ALLOCATE(ST15   (ILGA))
      ALLOCATE(ST16   (ILGA))
      ALLOCATE(ST17   (ILGA))
      ALLOCATE(SUZ0   (ILGA))
      ALLOCATE(SLAI   (ILGA))
!
      ALLOCATE(OEDNIO(ILGA,LEVA,KEXT))
      ALLOCATE(OERCIO(ILGA,LEVA,KEXT))
      ALLOCATE(OIDNIO(ILGA,LEVA))
      ALLOCATE(OIRCIO(ILGA,LEVA))
      ALLOCATE(SVVBIO(ILGA,LEVA))
      ALLOCATE(PSVVIO(ILGA,LEVA))
      ALLOCATE(SVMBIO(ILGA,LEVA,NRMFLD))
      ALLOCATE(SVCBIO(ILGA,LEVA,NRMFLD))
      ALLOCATE(PNVBIO(ILGA,LEVA,ISAINT))
      ALLOCATE(PNMBIO(ILGA,LEVA,ISAINT,NRMFLD))
      ALLOCATE(PNCBIO(ILGA,LEVA,ISAINT,NRMFLD))
      ALLOCATE(PSVBIO(ILGA,LEVA,ISAINT,KINT))
      ALLOCATE(PSMBIO(ILGA,LEVA,ISAINT,KINT,NRMFLD))
      ALLOCATE(PSCBIO(ILGA,LEVA,ISAINT,KINT,NRMFLD))
      ALLOCATE(QNVBIO(ILGA,LEVA,ISAINT))
      ALLOCATE(QNMBIO(ILGA,LEVA,ISAINT,NRMFLD))
      ALLOCATE(QNCBIO(ILGA,LEVA,ISAINT,NRMFLD))
      ALLOCATE(QSVBIO(ILGA,LEVA,ISAINT,KINT))
      ALLOCATE(QSMBIO(ILGA,LEVA,ISAINT,KINT,NRMFLD))
      ALLOCATE(QSCBIO(ILGA,LEVA,ISAINT,KINT,NRMFLD))
      ALLOCATE(QGVBIO(ILGA,LEVA))
      ALLOCATE(QGMBIO(ILGA,LEVA,NRMFLD))
      ALLOCATE(QGCBIO(ILGA,LEVA,NRMFLD))
      ALLOCATE(QDVBIO(ILGA,LEVA))
      ALLOCATE(QDMBIO(ILGA,LEVA,NRMFLD))
      ALLOCATE(QDCBIO(ILGA,LEVA,NRMFLD))
      ALLOCATE(ONVBIO(ILGA,LEVA,ISAINT))
      ALLOCATE(ONMBIO(ILGA,LEVA,ISAINT,NRMFLD))
      ALLOCATE(ONCBIO(ILGA,LEVA,ISAINT,NRMFLD))
      ALLOCATE(OSVBIO(ILGA,LEVA,ISAINT,KINT))
      ALLOCATE(OSMBIO(ILGA,LEVA,ISAINT,KINT,NRMFLD))
      ALLOCATE(OSCBIO(ILGA,LEVA,ISAINT,KINT,NRMFLD))
      ALLOCATE(OGVBIO(ILGA,LEVA))
      ALLOCATE(OGMBIO(ILGA,LEVA,NRMFLD))
      ALLOCATE(OGCBIO(ILGA,LEVA,NRMFLD))
      ALLOCATE(DEVBIO(ILGA,LEVA,KEXT))
      ALLOCATE(PDEVIO(ILGA,LEVA,KEXT))
      ALLOCATE(DEMBIO(ILGA,LEVA,KEXT,NRMFLD))
      ALLOCATE(DECBIO(ILGA,LEVA,KEXT,NRMFLD))
      ALLOCATE(DIVBIO(ILGA,LEVA))
      ALLOCATE(PDIVIO(ILGA,LEVA))
      ALLOCATE(DIMBIO(ILGA,LEVA,NRMFLD))
      ALLOCATE(DICBIO(ILGA,LEVA,NRMFLD))
      ALLOCATE(REVBIO(ILGA,LEVA,KEXT))
      ALLOCATE(PREVIO(ILGA,LEVA,KEXT))
      ALLOCATE(REMBIO(ILGA,LEVA,KEXT,NRMFLD))
      ALLOCATE(RECBIO(ILGA,LEVA,KEXT,NRMFLD))
      ALLOCATE(RIVBIO(ILGA,LEVA))
      ALLOCATE(PRIVIO(ILGA,LEVA))
      ALLOCATE(RIMBIO(ILGA,LEVA,NRMFLD))
      ALLOCATE(RICBIO(ILGA,LEVA,NRMFLD))
      ALLOCATE(CDNC(ILGA,LEVA))
      ALLOCATE(BCIC(ILGA,LEVA))
!
      ALLOCATE(CORN(ILGA,LEVA))
      ALLOCATE(CORM(ILGA,LEVA))
      ALLOCATE(RSN1(ILGA,LEVA))
      ALLOCATE(RSM1(ILGA,LEVA))
      ALLOCATE(RSN2(ILGA,LEVA))
      ALLOCATE(RSM2(ILGA,LEVA))
      ALLOCATE(RSN3(ILGA,LEVA))
      ALLOCATE(RSM3(ILGA,LEVA))
      ALLOCATE(SNCN(ILGA,LEVA))
      ALLOCATE(SSUN(ILGA,LEVA))
      ALLOCATE(SCND(ILGA,LEVA))
      ALLOCATE(SGSP(ILGA,LEVA))
      ALLOCATE(ACAS(ILGA,LEVA))
      ALLOCATE(ACOA(ILGA,LEVA))
      ALLOCATE(ACBC(ILGA,LEVA))
      ALLOCATE(ACSS(ILGA,LEVA))
      ALLOCATE(ACMD(ILGA,LEVA))
      ALLOCATE(CNT (ILGA,LEVA))
      ALLOCATE(CN20(ILGA,LEVA))
      ALLOCATE(CN50(ILGA,LEVA))
      ALLOCATE(CN100(ILGA,LEVA))
      ALLOCATE(CN200(ILGA,LEVA))
      ALLOCATE(CNTW(ILGA,LEVA))
      ALLOCATE(CN20W(ILGA,LEVA))
      ALLOCATE(CN50W(ILGA,LEVA))
      ALLOCATE(CN100W(ILGA,LEVA))
      ALLOCATE(CN200W(ILGA,LEVA))
      ALLOCATE(CCN (ILGA,LEVA))
      ALLOCATE(CCNE(ILGA,LEVA))
      ALLOCATE(CC02(ILGA,LEVA))
      ALLOCATE(CC04(ILGA,LEVA))
      ALLOCATE(CC08(ILGA,LEVA))
      ALLOCATE(CC16(ILGA,LEVA))
      ALLOCATE(RCRI(ILGA,LEVA))
      ALLOCATE(SUPS(ILGA,LEVA))
      ALLOCATE(HENR(ILGA,LEVA))
      ALLOCATE(O3FRC(ILGA,LEVA))
      ALLOCATE(H2O2FRC(ILGA,LEVA))
      ALLOCATE(VRN1(ILGA))
      ALLOCATE(VRM1(ILGA))
      ALLOCATE(VRN2(ILGA))
      ALLOCATE(VRM2(ILGA))
      ALLOCATE(VRN3(ILGA))
      ALLOCATE(VRM3(ILGA))
      ALLOCATE(VNCN(ILGA))
      ALLOCATE(VASN(ILGA))
      ALLOCATE(VCND(ILGA))
      ALLOCATE(VGSP(ILGA))
      ALLOCATE(DEFX(ILGA,ISDIAG))
      ALLOCATE(DEFN(ILGA,ISDIAG))
      ALLOCATE(VOAE(ILGA))
      ALLOCATE(VBCE(ILGA))
      ALLOCATE(VASE(ILGA))
      ALLOCATE(VMDE(ILGA))
      ALLOCATE(VSSE(ILGA))
      ALLOCATE(VOAW(ILGA))
      ALLOCATE(VBCW(ILGA))
      ALLOCATE(VASW(ILGA))
      ALLOCATE(VMDW(ILGA))
      ALLOCATE(VSSW(ILGA))
      ALLOCATE(VOAD(ILGA))
      ALLOCATE(VBCD(ILGA))
      ALLOCATE(VASD(ILGA))
      ALLOCATE(VMDD(ILGA))
      ALLOCATE(VSSD(ILGA))
      ALLOCATE(VOAG(ILGA))
      ALLOCATE(VBCG(ILGA))
      ALLOCATE(VASG(ILGA))
      ALLOCATE(VMDG(ILGA))
      ALLOCATE(VSSG(ILGA))
      ALLOCATE(VASI(ILGA))
      ALLOCATE(VAS1(ILGA))
      ALLOCATE(VAS2(ILGA))
      ALLOCATE(VAS3(ILGA))
      ALLOCATE(VCCN(ILGA))
      ALLOCATE(VCNE(ILGA))
      ALLOCATE(DMAC(ILGA,ISDUST))
      ALLOCATE(DMCO(ILGA,ISDUST))
      ALLOCATE(DNAC(ILGA,ISDUST))
      ALLOCATE(DNCO(ILGA,ISDUST))
      ALLOCATE(DUWD(ILGA))
      ALLOCATE(DUST(ILGA))
      ALLOCATE(DUTH(ILGA))
      ALLOCATE(FALL(ILGA))
      ALLOCATE(FA10(ILGA))
      ALLOCATE(FA2 (ILGA))
      ALLOCATE(FA1 (ILGA))
      ALLOCATE(USMK(ILGA))
      ALLOCATE(DEFA(ILGA))
      ALLOCATE(DEFC(ILGA))
!
!-----------------------------------------------------------------------
!     * COPY AEROSOL TRACER FIELDS.
!
      MSGP2A=ILEVP1-LEVA+1
      MSGP1A=ILEV  -LEVA+1
      DO NS=1,NTRACS
        N=IAIND(NS)
        TRAC (1:ILGA,1:LEVA,NS)=XROW   (IL1:IL2,MSGP2A:ILEVP1,N)
        TRRAT(1:ILGA,1:LEVA,NS)=SFRCROL(IL1:IL2,MSGP1A:ILEV,N)
      ENDDO
!
!     * COPY GAS TRACER FIELDS.
!
      TRAC (1:ILGA,1:LEVA,JGS6)=XROW   (IL1:IL2,MSGP2A:ILEVP1,IGS6)
      TRAC (1:ILGA,1:LEVA,JGSP)=XROW   (IL1:IL2,MSGP2A:ILEVP1,IGSP)
      TRAC (1:ILGA,1:LEVA,JSO2)=XROW   (IL1:IL2,MSGP2A:ILEVP1,ISO2)
      TRAC (1:ILGA,1:LEVA,JHPO)=XROW   (IL1:IL2,MSGP2A:ILEVP1,IHPO)
      TRRAT(1:ILGA,1:LEVA,JGS6)=SFRCROL(IL1:IL2,MSGP1A:ILEV,IGS6)
      TRRAT(1:ILGA,1:LEVA,JGSP)=SFRCROL(IL1:IL2,MSGP1A:ILEV,IGSP)
      TRRAT(1:ILGA,1:LEVA,JSO2)=SFRCROL(IL1:IL2,MSGP1A:ILEV,ISO2)
      TRRAT(1:ILGA,1:LEVA,JHPO)=SFRCROL(IL1:IL2,MSGP1A:ILEV,IHPO)
!
!     * COPY METEOROLOGICAL VARIABLES FOR PLA CALCULATIONS.
!
      ZFSA=ZFS  (IL1:IL2)
      PFSA=PFS  (IL1:IL2)
      ZHA =ZH   (IL1:IL2,MSGP1A:ILEV)
      PHA =PH   (IL1:IL2,MSGP1A:ILEV)
      DPA =DP   (IL1:IL2,MSGP1A:ILEV)
      TA  =THROW(IL1:IL2,MSGP2A:ILEVP1)
      RVA =QROW (IL1:IL2,MSGP2A:ILEVP1)*DSA
      QTNA=QTN  (IL1:IL2,MSGP1A:ILEV)
      HMNA=HMN  (IL1:IL2,MSGP1A:ILEV)
      RHA =RHC  (IL1:IL2,MSGP1A:ILEV)
      RHTA=RHT  (IL1:IL2,MSGP1A:ILEV)
      WCTA=MAX(WG(IL1:IL2,MSGP1A:ILEV),0.) &
          +WSUB (IL1:IL2,MSGP1A:ILEV)
      DEALLOCATE(DSA)
!
!     * COPY LEVEL INFORMATION AT GRID CELL INTERFACES.
!     * THIS INVOLVES SHIFTING THE VERTICAL GRID.
!
      DO L=1,LEVA
        LO=L-LEVA+ILEV-1
        ZFA(:,L)=ZF(IL1:IL2,LO)
        PFA(:,L)=PF(IL1:IL2,LO)
      ENDDO
!
!     * CLOUD MICROPHYSICAL PARAMETERS.
!
      SPMREP =ZMRATEP(IL1:IL2,MSGP1A:ILEV)
      SZMLWC =ZMLWC  (IL1:IL2,MSGP1A:ILEV)
      SPFSNOW=ZFSNOW (IL1:IL2,MSGP1A:ILEV)
      SPFRAIN=ZFRAIN (IL1:IL2,MSGP1A:ILEV)
      SZCLF  =ZCLF   (IL1:IL2,MSGP1A:ILEV)
      SCLRFR =CLRFR  (IL1:IL2,MSGP1A:ILEV)
      SCLRFS =CLRFS  (IL1:IL2,MSGP1A:ILEV)
      SPFEVAP=ZFEVAP (IL1:IL2,MSGP1A:ILEV)
      SPFSUBL=ZFSUBL (IL1:IL2,MSGP1A:ILEV)
!
!     * CHEMICAL SOURCES.
!
      SGPR=SGPP(IL1:IL2,MSGP1A:ILEV)*WH2SO4/WS
      SOAP=OGPP(IL1:IL2,MSGP1A:ILEV)
!
!     * PRIMARY EMISSIONS OF AEROSOL.
!
      DOCEM1S=DOCEM1(IL1:IL2,MSGP1A:ILEV)
      DOCEM2S=DOCEM2(IL1:IL2,MSGP1A:ILEV)
      DOCEM3S=DOCEM3(IL1:IL2,MSGP1A:ILEV)
      DOCEM4S=DOCEM4(IL1:IL2,MSGP1A:ILEV)
      DBCEM1S=DBCEM1(IL1:IL2,MSGP1A:ILEV)
      DBCEM2S=DBCEM2(IL1:IL2,MSGP1A:ILEV)
      DBCEM3S=DBCEM3(IL1:IL2,MSGP1A:ILEV)
      DBCEM4S=DBCEM4(IL1:IL2,MSGP1A:ILEV)
      DSUEM1S=DSUEM1(IL1:IL2,MSGP1A:ILEV)
      DSUEM2S=DSUEM2(IL1:IL2,MSGP1A:ILEV)
      DSUEM3S=DSUEM3(IL1:IL2,MSGP1A:ILEV)
      DSUEM4S=DSUEM4(IL1:IL2,MSGP1A:ILEV)
!
!     * BACKGROUND CONCENTRATIONS.
!
      XO3 =O3ROW  (IL1:IL2,MSGP1A:ILEV)
      XNA =HNO3ROW(IL1:IL2,MSGP1A:ILEV)
      XNH3=NH3ROW (IL1:IL2,MSGP1A:ILEV)
      XAM =NH3ROW (IL1:IL2,MSGP1A:ILEV) &
          +NH4ROW (IL1:IL2,MSGP1A:ILEV)
!
!     * AGING TIME SCALE.
!
      ATAUS =ATAU   (IL1:IL2)
!
!     * SURFACE PARAMETERS.
!
      PBLTS =MAX(NINT(PBLTROW(IL1:IL2))-ILEV,-LEVA+1)
      SMFRDU=SMFRAC (IL1:IL2)
      FCSA  =FCS    (IL1:IL2)
      FGSA  =FGS    (IL1:IL2)
      FCA   =FC     (IL1:IL2)
      FGA   =FG     (IL1:IL2)
      ZSPDDD=ZSPD   (IL1:IL2)
      ZSPDSS=ZSPDSO (IL1:IL2)
      ZSPDDU=ZSPDSBS(IL1:IL2)
      CDMLA =CDML   (IL1:IL2)
      CDMNLA=CDMNL  (IL1:IL2)
      USTARD=USTARBS(IL1:IL2)
      FLNDDU=FLND   (IL1:IL2)
      FOCNDU=FOCN   (IL1:IL2)
      SICNDU=SICN   (IL1:IL2)
      GTRDU =GTROW  (IL1:IL2)
      FNDU  =FNROL  (IL1:IL2)
      FCANA =FCANROW(IL1:IL2,1:ICAN+1)
!
!     * DUST PARAMETERS.
!
      SPOT=SPOTROW(IL1:IL2)
      ST02=ST02ROW(IL1:IL2)
      ST03=ST03ROW(IL1:IL2)
      ST04=ST04ROW(IL1:IL2)
      ST06=ST06ROW(IL1:IL2)
      ST13=ST13ROW(IL1:IL2)
      ST14=ST14ROW(IL1:IL2)
      ST15=ST15ROW(IL1:IL2)
      ST16=ST16ROW(IL1:IL2)
      ST17=ST17ROW(IL1:IL2)
      SUZ0=SUZ0ROW(IL1:IL2)
!
!      BSFRAC IS THE BARE SOIL FRACTION PASSED FROM CCCMA GCM LAND SCHEME CLASS (DEFAULT).
!      BSFRAC IS COMBINED WITH THE SOIL MOISTURE CRITERION (W0) TO OBTAIN THE POTENTIAL DUST
!      SOURCE AREA.
!      PDSFROW IS A PRESCRIBED POTENTIAL DUST SOURCE AREAL FRACTION OBTAINED FROM AN OFFLINE
!      TERRESTRIAL MODEL, IN WHICH THE SOIL MOISTURE & SNOW COVER CRITERIA WERE SATISFIED.
!      PDSFROW IS ONLY APPLIED FOR THE PURPOSE OF DUST PARAMETERIZATION DEVELOPMENT.
!
      IF (CCCMABF) THEN
        SLAI=BSFRAC(IL1:IL2)
      ELSE
        SLAI=PDSFROW(IL1:IL2)
      ENDIF
!
!     * CHECK IF THE NUMBER OF FIELDS FOR AVERAGING OF CLOUD
!     * DROPLET RESULTS IS SUFFICIENT (INCREASE NRMFLD, IF NECESSARY).
!
      IF ( CEILING(REAL(IAVGPRD)/REAL(IUPDATP)) > NRMFLD ) THEN
        CALL XIT('PAMDRIV',-3)
      ENDIF
!
!     * PARAMETER CHECK FOR PAM INTERNAL INPUT/OUTPUT FIELDS.
!
      IF ( KEXTT /= KEXT ) CALL XIT('PAMDRIV',-4)
      IF ( KINTT /= KINT ) CALL XIT('PAMDRIV',-5)
      IF ( ISAINTT /= ISAINT ) CALL XIT('PAMDRIV',-6)
!
!     * PAM INTERNAL INPUT/OUTPUT FIELDS THAT ARE REQUIRED
!     * FOR AVERAGING AND DISTRIBUTING TENDENCIES FROM SUBROUTINES
!     * THAT ARE NOT CALLED EVERY TIME STEP.
!
      OEDNIO=OEDNROW(IL1:IL2,MSGP1A:ILEV,:)
      OERCIO=OERCROW(IL1:IL2,MSGP1A:ILEV,:)
      OIDNIO=OIDNROW(IL1:IL2,MSGP1A:ILEV)
      OIRCIO=OIRCROW(IL1:IL2,MSGP1A:ILEV)
      SVVBIO=SVVBROW(IL1:IL2,MSGP1A:ILEV)
      PSVVIO=PSVVROW(IL1:IL2,MSGP1A:ILEV)
      SVMBIO=SVMBROW(IL1:IL2,MSGP1A:ILEV,:)
      SVCBIO=NINT(SVCBROW(IL1:IL2,MSGP1A:ILEV,:))
!
      PNVBIO=PNVBROW(IL1:IL2,MSGP1A:ILEV,:)
      PNMBIO=PNMBROW(IL1:IL2,MSGP1A:ILEV,:,:)
      PNCBIO=NINT(PNCBROW(IL1:IL2,MSGP1A:ILEV,:,:))
      PSVBIO=PSVBROW(IL1:IL2,MSGP1A:ILEV,:,:)
      PSMBIO=PSMBROW(IL1:IL2,MSGP1A:ILEV,:,:,:)
      PSCBIO=NINT(PSCBROW(IL1:IL2,MSGP1A:ILEV,:,:,:))
!
      QNVBIO=QNVBROW(IL1:IL2,MSGP1A:ILEV,:)
      QNMBIO=QNMBROW(IL1:IL2,MSGP1A:ILEV,:,:)
      QNCBIO=NINT(QNCBROW(IL1:IL2,MSGP1A:ILEV,:,:))
      QSVBIO=QSVBROW(IL1:IL2,MSGP1A:ILEV,:,:)
      QSMBIO=QSMBROW(IL1:IL2,MSGP1A:ILEV,:,:,:)
      QSCBIO=NINT(QSCBROW(IL1:IL2,MSGP1A:ILEV,:,:,:))
!
      QGVBIO=QGVBROW(IL1:IL2,MSGP1A:ILEV)
      QGMBIO=QGMBROW(IL1:IL2,MSGP1A:ILEV,:)
      QGCBIO=NINT(QGCBROW(IL1:IL2,MSGP1A:ILEV,:))
      QDVBIO=QDVBROW(IL1:IL2,MSGP1A:ILEV)
      QDMBIO=QDMBROW(IL1:IL2,MSGP1A:ILEV,:)
      QDCBIO=NINT(QDCBROW(IL1:IL2,MSGP1A:ILEV,:))
      ONVBIO=ONVBROW(IL1:IL2,MSGP1A:ILEV,:)
      ONMBIO=ONMBROW(IL1:IL2,MSGP1A:ILEV,:,:)
      ONCBIO=NINT(ONCBROW(IL1:IL2,MSGP1A:ILEV,:,:))
      OSVBIO=OSVBROW(IL1:IL2,MSGP1A:ILEV,:,:)
      OSMBIO=OSMBROW(IL1:IL2,MSGP1A:ILEV,:,:,:)
      OSCBIO=NINT(OSCBROW(IL1:IL2,MSGP1A:ILEV,:,:,:))
      OGVBIO=OGVBROW(IL1:IL2,MSGP1A:ILEV)
      OGMBIO=OGMBROW(IL1:IL2,MSGP1A:ILEV,:)
      OGCBIO=NINT(OGCBROW(IL1:IL2,MSGP1A:ILEV,:))
!
      DEVBIO=DEVBROW(IL1:IL2,MSGP1A:ILEV,:)
      PDEVIO=PDEVROW(IL1:IL2,MSGP1A:ILEV,:)
      DEMBIO=DEMBROW(IL1:IL2,MSGP1A:ILEV,:,:)
      DECBIO=NINT(DECBROW(IL1:IL2,MSGP1A:ILEV,:,:))
      DIVBIO=DIVBROW(IL1:IL2,MSGP1A:ILEV)
      PDIVIO=PDIVROW(IL1:IL2,MSGP1A:ILEV)
      DIMBIO=DIMBROW(IL1:IL2,MSGP1A:ILEV,:)
      DICBIO=NINT(DICBROW(IL1:IL2,MSGP1A:ILEV,:))
!
      REVBIO=REVBROW(IL1:IL2,MSGP1A:ILEV,:)
      PREVIO=PREVROW(IL1:IL2,MSGP1A:ILEV,:)
      REMBIO=REMBROW(IL1:IL2,MSGP1A:ILEV,:,:)
      RECBIO=NINT(RECBROW(IL1:IL2,MSGP1A:ILEV,:,:))
      RIVBIO=RIVBROW(IL1:IL2,MSGP1A:ILEV)
      PRIVIO=PRIVROW(IL1:IL2,MSGP1A:ILEV)
      RIMBIO=RIMBROW(IL1:IL2,MSGP1A:ILEV,:)
      RICBIO=NINT(RICBROW(IL1:IL2,MSGP1A:ILEV,:))
!
!-----------------------------------------------------------------------
!     * AEROSOL MICROPHYSICAL AND CHEMICAL CALCULATIONS.
!
      CALL PAM(TRAC,TRRAT, &
               ZHA,ZFA,PHA,PFA,DPA,TA,RVA,QTNA,HMNA,RHA,RHTA,WCTA, &
               SPMREP,SZMLWC,SPFSNOW,SPFRAIN,SZCLF,SCLRFR,SCLRFS, &
               SPFEVAP,SPFSUBL,SGPR,SOAP,DOCEM1S,DOCEM2S,DOCEM3S, &
               DOCEM4S,DBCEM1S,DBCEM2S,DBCEM3S,DBCEM4S,DSUEM1S, &
               DSUEM2S,DSUEM3S,DSUEM4S, &
               XO3,XNA,XAM,XNH3,FCANA,PBLTS,SMFRDU,FCSA,FGSA,FCA, &
               FGA,ZSPDDD,ZSPDSS,ZSPDDU,CDMLA,CDMNLA,USTARD, &
               FLNDDU,FOCNDU,SICNDU,GTRDU,FNDU, &
               SPOT,ST02,ST03,ST04,ST06,ST13,ST14,ST15, &
               ST16,ST17,SUZ0,SLAI,ATAUS,ZFSA,PFSA, &
               OEDNIO,OERCIO,OIDNIO,OIRCIO,SVVBIO,PSVVIO,SVMBIO, &
               SVCBIO,PNVBIO,PNMBIO,PNCBIO,PSVBIO,PSMBIO,PSCBIO, &
               QNVBIO,QNMBIO,QNCBIO,QSVBIO,QSMBIO,QSCBIO,QGVBIO, &
               QGMBIO,QGCBIO,QDVBIO,QDMBIO,QDCBIO,ONVBIO,ONMBIO, &
               ONCBIO,OSVBIO,OSMBIO,OSCBIO,OGVBIO,OGMBIO,OGCBIO, &
               DEVBIO,PDEVIO,DEMBIO,DECBIO,DIVBIO,PDIVIO,DIMBIO, &
               DICBIO,REVBIO,PREVIO,REMBIO,RECBIO,RIVBIO,PRIVIO, &
               RIMBIO,RICBIO, &
               CDNC,BCIC,ACAS,ACOA,ACBC,ACSS,ACMD, &
               CORN,CORM,RSN1,RSM1,RSN2,RSM2,RSN3,RSM3,SNCN,SSUN, &
               SCND,SGSP,CCN,CCNE,CC02,CC04,CC08,CC16,CNT,CN20, &
               CN50,CN100,CN200,CNTW,CN20W,CN50W,CN100W,CN200W, &
               RCRI,SUPS,VRN1,VRM1,VRN2,VRM2,VRN3,VRM3,VNCN,VASN, &
               VCND,VGSP,DEFX,DEFN,VOAE,VBCE,VASE,VMDE,VSSE,VOAW, &
               VBCW,VASW,VMDW,VSSW,VOAD,VBCD,VASD,VMDD,VSSD,VOAG, &
               VBCG,VASG,VMDG,VSSG,VASI,VAS1,VAS2,VAS3,HENR,O3FRC, &
               H2O2FRC,VCCN,VCNE,DMAC,DMCO,DNAC,DNCO,DUWD,DUST, &
               DUTH,FALL,FA10,FA2,FA1,USMK,DEFA,DEFC,KAVGS,DT, &
               SICN_CRT,CO2,ICANA,LEVA,ILGA,KNT,ISVDUST)
!
!-----------------------------------------------------------------------
!     * COPY AEROSOL TRACER FIELDS.
!
      DO NS=1,NTRACS
        N=IAIND(NS)
        XROW   (IL1:IL2,MSGP2A:ILEVP1,N)=TRAC (1:ILGA,1:LEVA,NS)
        SFRCROL(IL1:IL2,MSGP1A:ILEV,N)=TRRAT(1:ILGA,1:LEVA,NS)
      ENDDO
!
!     * COPY GAS TRACER FIELDS.
!
      XROW   (IL1:IL2,MSGP2A:ILEVP1,IGS6)=TRAC (1:ILGA,1:LEVA,JGS6)
      XROW   (IL1:IL2,MSGP2A:ILEVP1,IGSP)=TRAC (1:ILGA,1:LEVA,JGSP)
      XROW   (IL1:IL2,MSGP2A:ILEVP1,ISO2)=TRAC (1:ILGA,1:LEVA,JSO2)
      XROW   (IL1:IL2,MSGP2A:ILEVP1,IHPO)=TRAC (1:ILGA,1:LEVA,JHPO)
      SFRCROL(IL1:IL2,MSGP1A:ILEV,IGS6)=TRRAT(1:ILGA,1:LEVA,JGS6)
      SFRCROL(IL1:IL2,MSGP1A:ILEV,IGSP)=TRRAT(1:ILGA,1:LEVA,JGSP)
      SFRCROL(IL1:IL2,MSGP1A:ILEV,ISO2)=TRRAT(1:ILGA,1:LEVA,JSO2)
      SFRCROL(IL1:IL2,MSGP1A:ILEV,IHPO)=TRRAT(1:ILGA,1:LEVA,JHPO)
!
!     * MAKE SURE CONCENTRATIONS ARE SUFFICIENTLY LARGE FOR FURTHER
!     * CALCULATIONS (HYBRID VARIABLE).
!
      IF ( NTRACS > 0 ) THEN
        DO N=IAIND(1),IAIND(NTRACS)
          XROW(IL1:IL2,MSGP2A:ILEVP1,N)= &
                              MAX(XROW(IL1:IL2,MSGP2A:ILEVP1,N),TMIN(N))
        ENDDO
      ENDIF
      XROW(IL1:IL2,MSGP2A:ILEVP1,IGS6)= &
                        MAX(XROW(IL1:IL2,MSGP2A:ILEVP1,IGS6),TMIN(IGS6))
      XROW(IL1:IL2,MSGP2A:ILEVP1,IGSP)= &
                        MAX(XROW(IL1:IL2,MSGP2A:ILEVP1,IGSP),TMIN(IGSP))
      XROW(IL1:IL2,MSGP2A:ILEVP1,ISO2)= &
                        MAX(XROW(IL1:IL2,MSGP2A:ILEVP1,ISO2),TMIN(ISO2))
      XROW(IL1:IL2,MSGP2A:ILEVP1,IHPO)= &
                        MAX(XROW(IL1:IL2,MSGP2A:ILEVP1,IHPO),TMIN(IHPO))
!
!     * PAM INTERNAL INPUT/OUTPUT FIELDS THAT ARE REQUIRED
!     * FOR AVERAGING AND DISTRIBUTING TENDENCIES FROM SUBROUTINES
!     * THAT ARE NOT CALLED EVERY TIME STEP.
!
      OEDNROW(IL1:IL2,MSGP1A:ILEV,:)=OEDNIO
      OERCROW(IL1:IL2,MSGP1A:ILEV,:)=OERCIO
      OIDNROW(IL1:IL2,MSGP1A:ILEV)  =OIDNIO
      OIRCROW(IL1:IL2,MSGP1A:ILEV)  =OIRCIO
      SVVBROW(IL1:IL2,MSGP1A:ILEV)  =SVVBIO
      PSVVROW(IL1:IL2,MSGP1A:ILEV)  =PSVVIO
      SVMBROW(IL1:IL2,MSGP1A:ILEV,:)=SVMBIO
      SVCBROW(IL1:IL2,MSGP1A:ILEV,:)=REAL(SVCBIO)
!
      PNVBROW(IL1:IL2,MSGP1A:ILEV,:)    =PNVBIO
      PNMBROW(IL1:IL2,MSGP1A:ILEV,:,:)  =PNMBIO
      PNCBROW(IL1:IL2,MSGP1A:ILEV,:,:)  =REAL(PNCBIO)
      PSVBROW(IL1:IL2,MSGP1A:ILEV,:,:)  =PSVBIO
      PSMBROW(IL1:IL2,MSGP1A:ILEV,:,:,:)=PSMBIO
      PSCBROW(IL1:IL2,MSGP1A:ILEV,:,:,:)=REAL(PSCBIO)
!
      QNVBROW(IL1:IL2,MSGP1A:ILEV,:)    =QNVBIO
      QNMBROW(IL1:IL2,MSGP1A:ILEV,:,:)  =QNMBIO
      QNCBROW(IL1:IL2,MSGP1A:ILEV,:,:)  =REAL(QNCBIO)
      QSVBROW(IL1:IL2,MSGP1A:ILEV,:,:)  =QSVBIO
      QSMBROW(IL1:IL2,MSGP1A:ILEV,:,:,:)=QSMBIO
      QSCBROW(IL1:IL2,MSGP1A:ILEV,:,:,:)=REAL(QSCBIO)
!
      QGVBROW(IL1:IL2,MSGP1A:ILEV)      =QGVBIO
      QGMBROW(IL1:IL2,MSGP1A:ILEV,:)    =QGMBIO
      QGCBROW(IL1:IL2,MSGP1A:ILEV,:)    =REAL(QGCBIO)
      QDVBROW(IL1:IL2,MSGP1A:ILEV)      =QDVBIO
      QDMBROW(IL1:IL2,MSGP1A:ILEV,:)    =QDMBIO
      QDCBROW(IL1:IL2,MSGP1A:ILEV,:)    =REAL(QDCBIO)
      ONVBROW(IL1:IL2,MSGP1A:ILEV,:)    =ONVBIO
      ONMBROW(IL1:IL2,MSGP1A:ILEV,:,:)  =ONMBIO
      ONCBROW(IL1:IL2,MSGP1A:ILEV,:,:)  =REAL(ONCBIO)
      OSVBROW(IL1:IL2,MSGP1A:ILEV,:,:)  =OSVBIO
      OSMBROW(IL1:IL2,MSGP1A:ILEV,:,:,:)=OSMBIO
      OSCBROW(IL1:IL2,MSGP1A:ILEV,:,:,:)=REAL(OSCBIO)
      OGVBROW(IL1:IL2,MSGP1A:ILEV)      =OGVBIO
      OGMBROW(IL1:IL2,MSGP1A:ILEV,:)    =OGMBIO
      OGCBROW(IL1:IL2,MSGP1A:ILEV,:)    =REAL(OGCBIO)
!
      DEVBROW(IL1:IL2,MSGP1A:ILEV,:)    =DEVBIO
      PDEVROW(IL1:IL2,MSGP1A:ILEV,:)    =PDEVIO
      DEMBROW(IL1:IL2,MSGP1A:ILEV,:,:)  =DEMBIO
      DECBROW(IL1:IL2,MSGP1A:ILEV,:,:)  =REAL(DECBIO)
      DIVBROW(IL1:IL2,MSGP1A:ILEV)      =DIVBIO
      PDIVROW(IL1:IL2,MSGP1A:ILEV)      =PDIVIO
      DIMBROW(IL1:IL2,MSGP1A:ILEV,:)    =DIMBIO
      DICBROW(IL1:IL2,MSGP1A:ILEV,:)    =REAL(DICBIO)
!
      REVBROW(IL1:IL2,MSGP1A:ILEV,:)    =REVBIO
      PREVROW(IL1:IL2,MSGP1A:ILEV,:)    =PREVIO
      REMBROW(IL1:IL2,MSGP1A:ILEV,:,:)  =REMBIO
      RECBROW(IL1:IL2,MSGP1A:ILEV,:,:)  =REAL(RECBIO)
      RIVBROW(IL1:IL2,MSGP1A:ILEV)      =RIVBIO
      PRIVROW(IL1:IL2,MSGP1A:ILEV)      =PRIVIO
      RIMBROW(IL1:IL2,MSGP1A:ILEV,:)    =RIMBIO
      RICBROW(IL1:IL2,MSGP1A:ILEV,:)    =REAL(RICBIO)
!
!     * RESULTS THAT ARE USED FOR CALCULATIONS OF CLOUD
!     * PROCESSES IN THE DRIVING MODEL.
!
      ZCDNROW(IL1:IL2,MSGP1A:ILEV)=CDNC
!!!!
! id  oaerrad
!      BCICROW(IL1:IL2,MSGP1A:ILEV)=0.
      BCICROW(IL1:IL2,MSGP1A:ILEV)=BCIC
      DEPBROL(IL1:IL2)=DEPBROL(IL1:IL2)-MIN(VBCW,0.)-MIN(VBCD,0.)
!
!     * THE SAME FIELDS AS IN THE PREVIOUS SECTION BUT FOR THE
!     * REGION THAT IS OUTSIDE OF THE PAM DOMAIN.
!
      IF ( LEVA < ILEV ) THEN
        DO L=1,MSGP1A-1
          ZCDNROW(IL1:IL2,L)=CDNC(1:ILGA,1)
!!!!
! id  oaerrad
!          BCICROW(IL1:IL2,L)=0.
          BCICROW(IL1:IL2,L)=BCIC(1:ILGA,1)
        ENDDO
      ENDIF
!
      IF ( ISVDUST > 0 ) THEN
        DUWDROW(IL1:IL2)=DUWDROW(IL1:IL2)+DUWD*SAVERAD
        DUSTROW(IL1:IL2)=DUSTROW(IL1:IL2)+DUST*SAVERAD
        DUTHROW(IL1:IL2)=DUTHROW(IL1:IL2)+DUTH*SAVERAD
        FALLROW(IL1:IL2)=FALLROW(IL1:IL2)+FALL*SAVERAD
        FA10ROW(IL1:IL2)=FA10ROW(IL1:IL2)+FA10*SAVERAD
        FA2ROW (IL1:IL2)=FA2ROW (IL1:IL2)+FA2 *SAVERAD
        FA1ROW (IL1:IL2)=FA1ROW (IL1:IL2)+FA1 *SAVERAD
        USMKROW(IL1:IL2)=USMKROW(IL1:IL2)+USMK*SAVERAD
        DEFAROW(IL1:IL2)=DEFAROW(IL1:IL2)+DEFA*SAVERAD
        DEFCROW(IL1:IL2)=DEFCROW(IL1:IL2)+DEFC*SAVERAD
      ENDIF
!
      IF ( KXTRA1 ) THEN
        SSUNROW(IL1:IL2,MSGP1A:ILEV)=SSUNROW(IL1:IL2,MSGP1A:ILEV) &
                                   +SSUN*SAVERAD
        VASNROW(IL1:IL2)=VASNROW(IL1:IL2)+VASN*SAVERAD
        IF ( .NOT.KAVGS ) THEN
          VNCNROW(IL1:IL2)=VNCNROW(IL1:IL2)+VNCN*SAVERAD
          VSCDROW(IL1:IL2)=VSCDROW(IL1:IL2)+VCND*SAVERAD
          VGSPROW(IL1:IL2)=VGSPROW(IL1:IL2)+VGSP*SAVERAD
          SNCNROW(IL1:IL2,MSGP1A:ILEV)=SNCN
          SCNDROW(IL1:IL2,MSGP1A:ILEV)=SCND
          SGSPROW(IL1:IL2,MSGP1A:ILEV)=SGSP
        ENDIF
        ACASROW(IL1:IL2,MSGP1A:ILEV)=ACASROW(IL1:IL2,MSGP1A:ILEV) &
                                    +ACAS*SAVERAD
        ACOAROW(IL1:IL2,MSGP1A:ILEV)=ACOAROW(IL1:IL2,MSGP1A:ILEV) &
                                    +ACOA*SAVERAD
        ACBCROW(IL1:IL2,MSGP1A:ILEV)=ACBCROW(IL1:IL2,MSGP1A:ILEV) &
                                    +ACBC*SAVERAD
        ACSSROW(IL1:IL2,MSGP1A:ILEV)=ACSSROW(IL1:IL2,MSGP1A:ILEV) &
                                    +ACSS*SAVERAD
        ACMDROW(IL1:IL2,MSGP1A:ILEV)=ACMDROW(IL1:IL2,MSGP1A:ILEV) &
                                    +ACMD*SAVERAD
        NTROW  (IL1:IL2,MSGP1A:ILEV)=  NTROW(IL1:IL2,MSGP1A:ILEV) &
                                    +  CNT*SAVERAD
        N20ROW (IL1:IL2,MSGP1A:ILEV)= N20ROW(IL1:IL2,MSGP1A:ILEV) &
                                    + CN20*SAVERAD
        N50ROW (IL1:IL2,MSGP1A:ILEV)= N50ROW(IL1:IL2,MSGP1A:ILEV) &
                                    + CN50*SAVERAD
        N100ROW(IL1:IL2,MSGP1A:ILEV)=N100ROW(IL1:IL2,MSGP1A:ILEV) &
                                    +CN100*SAVERAD
        N200ROW(IL1:IL2,MSGP1A:ILEV)=N200ROW(IL1:IL2,MSGP1A:ILEV) &
                                    +CN200*SAVERAD
        WTROW  (IL1:IL2,MSGP1A:ILEV)=  WTROW(IL1:IL2,MSGP1A:ILEV) &
                                    +  CNTW*SAVERAD
        W20ROW (IL1:IL2,MSGP1A:ILEV)= W20ROW(IL1:IL2,MSGP1A:ILEV) &
                                    + CN20W*SAVERAD
        W50ROW (IL1:IL2,MSGP1A:ILEV)= W50ROW(IL1:IL2,MSGP1A:ILEV) &
                                    + CN50W*SAVERAD
        W100ROW(IL1:IL2,MSGP1A:ILEV)=W100ROW(IL1:IL2,MSGP1A:ILEV) &
                                    +CN100W*SAVERAD
        W200ROW(IL1:IL2,MSGP1A:ILEV)=W200ROW(IL1:IL2,MSGP1A:ILEV) &
                                    +CN200W*SAVERAD
        CCNROW (IL1:IL2,MSGP1A:ILEV)=CCN
        CCNEROW(IL1:IL2,MSGP1A:ILEV)=CCNE
        CC02ROW(IL1:IL2,MSGP1A:ILEV)=CC02ROW(IL1:IL2,MSGP1A:ILEV) &
                                   +CC02*SAVERAD
        CC04ROW(IL1:IL2,MSGP1A:ILEV)=CC04ROW(IL1:IL2,MSGP1A:ILEV) &
                                   +CC04*SAVERAD
        CC08ROW(IL1:IL2,MSGP1A:ILEV)=CC08ROW(IL1:IL2,MSGP1A:ILEV) &
                                   +CC08*SAVERAD
        CC16ROW(IL1:IL2,MSGP1A:ILEV)=CC16ROW(IL1:IL2,MSGP1A:ILEV) &
                                   +CC16*SAVERAD
        RCRIROW(IL1:IL2,MSGP1A:ILEV)=RCRI
        SUPSROW(IL1:IL2,MSGP1A:ILEV)=SUPS
        HENRROW(IL1:IL2,MSGP1A:ILEV)=HENR
        O3FROW(IL1:IL2,MSGP1A:ILEV)=O3FRC
        H2O2FROW(IL1:IL2,MSGP1A:ILEV)=H2O2FRC
        WPARROW(IL1:IL2,MSGP1A:ILEV)=WCTA
        VOAEROW(IL1:IL2)=VOAEROW(IL1:IL2)+VOAE*SAVERAD
        VBCEROW(IL1:IL2)=VBCEROW(IL1:IL2)+VBCE*SAVERAD
        VASEROW(IL1:IL2)=VASEROW(IL1:IL2)+VASE*SAVERAD
        VMDEROW(IL1:IL2)=VMDEROW(IL1:IL2)+VMDE*SAVERAD
        VSSEROW(IL1:IL2)=VSSEROW(IL1:IL2)+VSSE*SAVERAD
        VOAWROW(IL1:IL2)=VOAWROW(IL1:IL2)+VOAW*SAVERAD
        VBCWROW(IL1:IL2)=VBCWROW(IL1:IL2)+VBCW*SAVERAD
        VASWROW(IL1:IL2)=VASWROW(IL1:IL2)+VASW*SAVERAD
        VMDWROW(IL1:IL2)=VMDWROW(IL1:IL2)+VMDW*SAVERAD
        VSSWROW(IL1:IL2)=VSSWROW(IL1:IL2)+VSSW*SAVERAD
        VOADROW(IL1:IL2)=VOADROW(IL1:IL2)+VOAD*SAVERAD
        VBCDROW(IL1:IL2)=VBCDROW(IL1:IL2)+VBCD*SAVERAD
        VASDROW(IL1:IL2)=VASDROW(IL1:IL2)+VASD*SAVERAD
        VMDDROW(IL1:IL2)=VMDDROW(IL1:IL2)+VMDD*SAVERAD
        VSSDROW(IL1:IL2)=VSSDROW(IL1:IL2)+VSSD*SAVERAD
        VOAGROW(IL1:IL2)=VOAGROW(IL1:IL2)+VOAG*SAVERAD
        VBCGROW(IL1:IL2)=VBCGROW(IL1:IL2)+VBCG*SAVERAD
        VASGROW(IL1:IL2)=VASGROW(IL1:IL2)+VASG*SAVERAD
        VMDGROW(IL1:IL2)=VMDGROW(IL1:IL2)+VMDG*SAVERAD
        VSSGROW(IL1:IL2)=VSSGROW(IL1:IL2)+VSSG*SAVERAD
        VASIROW(IL1:IL2)=VASIROW(IL1:IL2)+VASI*SAVERAD
        VAS1ROW(IL1:IL2)=VAS1ROW(IL1:IL2)+VAS1*SAVERAD
        VAS2ROW(IL1:IL2)=VAS2ROW(IL1:IL2)+VAS2*SAVERAD
        VAS3ROW(IL1:IL2)=VAS3ROW(IL1:IL2)+VAS3*SAVERAD
        VCCNROW(IL1:IL2)=VCCN
        VCNEROW(IL1:IL2)=VCNE
!
!       * THE SAME FIELDS AS IN THE PREVIOUS SECTION BUT FOR THE
!       * REGION THAT IS OUTSIDE OF THE PAM DOMAIN.
!
        IF ( LEVA < ILEV ) THEN
          DO L=1,MSGP1A-1
            SSUNROW(IL1:IL2,L)=0.
            IF ( .NOT.KAVGS ) THEN
              SNCNROW(IL1:IL2,L)=0.
              SCNDROW(IL1:IL2,L)=0.
              SGSPROW(IL1:IL2,L)=0.
            ENDIF
            ACASROW(IL1:IL2,L)=0.
            ACOAROW(IL1:IL2,L)=0.
            ACBCROW(IL1:IL2,L)=0.
            ACSSROW(IL1:IL2,L)=0.
            ACMDROW(IL1:IL2,L)=0.
            NTROW  (IL1:IL2,L)=0.
            N20ROW (IL1:IL2,L)=0.
            N50ROW (IL1:IL2,L)=0.
            N100ROW(IL1:IL2,L)=0.
            N200ROW(IL1:IL2,L)=0.
            WTROW  (IL1:IL2,L)=0.
            W20ROW (IL1:IL2,L)=0.
            W50ROW (IL1:IL2,L)=0.
            W100ROW(IL1:IL2,L)=0.
            W200ROW(IL1:IL2,L)=0.
            CCNROW (IL1:IL2,L)=0.
            CCNEROW(IL1:IL2,L)=0.
            CC02ROW(IL1:IL2,L)=0.
            CC04ROW(IL1:IL2,L)=0.
            CC08ROW(IL1:IL2,L)=0.
            CC16ROW(IL1:IL2,L)=0.
            RCRIROW(IL1:IL2,L)=0.
            SUPSROW(IL1:IL2,L)=0.
            HENRROW(IL1:IL2,L)=0.
            O3FROW (IL1:IL2,L)=0.
            H2O2FROW(IL1:IL2,L)=0.
            WPARROW(IL1:IL2,L)=0.
          ENDDO
        ENDIF
      ENDIF
      IF ( KXTRA2 ) THEN
!
!       * CHECK IF SUFFICIENT NUMBER OF OUTPUT FIELDS AVAILABLE FOR
!       * PLA DIAGNOSTIC OUTPUT FIELDS.
!
        CORNROW(IL1:IL2,MSGP1A:ILEV)=CORNROW(IL1:IL2,MSGP1A:ILEV) &
                                   +CORN*SAVERAD
        CORMROW(IL1:IL2,MSGP1A:ILEV)=CORMROW(IL1:IL2,MSGP1A:ILEV) &
                                   +CORM*SAVERAD
        RSN1ROW(IL1:IL2,MSGP1A:ILEV)=RSN1ROW(IL1:IL2,MSGP1A:ILEV) &
                                   +RSN1*SAVERAD
        RSM1ROW(IL1:IL2,MSGP1A:ILEV)=RSM1ROW(IL1:IL2,MSGP1A:ILEV) &
                                   +RSM1*SAVERAD
        RSN2ROW(IL1:IL2,MSGP1A:ILEV)=RSN2ROW(IL1:IL2,MSGP1A:ILEV) &
                                   +RSN2*SAVERAD
        RSM2ROW(IL1:IL2,MSGP1A:ILEV)=RSM2ROW(IL1:IL2,MSGP1A:ILEV) &
                                   +RSM2*SAVERAD
        VRN1ROW(IL1:IL2)=VRN1ROW(IL1:IL2)+VRN1*SAVERAD
        VRM1ROW(IL1:IL2)=VRM1ROW(IL1:IL2)+VRM1*SAVERAD
        VRN2ROW(IL1:IL2)=VRN2ROW(IL1:IL2)+VRN2*SAVERAD
        VRM2ROW(IL1:IL2)=VRM2ROW(IL1:IL2)+VRM2*SAVERAD
        IF ( .NOT.KAVGS ) THEN
          RSN3ROW(IL1:IL2,MSGP1A:ILEV)=RSN3ROW(IL1:IL2,MSGP1A:ILEV) &
                                     +RSN3*SAVERAD
          RSM3ROW(IL1:IL2,MSGP1A:ILEV)=RSM3ROW(IL1:IL2,MSGP1A:ILEV) &
                                     +RSM3*SAVERAD
          VRN3ROW(IL1:IL2)=VRN3ROW(IL1:IL2)+VRN3*SAVERAD
          VRM3ROW(IL1:IL2)=VRM3ROW(IL1:IL2)+VRM3*SAVERAD
        ENDIF
        DEFXROW(IL1:IL2,:)=DEFXROW(IL1:IL2,:)+DEFX(:,:)*SAVERAD
        DEFNROW(IL1:IL2,:)=DEFNROW(IL1:IL2,:)+DEFN(:,:)*SAVERAD
        DMACROW(IL1:IL2,:)=DMACROW(IL1:IL2,:) &
                                    +DMAC(:,:)*SAVERAD
        DMCOROW(IL1:IL2,:)=DMCOROW(IL1:IL2,:) &
                                    +DMCO(:,:)*SAVERAD
        DNACROW(IL1:IL2,:)=DNACROW(IL1:IL2,:) &
                                    +DNAC(:,:)*SAVERAD
        DNCOROW(IL1:IL2,:)=DNCOROW(IL1:IL2,:) &
                                    +DNCO(:,:)*SAVERAD
!
!       * THE SAME FIELDS AS IN THE PREVIOUS SECTION BUT FOR THE
!       * REGION THAT IS OUTSIDE OF THE PAM DOMAIN.
!
        IF ( LEVA < ILEV ) THEN
          DO L=1,MSGP1A-1
            CORNROW(IL1:IL2,L)=0.
            CORMROW(IL1:IL2,L)=0.
            RSN1ROW(IL1:IL2,L)=0.
            RSM1ROW(IL1:IL2,L)=0.
            RSN2ROW(IL1:IL2,L)=0.
            RSM2ROW(IL1:IL2,L)=0.
            IF ( .NOT.KAVGS ) THEN
              RSN3ROW(IL1:IL2,L)=0.
              RSM3ROW(IL1:IL2,L)=0.
            ENDIF
          ENDDO
        ENDIF
      ENDIF
!
!-----------------------------------------------------------------------
!     * DEALLOCATE MEMORY FOR TRACER ARRAYS.
!
      DEALLOCATE(TRAC )
      DEALLOCATE(TRRAT)
!
!     * DEALLOCATE MEMORY FOR OTHER INPUT/OUTPUT ARRAYS.
!
      DEALLOCATE(ZHA    )
      DEALLOCATE(ZFA    )
      DEALLOCATE(PHA    )
      DEALLOCATE(PFA    )
      DEALLOCATE(DPA    )
      DEALLOCATE(TA     )
      DEALLOCATE(RVA    )
      DEALLOCATE(QTNA   )
      DEALLOCATE(HMNA   )
      DEALLOCATE(RHA    )
      DEALLOCATE(RHTA   )
      DEALLOCATE(WCTA   )
      DEALLOCATE(SPMREP )
      DEALLOCATE(SZMLWC )
      DEALLOCATE(SPFSNOW)
      DEALLOCATE(SPFRAIN)
      DEALLOCATE(SZCLF  )
      DEALLOCATE(SCLRFR )
      DEALLOCATE(SCLRFS )
      DEALLOCATE(SPFEVAP)
      DEALLOCATE(SPFSUBL)
      DEALLOCATE(SGPR   )
      DEALLOCATE(SOAP   )
      DEALLOCATE(DOCEM1S)
      DEALLOCATE(DOCEM2S)
      DEALLOCATE(DOCEM3S)
      DEALLOCATE(DOCEM4S)
      DEALLOCATE(DBCEM1S)
      DEALLOCATE(DBCEM2S)
      DEALLOCATE(DBCEM3S)
      DEALLOCATE(DBCEM4S)
      DEALLOCATE(DSUEM1S)
      DEALLOCATE(DSUEM2S)
      DEALLOCATE(DSUEM3S)
      DEALLOCATE(DSUEM4S)
      DEALLOCATE(XO3    )
      DEALLOCATE(XNA    )
      DEALLOCATE(XAM    )
      DEALLOCATE(XNH3   )
      DEALLOCATE(FCANA  )
      DEALLOCATE(ATAUS  )
      DEALLOCATE(SMFRDU )
      DEALLOCATE(FCSA   )
      DEALLOCATE(FGSA   )
      DEALLOCATE(FCA    )
      DEALLOCATE(FGA    )
      DEALLOCATE(ZSPDDD )
      DEALLOCATE(ZSPDSS )
      DEALLOCATE(ZSPDDU )
      DEALLOCATE(CDMLA  )
      DEALLOCATE(CDMNLA )
      DEALLOCATE(USTARD )
      DEALLOCATE(PBLTS  )
      DEALLOCATE(FLNDDU )
      DEALLOCATE(FOCNDU )
      DEALLOCATE(SICNDU )
      DEALLOCATE(GTRDU  )
      DEALLOCATE(FNDU   )
      DEALLOCATE(ZFSA   )
      DEALLOCATE(PFSA   )
!
      DEALLOCATE(SPOT   )
      DEALLOCATE(ST02   )
      DEALLOCATE(ST03   )
      DEALLOCATE(ST04   )
      DEALLOCATE(ST06   )
      DEALLOCATE(ST13   )
      DEALLOCATE(ST14   )
      DEALLOCATE(ST15   )
      DEALLOCATE(ST16   )
      DEALLOCATE(ST17   )
      DEALLOCATE(SUZ0   )
      DEALLOCATE(SLAI   )
!
      DEALLOCATE(OEDNIO)
      DEALLOCATE(OERCIO)
      DEALLOCATE(OIDNIO)
      DEALLOCATE(OIRCIO)
      DEALLOCATE(SVVBIO)
      DEALLOCATE(PSVVIO)
      DEALLOCATE(SVMBIO)
      DEALLOCATE(SVCBIO)
      DEALLOCATE(PNVBIO)
      DEALLOCATE(PNMBIO)
      DEALLOCATE(PNCBIO)
      DEALLOCATE(PSVBIO)
      DEALLOCATE(PSMBIO)
      DEALLOCATE(PSCBIO)
      DEALLOCATE(QNVBIO)
      DEALLOCATE(QNMBIO)
      DEALLOCATE(QNCBIO)
      DEALLOCATE(QSVBIO)
      DEALLOCATE(QSMBIO)
      DEALLOCATE(QSCBIO)
      DEALLOCATE(QGVBIO)
      DEALLOCATE(QGMBIO)
      DEALLOCATE(QGCBIO)
      DEALLOCATE(QDVBIO)
      DEALLOCATE(QDMBIO)
      DEALLOCATE(QDCBIO)
      DEALLOCATE(ONVBIO)
      DEALLOCATE(ONMBIO)
      DEALLOCATE(ONCBIO)
      DEALLOCATE(OSVBIO)
      DEALLOCATE(OSMBIO)
      DEALLOCATE(OSCBIO)
      DEALLOCATE(OGVBIO)
      DEALLOCATE(OGMBIO)
      DEALLOCATE(OGCBIO)
      DEALLOCATE(DEVBIO)
      DEALLOCATE(PDEVIO)
      DEALLOCATE(DEMBIO)
      DEALLOCATE(DECBIO)
      DEALLOCATE(DIVBIO)
      DEALLOCATE(PDIVIO)
      DEALLOCATE(DIMBIO)
      DEALLOCATE(DICBIO)
      DEALLOCATE(REVBIO)
      DEALLOCATE(PREVIO)
      DEALLOCATE(REMBIO)
      DEALLOCATE(RECBIO)
      DEALLOCATE(RIVBIO)
      DEALLOCATE(PRIVIO)
      DEALLOCATE(RIMBIO)
      DEALLOCATE(RICBIO)
      DEALLOCATE(CDNC)
      DEALLOCATE(BCIC)
!
      DEALLOCATE(CORN)
      DEALLOCATE(CORM)
      DEALLOCATE(RSN1)
      DEALLOCATE(RSM1)
      DEALLOCATE(RSN2)
      DEALLOCATE(RSM2)
      DEALLOCATE(RSN3)
      DEALLOCATE(RSM3)
      DEALLOCATE(SNCN)
      DEALLOCATE(SSUN)
      DEALLOCATE(SCND)
      DEALLOCATE(SGSP)
      DEALLOCATE(ACAS)
      DEALLOCATE(ACOA)
      DEALLOCATE(ACBC)
      DEALLOCATE(ACSS)
      DEALLOCATE(ACMD)
      DEALLOCATE(CNT)
      DEALLOCATE(CN20)
      DEALLOCATE(CN50)
      DEALLOCATE(CN100)
      DEALLOCATE(CN200)
      DEALLOCATE(CNTW)
      DEALLOCATE(CN20W)
      DEALLOCATE(CN50W)
      DEALLOCATE(CN100W)
      DEALLOCATE(CN200W)
      DEALLOCATE(CCN )
      DEALLOCATE(CCNE)
      DEALLOCATE(CC02)
      DEALLOCATE(CC04)
      DEALLOCATE(CC08)
      DEALLOCATE(CC16)
      DEALLOCATE(RCRI)
      DEALLOCATE(SUPS)
      DEALLOCATE(HENR)
      DEALLOCATE(O3FRC)
      DEALLOCATE(H2O2FRC)
      DEALLOCATE(VRN1)
      DEALLOCATE(VRM1)
      DEALLOCATE(VRN2)
      DEALLOCATE(VRM2)
      DEALLOCATE(VRN3)
      DEALLOCATE(VRM3)
      DEALLOCATE(VNCN)
      DEALLOCATE(VASN)
      DEALLOCATE(VCND)
      DEALLOCATE(VGSP)
      DEALLOCATE(DEFX)
      DEALLOCATE(DEFN)
      DEALLOCATE(VOAE)
      DEALLOCATE(VBCE)
      DEALLOCATE(VASE)
      DEALLOCATE(VMDE)
      DEALLOCATE(VSSE)
      DEALLOCATE(VOAW)
      DEALLOCATE(VBCW)
      DEALLOCATE(VASW)
      DEALLOCATE(VMDW)
      DEALLOCATE(VSSW)
      DEALLOCATE(VOAD)
      DEALLOCATE(VBCD)
      DEALLOCATE(VASD)
      DEALLOCATE(VMDD)
      DEALLOCATE(VSSD)
      DEALLOCATE(VOAG)
      DEALLOCATE(VBCG)
      DEALLOCATE(VASG)
      DEALLOCATE(VMDG)
      DEALLOCATE(VSSG)
      DEALLOCATE(VASI)
      DEALLOCATE(VAS1)
      DEALLOCATE(VAS2)
      DEALLOCATE(VAS3)
      DEALLOCATE(VCCN)
      DEALLOCATE(VCNE)
      DEALLOCATE(DMAC)
      DEALLOCATE(DMCO)
      DEALLOCATE(DNAC)
      DEALLOCATE(DNCO)
      DEALLOCATE(DUWD)
      DEALLOCATE(DUST)
      DEALLOCATE(DUTH)
      DEALLOCATE(FALL)
      DEALLOCATE(FA10)
      DEALLOCATE(FA2 )
      DEALLOCATE(FA1 )
      DEALLOCATE(USMK)
      DEALLOCATE(DEFA)
      DEALLOCATE(DEFC)
!
      END SUBROUTINE PAMDRIV
