        Subroutine  vX_SEC_ALL ( X, Num_lev, T, Len_t, wlt,
     *                    Num_beg, Len_X, xs, Ngas, K_T ,fln)
c       Program to compute x-sections for ALL the photolysis
c       reactions for temp. profile T(z)
c       Notation: same as in X_SEC
c       vvvv
c       Ngas  - # of the photolysis reactions

        real   T(Num_lev), wlt(Len_t), xs(Len_t, Num_lev, Ngas)
        integer   Num_beg (Ngas), Len_X (Ngas), K_T (Ngas)
        character*32  X (Ngas)
        CHARACTER *50 FLN

       DO  IR=1, Ngas
          IF ( K_T(IR) .EQ. 0 ) GOTO 70
          IF ( X(IR) .EQ. 'H2O     -->H       +OH' ) GOTO 70
          IF ( X(IR) .EQ. 'NO      -->N       +O' )  GOTO 70
          IF ( X(IR) .EQ. 'CH4     -->CH3     +H' )  GOTO 70

Cgal          call  vX_SEC ( X(IR), Num_lev, T, Len_t, wlt, Num_beg(ir),
Cgal     *                      Len_X(ir), XS(1,1,ir), K_T(ir) ,fln)

      GO TO (1,2,3,4,5,6,7,8,9,10,
     *     11,12,13,14,15,16,17,18,19,20,
     *     21,22,23,24,25,26,27,28,29,30,
     *     31,32,33,34,35,36,37,38,39,40,
     *     41,42,43,44,45,46,47,48,49,50,51 ) , IR

  1   call   vO2_X_97 ( Num_lev,Len_t,wlt,Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

  2   call   vO3d_X ( Num_lev, T, Len_t, wlt, Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

  3   call   vO3p_X ( Num_lev,T,Len_t,wlt,Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

  4   continue       ! net  H2O     -->H       +OH
                                    GO TO 70

  5   call   vHO2_X ( Num_lev,Len_t,wlt,Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

  6   call   vH2O2_X ( Num_lev,T,Len_t,wlt,Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

  7   call   vN2O_X ( Num_lev,T,Len_t,wlt,Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

  8   continue       ! net  NO      -->N       +O
                                    GO TO 70

  9   call   vNO2_X ( Num_lev,T,Len_t,wlt,Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 10   call   vNO3_NO2_X ( Num_lev, Len_t, wlt, Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 11   call   vNO3_NO_X ( Num_lev,Len_t,wlt,Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 12   call   vN2O5_X ( Num_lev,T,Len_t,wlt,Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 13   call   vHNO3_X ( Num_lev, T, Len_t,wlt,Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 14   call   vHO2NO2_OH_X ( Num_lev, Len_t, wlt, Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 15   call   vHO2NO2_HO2_X ( Num_lev, Len_t, wlt, Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 16   call   vCH2O_H_X ( Num_lev,T,Len_t,wlt,Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 17   call   vCH2O_H2_X ( Num_lev,T,Len_t,wlt,Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 18   call   vClONO2_Cl_X_97 ( Num_lev, T, Len_t, wlt, Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 19   call   vClONO2_O_X_97 ( Num_lev, T, Len_t, wlt, Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 20   call   vCH3OOH_X ( Num_lev,Len_t,wlt,Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 21   call   vHCL_X ( Num_lev,Len_t,wlt,Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 22   call   vHOCL_X ( Num_lev,Len_t,wlt,Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 23   call   vCL2_X ( Num_lev,T,Len_t,wlt,Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 24   call   vCL2O2_X ( Num_lev,Len_t,wlt,Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 25   call   vBRONO2_X_97 (Num_lev,Len_t,wlt,Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 26   call   vCH3CL_X ( Num_lev,T,Len_t,wlt,Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 27   call   vCH3CCL3_X ( Num_lev,T,Len_t,wlt,Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 28   call   vCCL4_X ( Num_lev,Len_t,wlt,Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 29   call   vF11_X ( Num_lev, T, Len_t, wlt, Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 30   call   vF12_X ( Num_lev, T, Len_t, wlt, Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 31   call   vCH3BR_X ( Num_lev, Len_t,wlt,Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 32   call   vCF3BR_X ( Num_lev,Len_t,wlt,Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 33   call   vCF2CLBR_X ( Num_lev, Len_t, wlt, Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 34   call   vHCFC22_X ( Num_lev, T, Len_t, wlt, Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 35   call   vC2CL3F3_X ( Num_lev, T, Len_t, wlt, Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 36   call   vC2CL2F4_X ( Num_lev, T, Len_t, wlt, Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 37   call   vC2CLF5_X ( Num_lev, Len_t, wlt, Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 38   call   vCLONO_X ( Num_lev, Len_t, wlt, Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 39   call   vBRO_X ( Num_lev, T, Len_t, wlt, Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 40   call   vCLO_X ( Num_lev, Len_t, wlt, Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 41   call   vOCLO_X ( Num_lev, T, Len_t, wlt, Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 42   call   vCO2_X ( Num_lev, Len_t, wlt, Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 43   call   vHOBR_X ( Num_lev, Len_t, wlt, Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 44   call   vBRCL_X ( Num_lev, T, Len_t, wlt, Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 45   continue       ! net  CH4     -->CH3     +H
                                    GO TO 70

 46   call   vC2H3FCL2_X ( Num_lev, Len_t, wlt, Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 47   call   vOCS_X ( Num_lev, T, Len_t, wlt, Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 48   call   vSO2_X ( Num_lev, Len_t, wlt, Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70


 49   continue       ! net  H2SO4   -->SO2     +H2O2
                                    GO TO 70

 50   call   vSO3_X ( Num_lev, Len_t, wlt, Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 51   call   vCS2_X ( Num_lev, Len_t, wlt, Num_beg(ir),
     *                              Len_X(ir), xs(1,1,ir), K_T(ir) )
                                    GO TO 70

 70     continue

        enddo     ! ir closed

        end

c ====================================================================
        Subroutine  vX_SEC ( X, Num_lev, T, Len_t, wlt, Num_beg,
     *                      Len_X, xs, K_T ,fln)
c       Program to compute x-sections of gas X for temp. profile T(z)

c ====================================================================
c    Where...
c      Input parameters:
c       X       - name of the gas
c       Num_lev - number of atmospheric levels
c       T       - temperature profile
c       Len_t   - number of spec. gridpoints
c       wlt     - model spectral grid, including SRB
c ==============================================================
c       Num_beg - number of the lower photolysis threshold of X
c       Len_X   - length of the photolysis interval of X
c       xs      - effective x-sections (X-sect. x quantum yield)
c ================================================================
c
        real   T(Num_lev), wlt(Len_t), xs(Len_t, Num_lev)
c
        character*32 X
        CHARACTER *50 FLN

Cgal        open ( 10, file = fln, status='old',ERR=110)
Cgal        GOTO 115
Cgal 110    WRITE(*,*) 'File NOT opened: ',FLN
Cgal 115    CONTINUE

        if ( X .eq. 'O2      -->O       +O' ) then
          call   vO2_X_97 ( Num_lev,Len_t,wlt,Num_beg, Len_X, xs, K_T )

        else if ( X .eq. 'O3tot' ) then
          call   vO3tot_X ( Num_lev, T, Len_t, wlt, Num_beg, Len_X, xs,
     *            K_T )
        else if ( X. eq. 'O3      -->O2      +O(1D)' ) then
          call   vO3d_X ( Num_lev, T, Len_t, wlt, Num_beg, Len_X, xs,
     *        K_T )
        else if ( X. eq. 'O3      -->O2      +O' ) then
          call   vO3p_X ( Num_lev,T,Len_t,wlt,Num_beg,Len_X, xs, K_T )
        else if ( X. eq. 'NO2     -->NO      +O' ) then
          call   vNO2_X ( Num_lev,T,Len_t,wlt,Num_beg,Len_X,xs,K_T )
        else if ( X. eq. 'CLONO2  -->CL      +NO3' ) then
          call  vClONO2_Cl_X_97 ( Num_lev, T, Len_t, wlt, Num_beg,
     *                Len_X, xs, K_T )
        else if ( X. eq. 'CLONO2  -->O       +CLONO' ) then
          call  vClONO2_O_X_97 ( Num_lev, T, Len_t, wlt, Num_beg,
     *                Len_X, xs, K_T )
        else if ( X. eq. 'HNO3    -->OH      +NO2' ) then
          call   vHNO3_X ( Num_lev, T, Len_t,wlt,Num_beg,Len_X,xs,K_T )
        else if ( X. eq. 'N2O5    -->NO2     +NO3' ) then
          call   vN2O5_X ( Num_lev,T,Len_t,wlt,Num_beg,Len_X,xs, K_T )
        else if ( X. eq. 'N2O     -->N2      +O' ) then
          call   vN2O_X ( Num_lev,T,Len_t,wlt,Num_beg,Len_X,xs,K_T )
        else if ( X. eq. 'NO3     -->NO      +O2' ) then
          call   vNO3_NO_X ( Num_lev,Len_t,wlt,Num_beg,Len_X,xs,K_T )
C  ,T NOT USED GM 1/00
        else if ( X. eq. 'NO3     -->NO2     +O' ) then
          call   vNO3_NO2_X ( Num_lev, Len_t, wlt, Num_beg,
     *            Len_X, xs, K_T )
C  ,T NOT USED GM 1/00
        else if ( X. eq. 'HO2     -->O       +OH' ) then
          call  vHO2_X ( Num_lev,Len_t,wlt,Num_beg,Len_X,xs,K_T )
C  ,T NOT USED GM 1/00
        else if ( X. eq. 'H2O2    -->OH      +OH' ) then
          call  vH2O2_X ( Num_lev,T,Len_t,wlt,Num_beg,Len_X,xs,K_T )
        else if ( X. eq. 'HO2NO2  -->HO2     +NO2' ) then
          call  vHO2NO2_HO2_X ( Num_lev, Len_t, wlt, Num_beg,
     *                Len_X, xs, K_T )
C  ,T NOT USED GM 1/00
        else if ( X. eq. 'HO2NO2  -->OH      +NO3' ) then
          call  vHO2NO2_OH_X ( Num_lev, Len_t, wlt, Num_beg,
     *                Len_X, xs, K_T )
C  ,T NOT USED GM 1/00
        else if ( X. eq. 'H2CO    -->HCO     +H' ) then
          call  vCH2O_H_X ( Num_lev,T,Len_t,wlt,Num_beg,Len_X,xs,K_T )
        else if ( X. eq. 'H2CO    -->H2      +CO' ) then
          call  vCH2O_H2_X ( Num_lev,T,Len_t,wlt,Num_beg,Len_X,xs,K_T )
        else if ( X. eq. 'CH3OOH  -->OH      +CH3O' ) then
          call  vCH3OOH_X ( Num_lev,Len_t,wlt,Num_beg,Len_X,xs,K_T )
C  ,T NOT USED GM 1/00
        else if ( X. eq. 'HCL     -->H       +CL' ) then
          call  vHCL_X ( Num_lev,Len_t,wlt,Num_beg,Len_X,xs,K_T )
C  ,T NOT USED GM 1/00
        else if ( X. eq. 'HOCL    -->OH      +CL' ) then
          call  vHOCL_X ( Num_lev,Len_t,wlt,Num_beg,Len_X,xs,K_T )
C  ,T NOT USED GM 1/00
        else if ( X. eq. 'CL2     -->CL      +CL' ) then
          call  vCL2_X ( Num_lev,T,Len_t,wlt,Num_beg,Len_X,xs,K_T )
        else if ( X. eq. 'CL2O2   -->CL      +CLOO' ) then
          call  vCL2O2_X ( Num_lev,Len_t,wlt,Num_beg,Len_X,xs,K_T )
C  ,T NOT USED GM 1/00
        else if ( X. eq. 'BRONO2  -->BR      +NO3' ) then
          call  vBRONO2_X_97 (Num_lev,Len_t,wlt,Num_beg,Len_X,xs,K_T)
C 'T' not used GM 1/00
        else if ( X. eq. 'CH3CL   -->CH3O2   +CL' ) then
          call  vCH3CL_X ( Num_lev,T,Len_t,wlt,Num_beg,Len_X,xs,K_T )
        else if ( X. eq. 'CH3CCL3 -->CL      +CL' ) then
        call  vCH3CCL3_X ( Num_lev,T,Len_t,wlt,Num_beg, Len_X, xs,K_T )

        else if ( X. eq. 'CCL4    -->CL      +CL' ) then
          call  vCCL4_X ( Num_lev,Len_t,wlt,Num_beg,Len_X, xs, K_T)
C 'T' not used GM 1/00
        else if ( X. eq. 'CFCL3   -->CL      +CL' ) then
        call   vF11_X ( Num_lev, T, Len_t, wlt, Num_beg,Len_X, xs,K_T )
        else if ( X. eq. 'CF2CL2  -->CL      +CL' ) then
        call   vF12_X ( Num_lev, T, Len_t, wlt, Num_beg,Len_X,xs,K_T )
        else if ( X. eq. 'CH3BR   -->CH3     +BR' ) then
          call   vCH3BR_X ( Num_lev, Len_t,wlt,Num_beg,Len_X,xs,K_T )
C 'T' not used GM 1/00
        else if ( X. eq. 'CF3BR   -->BR      +F' ) then
          call   vCF3BR_X ( Num_lev,Len_t,wlt,Num_beg,Len_X, xs, K_T )
C 'T' not used GM 1/00
        else if ( X. eq. 'CF2CLBR -->BR      +CL' ) then
          call   vCF2CLBR_X ( Num_lev, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )
C 'T' not used GM 1/00
        else if ( X. eq. 'CHCLF2  -->CL      +F' ) then
          call   vHCFC22_X ( Num_lev, T, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )
        else if ( X. eq. 'C2CL3F3 -->CL      +CL' ) then
          call   vC2CL3F3_X ( Num_lev, T, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )
        else if ( X. eq. 'C2CL2F4 -->CL      +CL' ) then
          call   vC2CL2F4_X ( Num_lev, T, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )
        else if ( X. eq. 'C2CLF5  -->CL      +F' ) then
          call   vC2CLF5_X ( Num_lev, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )
C 'T' not used GM 1/00
        else if ( X. eq. 'CLONO   -->CLO     +NO' ) then
          call   vCLONO_X ( Num_lev, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )
C 'T' not used GM 1/00
        else if ( X. eq. 'CHBR3   -->BR      +BR' ) then
          call   vCHBR3_X ( Num_lev, T, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )
        else if ( X. eq. 'CCL2O   -->CL      +CL' ) then
          call   vCCL2O_X ( Num_lev, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )
C 'T' not used GM 1/00
        else if ( X. eq. 'BRO     -->BR      +O' ) then
          call   vBRO_X ( Num_lev, T, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )
        else if ( X. eq. 'CLO     -->CL      +O' ) then
          call   vCLO_X ( Num_lev, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )
C 'T' not used GM 1/00
        else if ( X. eq. 'OCLO    -->O       +CLO' ) then
          call   vOCLO_X ( Num_lev, T, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )
        else if ( X. eq. 'CO2     -->CO      +O' ) then
          call   vCO2_X ( Num_lev, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )
C 'T' not used GM 1/00
        else if ( X. eq. 'HOBR    -->OH      +BR' ) then
          call   vHOBR_X ( Num_lev, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )
C 'T' not used GM 1/00
        else if ( X. eq. 'BRCL    -->BR      +CL' ) then
          call   vBRCL_X ( Num_lev, T, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )
        else if ( X. eq. 'C2H3FCL2-->CL      +CL' ) then
          call   vC2H3FCL2_X ( Num_lev, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )
C 'T' not used GM 1/00
        else if ( X. eq. 'OCS     -->CO      +S ' ) then
          call   vOCS_X ( Num_lev, T, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )
        else if ( X. eq. 'SO2     -->SO      +O ' ) then
          call   vSO2_X ( Num_lev, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )
C 'T' not used GM 1/00
        else if ( X. eq. 'SO3     -->SO2     +O ' ) then
          call   vSO3_X ( Num_lev, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )
C 'T' not used GM 1/00
        else if ( X. eq. 'CS2     -->S       +CS' ) then
          call   vCS2_X ( Num_lev, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )
C 'T' not used GM 1/00
        endif
Cgal        close (10)

        end
c ===================================================================

      Subroutine vO2_X_97(Num_lev, Len_t,wlt,Num_beg,Len_X,xs,K_T)
c
c       Notation: same as in  X_SEC
c
        include 'jpl.par'

        Parameter  ( Len_jpl = 32 )

        real  x_jpl (Len_jpl), wlt_jpl (Len_jpl), xs (Len_t, Num_lev),
     *	      wlt (Len_t)

        character*8  AA

Cgal
      COMMON / XSEC_01 / wlt_jpl_1 (Len_jpl), x_jpl_1 (Len_jpl)
Cgal

c       Temperature dependance: yes - K_T = 1, no - K_T = 0
        K_T = 0

        do l = 1, Len_t
           do i = 1, Num_lev
              xs(l,i) = 0.
           enddo
        enddo

Cgal        do while ( AA .ne. 'O2 from' )
Cgal         read (10,2) AA
Cgal        end do

Cgal 2      format (2x,A8)
Cgal        read (10,2) AA
Cgal      DO 1 I=1,Len_jpl
Cgal        read (10, 100 )  wlt_jpl(i), x_jpl(i)
Cgal  1     continue
Cgal 100    format ( 4X, f8.2, e10.2 )

Cgal
      do i=1,Len_jpl
        wlt_jpl(i) = wlt_jpl_1(i)
          x_jpl(i) = x_jpl_1(i)
      end do
Cgal

c        Now,  find Num_beg and Len_X ...

        call  find_NL ( Len_t, wlt, Len_jpl, wlt_jpl, Num_beg, Len_X )

c        ...and interpolate O2 x-sections to model wlt grid:

        call  linoext ( Len_jpl, Len_X, wlt_jpl, wlt(Num_beg), x_jpl,
     *     xs(Num_beg, 1) )

ccc        print 5, ( wlt(i), xs(i,1), i=1, Len_t )
  5     format ( 2x, 0pf5.0, 1pe12.3 )
        do i = 2, Num_lev
           do l = Num_beg, Num_beg+Len_X-1
              xs(l,i) = xs(l,1)
           enddo
         enddo

         end

c ===================================================================

        Subroutine  vO2_X ( Num_lev, Len_t,wlt,Num_beg,Len_X,xs,K_T )
c
c       Notation: same as in  X_SEC
c
        include 'jpl.par'

        Parameter  ( Len_jpl = 36,  Nd = Len_jpl/2 )

        real  x_jpl (Len_jpl), wlt_jpl (Len_jpl), xs (Len_t, Num_lev),
     *        wlt (Len_t)

        character*8  AA

Cgal
      COMMON / XSEC_02 / wlt_jpl_2 (Len_jpl), x_jpl_2 (Len_jpl)
Cgal

c       Temperature dependance: yes - K_T = 1, no - K_T = 0
        K_T = 0

        do l = 1, Len_t
           do i = 1, Num_lev
              xs(l,i) = 0.
           enddo
        enddo

Cgal        do while ( AA .ne. 'O2' )
Cgal           read (10,2) AA
Cgal        end do
Cgal
Cgal 2      format (2x,A8)
Cgal        read (10,2) AA
Cgal
Cgal        read ( 10, * ) ( wlt_jpl(i), x_jpl(i), wlt_jpl(i+Nd),
Cgal     *                   x_jpl(i+Nd), i = 1, Nd )
Cgal 1      format ( 2( 2x, f10.0, 2x, f10.2, 2x ) )

Cgal
      do i=1,Len_jpl
        wlt_jpl(i) =  wlt_jpl_2(i)
          x_jpl(i) =    x_jpl_2(i)
      end do
Cgal

c        Now,  find Num_beg and Len_X ...

        call  find_NL ( Len_t, wlt, Len_jpl, wlt_jpl, Num_beg, Len_X )

c  ####    just for now, to make O2 spectrum start from wlt=200nm:

        dn = Num_beg-NSRB
        Num_beg = NSRB+1
        Len_X = Len_X+dn

c        ...and interpolate O2 x-sections to model wlt grid:

        call  linterp ( Len_jpl, Len_X, wlt_jpl, wlt(Num_beg), x_jpl,
     *                    xs(Num_beg, 1) )

        do l = Num_beg, Num_beg+Len_X
           xs(l,1) = xs(l,1)*1.E-24
        enddo

  5     format ( 2x, 0pf5.0, 1pe12.3 )
        do i = 2, Num_lev
           do l = Num_beg, Num_beg+Len_X-1
              xs(l,i) = xs(l,1)
           enddo
         enddo

         end

c ======================================================================
        Subroutine  vO3tot_X_old(Num_lev,T,Len_t,wlt,Num_beg,Len_X,
     *                    xs, K_T )
c
c       Notation: same as in  X_SEC
c
        Parameter  ( Len_jpl = 69, NT = 2 )
        include 'jpl.par'

        real  x_jpl (Len_jpl,NT), wb_jpl (Len_jpl), we_jpl (Len_jpl),
     *        wm_jpl (Len_jpl),
     *        xs (Len_t, Num_lev), wlt (Len_t), T (Num_lev), T_jpl(NT),
     *        xs_Tjpl (Len_tm, NT), xsm (NT), xsT (1)

        character*8  AA

Cgal
      COMMON / XSEC_03 / wb_jpl_3 (Len_jpl), we_jpl_3 (Len_jpl),
     *                          x_jpl_3 (Len_jpl,NT)
Cgal

c       Temperature dependance: yes - K_T = 1, no - K_T = 0
        K_T = 1

        T_jpl(1) = 203.
        T_jpl(2) = 273.

        do l = 1, Len_t
           do i = 1, Num_lev
              xs(l,i) = 0.
           enddo
        enddo

Cgal        do while ( AA .ne. 'O3' )
Cgal           read (10,2) AA
Cgal        end do
Cgal
Cgal 2      format (2x,A8)
Cgal        read (10,2) AA
Cgal
Cgal        read ( 10, * ) ( wb_jpl(i), we_jpl(i), x_jpl(i,1), x_jpl(i,2),
Cgal     *                   i = 1, Len_jpl )
Cgal
Cgal 1      format ( 2x, 0p2f9.3, 1p2e10.2 )

Cgal
      do i=1,Len_jpl
        wb_jpl(i) =  wb_jpl_3(i)
        we_jpl(i) =  we_jpl_3(i)
         x_jpl(i,1) = x_jpl_3(i,1)
         x_jpl(i,2) = x_jpl_3(i,2)
      end do
Cgal

         do l = 1, Len_jpl
            wm_jpl(l) = 0.5*( wb_jpl(l) + we_jpl(l) )
         enddo

c        Now,  find Num_beg and Len_X ...

c  ###  May be, wb_jpl should be used for Num_beg, and
c       we_jpl or wm_jpl for Len_X. Check later

        call  find_NL ( Len_t, wlt, Len_jpl, wb_jpl, Num_beg, Len_X )

c        ...and interpolate O3 x-sections to model wlt grid:

        do it = 1, NT
          call  linterp ( Len_jpl, Len_X, wm_jpl, wlt(Num_beg),
     *                    x_jpl(1,it), xs_Tjpl(Num_beg, it) )
        enddo

c   ... and to each temperature:

        do l = Num_beg, Num_beg+Len_X-1
            do it = 1, NT
               xsm(it) = xs_Tjpl(l,it)
            enddo
            do i = 1, Num_lev
              call linoext ( NT, 1, T_jpl, T(i), xsm, xsT )
              if ( xsT(1) .gt. 0.) then
                    xs (l,i) = xsT (1)
              else
                    xs (l,i) = 0.
              endif
            enddo
        enddo

 20     format ( 2x, 0pf4.0, 1p4e10.2 )
        end

c ==========================================================================
        Subroutine  vO3tot_X ( Num_lev, T, Len_t, wlt, Num_beg, Len_X,
     *                    xs, K_T )
c
c       Notation: same as in  X_SEC
c
        Parameter  ( Len_p = 77, NT = 3 )
        include 'jpl.par'

        real  x_jpl (Len_p,NT), wb_jpl (Len_p), we_jpl (Len_p),
     *        wm_jpl (Len_p),
     *        xs (Len_t, Num_lev), wlt (Len_t), T (Num_lev), T_jpl(NT),
     *        xs_Tjpl (Len_tm, NT), xsm (NT), xsT (1)

        character*8  AA

Cgal
      COMMON / XSEC_04 / wb_jpl_4 (Len_p), we_jpl_4 (Len_p),
     *                    x_jpl_4 (Len_p,NT)
Cgal

c       Temperature dependance: yes - K_T = 1, no - K_T = 0
        K_T = 1

        T_jpl (1) = 210.8
        T_jpl (2) = 231.
        T_jpl (3) = 255.6

        do l = 1, Len_t
           do i = 1, Num_lev
              xs(l,i) = 0.
           enddo
        enddo

Cgal        do while ( AA .ne. 'O3' )
Cgal           read (10,2) AA
Cgal        end do
Cgal
Cgal 2      format (2x,A8)
Cgal        read (10,2) AA
Cgal
Cgal        read ( 10, * ) ( wb_jpl(i), we_jpl(i), (x_jpl(i,k), k=1,3),
Cgal     *                   i = 1, Len_p )
Cgal
Cgal 1      format ( 2x, 0p2f7.2, 1p3e10.2 )

Cgal
      do i=1,Len_p
        wb_jpl(i) =  wb_jpl_4(i)
        we_jpl(i) =  we_jpl_4(i)
         x_jpl(i,1) = x_jpl_4(i,1)
         x_jpl(i,2) = x_jpl_4(i,2)
         x_jpl(i,3) = x_jpl_4(i,3)
      end do
Cgal

         do l = 1, Len_p
            wm_jpl(l) = 0.5*( wb_jpl(l) + we_jpl(l) )
         enddo

c        Now,  find Num_beg and Len_X ...

         Num_beg=1
         Len_X = Len_t

c        ...and interpolate O3 x-sections to model wlt grid:

        do it = 1, NT
          call  linterp ( Len_p, Len_X, wm_jpl, wlt(Num_beg),
     *                    x_jpl(1,it), xs_Tjpl(Num_beg, it) )
        enddo

c   ... and to each temperature:

        do l = Num_beg, Num_beg+Len_X-1
            do it = 1, NT
               xsm(it) = xs_Tjpl(l,it)
            enddo
            do i = 1, Num_lev
              call linoext ( NT, 1, T_jpl, T(i), xsm, xsT )
              if ( xsT(1) .gt. 0.) then
                    xs (l,i) = xsT (1)
              else
                    xs (l,i) = 0.
              endif
            enddo
        enddo

 20     format ( 2x, 0pf4.0, 1p4e10.2 )
        end

c ======================================================================
        Subroutine  vO3d_X ( Num_lev, T, Len_t, wlt, Num_beg, Len_X,
     *            xs, K_T )
c
c       Notation: same as in  X_SEC
c
        include 'jpl.par'

        real  xs (Len_t, Num_lev), wlt (Len_t), T (Num_lev),
     *            qy (Len_tm, Nlev)


c       Temperature dependance: yes - K_T = 1, no - K_T = 0
        K_T = 1

        do l = 1, Len_t
           do i = 1, Num_lev
              xs(l,i) = 0.
           enddo
        enddo

        call   vO3tot_X ( Num_lev, T, Len_t, wlt, Num_beg,Len_X,xs,K_T )
        call   vQuant_Y_O1d_97 ( Num_lev, T, Len_X, wlt(Num_beg), qy )

  14    format ( 2x, f6.2, 4f8.3 )
        do i = 1, Num_lev
           do l = Num_beg, Num_beg + Len_X - 1
              xs(l,i) = xs(l,i)*qy(l-Num_beg+1,i)
           enddo
         enddo

 15      format (2x, 0pf6.2, 1p4e10.2)
         end
c ==================================================================
        Subroutine  vO3p_X ( Num_lev, T, Len_t, wlt, Num_beg, Len_X,
     *                xs, K_T )
c
c       Notation: same as in  X_SEC
c
        include 'jpl.par'

        real  xs (Len_t, Num_lev), wlt (Len_t), T (Num_lev),
     *            qy (Len_tm, Nlev)

c       Temperature dependance: yes - K_T = 1, no - K_T = 0
        K_T = 1

        do l = 1, Len_t
           do i = 1, Num_lev
              xs(l,i) = 0.
           enddo
        enddo

        call   vO3tot_X ( Num_lev, T, Len_t, wlt,Num_beg,Len_X,xs,K_T )
        call   vQuant_Y_O1d_97 ( Num_lev, T, Len_X, wlt(Num_beg), qy )

  14    format ( 2x, f6.2, 4f8.3 )
        do i = 1, Num_lev
           do l = Num_beg, Num_beg + Len_X - 1
                   xs(l,i) = xs(l,i)*(1.-qy(l-Num_beg+1,i))
           enddo
         enddo

 15      format (2x, 0pf6.2, 1p4e10.2)
         end
c ========================================================================
       Subroutine  vQuant_Y_O1d ( Num_lev, T, Len_O3, wlt, qy )
c
c   **      O(1d) quantum yield in the photolysis of O3

c       Notation: same as in  X_SEC
c       qy - O(1d) quantum yield in the photolysis of O3

        real  qy (Len_O3, Num_lev), wlt (Len_O3), T (Num_lev)

c            define statement functions:

        a0(tau) = .94932 - 1.7039E-4*tau + 1.4072E-6*tau*tau
        a1(tau) = -2.4052E-2 + 1.0479E-3*tau - 1.0655E-5*tau*tau
        a2(tau) = 1.8771E-2 - 3.6401E-4*tau - 1.8587E-5*tau*tau
        a3(tau) = -1.454E-2 - 4.7787E-5*tau + 8.1277E-6*tau*tau
        a4(tau) = 2.3287E-3 + 1.9891E-5*tau - 1.1801E-6*tau*tau
        a5(tau) = -1.4471E-4 - 1.7188E-6*tau + 7.2661E-8*tau*tau
        a6(tau) = 3.183E-6 + 4.6209E-8*tau - 1.6266E-9*tau*tau

        F(x,tau) = a0(tau) + a1(tau)*x + a2(tau)*x*x + a3(tau)*x**3 +
     *            a4(tau)*x**4+ a5(tau)*x**5 + a6(tau)*x**6

c            now, calculate Quantum Yields:
        do i = 1, Num_lev
           do l = 1, Len_O3
              wc = wlt(l)
              if ( wc .le. 305. ) then
                 qy(l,i) = 0.95
              else if ( wc .gt. 305. .and. wc. le. 320. ) then
                 x = wc - 305.
                 tau = 298. - T(i)
                 qy(l,i) = F (x,tau)
                 if ( qy(l,i) .lt. 0.02 ) qy(l,i) = 0.
              else if ( wc. gt. 320. ) then
                 qy(l,i) = 0.
              endif
            enddo
         enddo
         end
c ===================================================================
c ========================================================================

       Subroutine  vQuant_Y_O1d_97 ( Num_lev, T, Len_O3, wlt, qy )
c
c   **      O(1d) quantum yield in the photolysis of O3

c       Notation: same as in  X_SEC
c       qy - O(1d) quantum yield in the photolysis of O3

	parameter (Ljpl=21)

        real  qy (Len_O3, Num_lev), wlt (Len_O3), T (Num_lev),
     $        qjpl(Ljpl), wjpl(Ljpl), A(Ljpl), B(Ljpl)

        character*8  AA

Cgal
      COMMON / XSEC_05 / wjpl_5 (Ljpl), A_5 (Ljpl),
     *                                  B_5 (Ljpl)
Cgal
        lun_x = 10

Cgal        do while ( AA .ne. 'O3(1D) q' )
Cgal         read (lun_x,2) AA
Cgal        end do
Cgal
Cgal 2      format (2x,A8)
Cgal        read (lun_x,2) AA
Cgal
Cgal        read (lun_x, * ) ( wjpl(i), A(i), B(i), i = 1, Ljpl )

Cgal
      do i=1,Ljpl
        wjpl(i) = wjpl_5(i)
         A(i)   =    A_5(i)
         B(i)   =    B_5(i)
      end do
Cgal


	call  find_NL ( Len_O3, wlt, Ljpl, wjpl, Num_beg, Len_X )

c       now, calculate Quantum Yields:

	do i=1, Num_lev
	   do l = 1, Ljpl
	      qjpl(l) = A(l)*exp(-B(l)/T(i))
	   enddo
              call linoext ( Ljpl, Len_X, wjpl, wlt(Num_beg), qjpl,
     $            qy(Num_beg,i) )

	   do l = Num_beg+Len_X, Len_O3
	     qy(l,i) = 0.
	   enddo

	   do l = 1, Num_beg-1
	     qy(l,i) = 0.95
	   enddo

        enddo

	return
        end

c ==============================================================

        Subroutine  vNO2_X ( Num_lev, T, Len_t, wlt, Num_beg, Len_X,
     *      xs, K_T )
c
c       Notation: same as in  X_SEC
c
        Parameter  ( L_no_T = 26, L_T = 31, L_j = L_no_T+L_T )

        include 'jpl.par'

        real  wb_j (L_j), we_j (L_j), wm_j (L_j),
     *        as_j (L_j), sig_j (L_j), sig (L_j),
     *        xs (Len_t, Num_lev), wlt (Len_t), T (Num_lev),
     *        qy (Len_tm)  ! 'x_j (L_j)' not used GM1/00

        character*8  AA

Cgal
      COMMON / XSEC_06 / wb_j_6 (L_j), we_j_6 (L_j),
     *                  sig_j_6 (L_j), as_j_6 (L_j)
Cgal

        do i = 1, L_j
           as_j(i) = 0.
        enddo

c       Temperature dependance: yes - K_T = 1, no - K_T = 0
        K_T = 1

        do l = 1, Len_t
           do i = 1, Num_lev
              xs(l,i) = 0.
           enddo
        enddo

Cgal        do while ( AA .ne. 'NO2' )
Cgal           read (10,12) AA
Cgal        end do
Cgal
Cgal 12     format (2x,A8)
Cgal        read (10,12) AA
Cgal
Cgal       read ( 10, * ) ( wb_j(i), we_j(i), sig_j(i),
Cgal     *       wb_j(i+L_no_T), we_j(i+L_no_T), sig_j(i+L_no_T),
Cgal     *       as_j(i+L_no_T),     i = 1, L_no_T )
Cgal
Cgal       read ( 10, * ) (wb_j(i), we_j(i), sig_j(i), as_j(i),
Cgal     *                   i = L_no_T*2 + 1, L_j)
Cgal
Cgal 1      format ( 2x, 3f7.2 )
Cgal 2      format ( 2x, 4f7.2 )

Cgal
      do i=1,L_j
         wb_j(i) =  wb_j_6(i)
         we_j(i) =  we_j_6(i)
        sig_j(i) = sig_j_6(i)
         as_j(i) =  as_j_6(i)
      end do
Cgal

         do l = 1, L_j
            wm_j(l) = 0.5*( wb_j(l) + we_j(l) )
            sig_j(l) = sig_j(l)*1.E-20
            as_j(l) = as_j(l)*1.E-22
         enddo

c        Now,  find Num_beg and Len_X ...

         call  find_NL ( Len_t, wlt, L_j, wm_j, Num_beg, Len_X )

c      interpolate NO2 x-sections at each T to model wlt grid:

         do i = 1, Num_lev
            tc = T(i)-273.
            do l = 1, L_j
               sig(l) = sig_j(l) + as_j(l)*tc
            enddo
            call  linterp ( L_j, Len_X, wm_j, wlt(Num_beg),
     *                    sig, xs(Num_beg,i) )

         enddo

 20     format ( 2x, 0pf7.2, 1p4e10.2 )

        call  vQuant_Y_NO2 ( Len_X, wlt(Num_beg), qy )

         do i = 1, Num_lev
            do l = 1, Len_X
               xs(Num_beg+l-1,i) = xs(Num_beg+l-1,i)*qy(l)
            enddo
         enddo

        end

c ======================================================================
       Subroutine  vQuant_Y_NO2 ( Len_NO2, wlt, qy )

       parameter  ( nq_j = 64, nq_hlf = nq_j/2 )

       real  w_j (nq_j), q_j (nq_j), qy (Len_NO2), wlt (Len_NO2)

        character*8  AA

Cgal
      COMMON / XSEC_07 / w_j_7 (nq_j), q_j_7 (nq_j)
Cgal

Cgal        do while ( AA .ne. 'NO2 phot' )
Cgal           read (10,12) AA
Cgal        end do
Cgal
Cgal 12     format (2x,A8)
Cgal        read (10,12) AA
Cgal
Cgal        read  (10,*) ( w_j(i), q_j(i), w_j(i+nq_hlf),
Cgal     *                  q_j(i+nq_hlf), i = 1, nq_hlf )

Cgal
      do i=1,nq_j
        w_j(i) = w_j_7(i)
        q_j(i) = q_j_7(i)
      end do
Cgal

        i = 1
        do while ( wlt(i) .lt. w_j(1) )
           qy(i) = 1.
           i = i+1
        enddo

        L_q_ne_1 = Len_NO2-i+1

        call  linterp ( nq_j, L_q_ne_1, w_j, wlt(i),
     *                    q_j, qy(i) )

        do l = 1, Len_NO2
           if ( qy(l) .lt. 0. ) qy(l) = 0.
        enddo

 20     format (3x, 2f9.3)

        end
c =======================================================================
c =======================================================================
      Subroutine  vClONO2_Cl_X_97 ( Num_lev, T, Len_t, wlt, Num_beg,
     *      Len_X, xs, K_T)
c
c       Notation: same as in  X_SEC
c
        Parameter  ( L_hlf = 60, L_j = L_hlf*2-1  )
        include 'jpl.par'

        real   w_j (L_j),   ! 'x_j (L_j)' not used GM1/00
     *        a1_j (L_j), a2_j (L_j), sig_j (L_j), sig (L_j),
     *        xs (Len_t, Num_lev), wlt (Len_t), T (Num_lev)

        character*8  AA

Cgal
      COMMON / XSEC_08 / w_j_8 (L_j), sig_j_8 (L_j),
     *                  a1_j_8 (L_j),  a2_j_8 (L_j)
Cgal

c       Temperature dependance: yes - K_T = 1, no - K_T = 0
        K_T = 1

        do l = 1, Len_t
           do i = 1, Num_lev
              xs(l,i) = 0.
           enddo
        enddo

Cgal        do while ( AA .ne. 'ClONO2' )
Cgal         read (10,12) AA
Cgal        end do
Cgal
Cgal 12     format (2x,A8)
Cgal        read (10,12) AA
Cgal
Cgal       read (10, * ) ( w_j(i), sig_j(i), a1_j(i), a2_j(i),
Cgal     *       w_j(i+L_hlf), sig_j(i+L_hlf), a1_j(i+L_hlf),
Cgal     *        a2_j(i+L_hlf), i = 1, L_hlf-1 )
Cgal
Cgal       read (10, * ) w_j(L_hlf), sig_j(L_hlf), a1_j(L_hlf),
Cgal     *            a2_j(L_hlf)
Cgal
Cgal 1      format ( 2x, 0pf7.2, 1p3e10.2 )

Cgal
      do i=1,L_j
         w_j(i) =    w_j_8(i)
       sig_j(i) =  sig_j_8(i)
        a1_j(i) =   a1_j_8(i)
        a2_j(i) =   a2_j_8(i)
      end do
Cgal

         do l = 1, L_j
            sig_j(l) = sig_j(l)*vqycl(w_j(l))*1.e-20
         enddo

c        Now,  find Num_beg and Len_X ...

         call  find_NL ( Len_t, wlt, L_j, w_j, Num_beg, Len_X )

c      interpolate ClONO2 x-sections at each T to model wlt grid:

         do i = 1, Num_lev
            tt = T(i)-296.
            do l = 1, L_j
               sig(l) = sig_j(l)*( 1. + a1_j(l)*tt + a2_j(l)*tt*tt )
            enddo
            call  linoext ( L_j, Len_X, w_j, wlt(Num_beg),
     *			  sig, xs(Num_beg,i) )
         enddo

 20     format ( 2x, 0pf7.2, 1p5e10.2 )

        end

c ===============================

      function vqycl (wlt)

	if ( wlt .lt. 308. ) then
         vqycl = .6
	else if ( wlt .lt. 364. ) then
         vqycl = 7.143e-3*wlt - 1.6
	else
         vqycl = 1.
	endif

	return
	end

c =======================================================================
      Subroutine  vClONO2_O_X_97 ( Num_lev, T, Len_t, wlt, Num_beg,
     *			      Len_X, xs, K_T)
c
c       Notation: same as in  X_SEC
c
        Parameter  ( L_hlf = 60, L_j = L_hlf*2-1  )
        include 'jpl.par'

        real   w_j (L_j),      !'x_j (L_j)' not used GM1/00
     *        a1_j (L_j), a2_j (L_j), sig_j (L_j), sig (L_j),
     *        xs (Len_t, Num_lev), wlt (Len_t), T (Num_lev)

        character*8  AA

Cgal
      COMMON / XSEC_09 / w_j_9 (L_j), sig_j_9 (L_j),
     *                  a1_j_9 (L_j),  a2_j_9 (L_j)
Cgal
c       Temperature dependance: yes - K_T = 1, no - K_T = 0
        K_T = 1

        do l = 1, Len_t
           do i = 1, Num_lev
              xs(l,i) = 0.
           enddo
        enddo

Cgal        do while ( AA .ne. 'ClONO2' )
Cgal         read (10,12) AA
Cgal        end do
Cgal
Cgal 12     format (2x,A8)
Cgal        read (10,12) AA
Cgal
Cgal       read (10, * ) ( w_j(i), sig_j(i), a1_j(i), a2_j(i),
Cgal     *       w_j(i+L_hlf), sig_j(i+L_hlf), a1_j(i+L_hlf),
Cgal     *        a2_j(i+L_hlf), i = 1, L_hlf-1 )
Cgal
Cgal       read (10, * ) w_j(L_hlf), sig_j(L_hlf), a1_j(L_hlf),
Cgal     *            a2_j(L_hlf)
Cgal
Cgal 1      format ( 2x, 0pf7.2, 1p3e10.2 )

Cgal
      do i=1,L_j
         w_j(i) =    w_j_9(i)
       sig_j(i) =  sig_j_9(i)
        a1_j(i) =   a1_j_9(i)
        a2_j(i) =   a2_j_9(i)
      end do
Cgal

         do l = 1, L_j
            sig_j(l) = sig_j(l)*(1.-vqycl(w_j(l)))*1.e-20
         enddo

c        Now,  find Num_beg and Len_X ...

         call  find_NL ( Len_t, wlt, L_j, w_j, Num_beg, Len_X )

c      interpolate ClONO2 x-sections at each T to model wlt grid:

         do i = 1, Num_lev
            tt = T(i)-296.
            do l = 1, L_j
               sig(l) = sig_j(l)*( 1. + a1_j(l)*tt + a2_j(l)*tt*tt )
            enddo
            call  linoext ( L_j, Len_X, w_j, wlt(Num_beg),
     *			  sig, xs(Num_beg,i) )
         enddo

 20     format ( 2x, 0pf7.2, 1p5e10.2 )

        end

c =======================================================================
        Subroutine  vClONO2_Cl_X ( Num_lev, T, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )
c
c       Notation: same as in  X_SEC
c
        Parameter  ( L_hlf = 60, L_j = L_hlf*2-1  )
        include 'jpl.par'

        real   w_j (L_j),      !'x_j (L_j)' not used GM1/00
     *        a1_j (L_j), a2_j (L_j), sig_j (L_j), sig (L_j),
     *        xs (Len_t, Num_lev), wlt (Len_t), T (Num_lev)

        character*8  AA

Cgal
      COMMON / XSEC_10 / w_j_10 (L_j), sig_j_10 (L_j),
     *                  a1_j_10 (L_j),  a2_j_10 (L_j)
Cgal

c       Temperature dependance: yes - K_T = 1, no - K_T = 0
        K_T = 1

        do l = 1, Len_t
           do i = 1, Num_lev
              xs(l,i) = 0.
           enddo
        enddo

Cgal        do while ( AA .ne. 'ClONO2' )
Cgal           read (10,12) AA
Cgal        end do
Cgal
Cgal 12     format (2x,A8)
Cgal        read (10,12) AA
Cgal
Cgal       read ( 10, * ) ( w_j(i), sig_j(i), a1_j(i), a2_j(i),
Cgal     *       w_j(i+L_hlf), sig_j(i+L_hlf), a1_j(i+L_hlf),
Cgal     *       a2_j(i+L_hlf), i = 1, L_hlf-1 )
Cgal
Cgal       read ( 10, * ) w_j(L_hlf), sig_j(L_hlf), a1_j(L_hlf),
Cgal     *                a2_j(L_hlf)
Cgal
Cgal 1      format ( 2x, 0pf7.2, 1p3e10.2 )

Cgal
      do i=1,L_j
         w_j(i) =    w_j_10(i)
       sig_j(i) =  sig_j_10(i)
        a1_j(i) =   a1_j_10(i)
        a2_j(i) =   a2_j_10(i)
      end do
Cgal

         do l = 1, L_j
            sig_j(l) = sig_j(l)*.9E-20
         enddo

c        Now,  find Num_beg and Len_X ...

         call  find_NL ( Len_t, wlt, L_j, w_j, Num_beg, Len_X )

c      interpolate ClONO2 x-sections at each T to model wlt grid:

         do i = 1, Num_lev
            tt = T(i)-296.
            do l = 1, L_j
               sig(l) = sig_j(l)*( 1. + a1_j(l)*tt + a2_j(l)*tt*tt )
            enddo
            call  linterp ( L_j, Len_X, w_j, wlt(Num_beg),
     *                    sig, xs(Num_beg,i) )
         enddo

 20     format ( 2x, 0pf7.2, 1p4e10.2 )

        end

c =======================================================================
        Subroutine  vClONO2_O_X ( Num_lev, T, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )
c
c       Notation: same as in  X_SEC
c
        Parameter  ( L_hlf = 60, L_j = L_hlf*2-1  )
        include 'jpl.par'

        real   w_j (L_j),      ! 'x_j (L_j)' not used GM1/00
     *        a1_j (L_j), a2_j (L_j), sig_j (L_j), sig (L_j),
     *        xs (Len_t, Num_lev), wlt (Len_t), T (Num_lev)

        character*8  AA

Cgal
      COMMON / XSEC_11 / w_j_11 (L_j), sig_j_11 (L_j),
     *                  a1_j_11 (L_j),  a2_j_11 (L_j)
Cgal

c       Temperature dependance: yes - K_T = 1, no - K_T = 0
        K_T = 1

        do l = 1, Len_t
           do i = 1, Num_lev
              xs(l,i) = 0.
           enddo
        enddo

Cgal        do while ( AA .ne. 'ClONO2' )
Cgal           read (10,12) AA
Cgal        end do
Cgal
Cgal 12     format (2x,A8)
Cgal        read (10,12) AA
Cgal
Cgal       read ( 10, * ) ( w_j(i), sig_j(i), a1_j(i), a2_j(i),
Cgal     *       w_j(i+L_hlf), sig_j(i+L_hlf), a1_j(i+L_hlf),
Cgal     *       a2_j(i+L_hlf), i = 1, L_hlf-1 )
Cgal
Cgal       read ( 10, * ) w_j(L_hlf), sig_j(L_hlf), a1_j(L_hlf),
Cgal     *                a2_j(L_hlf)
Cgal
Cgal 1      format ( 2x, 0pf7.2, 1p3e10.2 )

Cgal
      do i=1,L_j
         w_j(i) =    w_j_11(i)
       sig_j(i) =  sig_j_11(i)
        a1_j(i) =   a1_j_11(i)
        a2_j(i) =   a2_j_11(i)
      end do
Cgal

         do l = 1, L_j
            sig_j(l) = sig_j(l)*.1E-20
         enddo

c        Now,  find Num_beg and Len_X ...

         call  find_NL ( Len_t, wlt, L_j, w_j, Num_beg, Len_X )

c      interpolate ClONO2 x-sections at each T to model wlt grid:

         do i = 1, Num_lev
            tt = T(i)-296.
            do l = 1, L_j
               sig(l) = sig_j(l)*( 1. + a1_j(l)*tt + a2_j(l)*tt*tt )
            enddo
            call  linterp ( L_j, Len_X, w_j, wlt(Num_beg),
     *                    sig, xs(Num_beg,i) )
         enddo

 20     format ( 2x, 0pf7.2, 1p4e10.2 )

        end

c =======================================================================

        Subroutine  vHNO3_X ( Num_lev, T, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )
c
c       Notation: same as in  X_SEC
c
        Parameter  ( L_hlf = 27, L_j = L_hlf*3  )
        include 'jpl.par'

        real   w_j (L_j),     ! 'x_j (L_j)' not used GM1/00
     *        b_j (L_j), sig_j (L_j), sig (L_j),
     *        xs (Len_t, Num_lev), wlt (Len_t), T (Num_lev)

        character*8  AA

Cgal
      COMMON / XSEC_12 / w_j_12 (L_j), sig_j_12 (L_j),
     *                   b_j_12 (L_j)
Cgal

c       Temperature dependance: yes - K_T = 1, no - K_T = 0
        K_T = 1

        do l = 1, Len_t
           do i = 1, Num_lev
              xs(l,i) = 0.
           enddo
        enddo

Cgal        do while ( AA .ne. 'HNO3' )
Cgal           read (10,12) AA
Cgal        end do
Cgal
Cgal 12     format (2x,A8)
Cgal        read (10,12) AA
Cgal
Cgal       read ( 10, * ) ( w_j(i), sig_j(i), b_j(i),
Cgal     *       w_j(i+L_hlf), sig_j(i+L_hlf), b_j(i+L_hlf),
Cgal     *       w_j(i+L_hlf*2), sig_j(i+L_hlf*2), b_j(i+L_hlf*2),
Cgal     *       i = 1, L_hlf )
Cgal
Cgal 1      format ( 2x, f6.0, 2f12.5 )

Cgal
      do i=1,L_j
         w_j(i) =   w_j_12(i)
       sig_j(i) = sig_j_12(i)
         b_j(i) =   b_j_12(i)
      end do
Cgal

         do l = 1, L_j
            sig_j(l) = sig_j(l)*1.E-20
            b_j(l)   = b_j(l)*1.E-3
         enddo

c        Now,  find Num_beg and Len_X ...

         call  find_NL ( Len_t, wlt, L_j, w_j, Num_beg, Len_X )

c      interpolate HNO3 x-sections at each T to model wlt grid:

         do i = 1, Num_lev
            tt = T(i)-298.
            do l = 1, L_j
               sig(l) = sig_j(l)*exp( b_j(l)*tt )
            enddo
            call  linterp ( L_j, Len_X, w_j, wlt(Num_beg),
     *                    sig, xs(Num_beg,i) )
         enddo

 20     format ( 2x, 0pf7.2, 1p4e10.2 )

        end

c ======================================================================
        Subroutine  vN2O5_X ( Num_lev, T, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )
c
c       Notation: same as in  X_SEC
c
        Parameter  ( L_no_T = 17  )
        include 'jpl.par'

        real  x_j (L_no_T), w_j (L_no_T),
     *        xs (Len_t, Num_lev), wlt (Len_t), T (Num_lev)

        character*8  AA

Cgal
      COMMON / XSEC_13 / w_j_13 (L_no_T),
     *                   x_j_13 (L_no_T)
Cgal

c       Temperature dependance: yes - K_T = 1, no - K_T = 0
        K_T = 1

        do l = 1, Len_t
           do i = 1, Num_lev
              xs(l,i) = 0.
           enddo
        enddo

Cgal        do while ( AA .ne. 'N2O5' )
Cgal           read (10,12) AA
Cgal        end do
Cgal
Cgal 12     format (2x,A8)
Cgal        read (10,12) AA
Cgal
Cgal       read ( 10, * ) ( w_j(i), x_j(i),  i = 1, L_no_T )
Cgal
Cgal 1      format ( 2x, 2f6.1 )

Cgal
      do i=1,L_no_T
        w_j(i) =  w_j_13(i)
        x_j(i) =  x_j_13(i)
      end do
Cgal

         do l = 1, L_no_T
            x_j(l) = x_j(l)*1.E-20
         enddo

c        Now,  find Num_beg and Len_X ...

         call  find_NL ( Len_t, wlt, L_no_T, w_j, Num_beg, Len_X )

c    Interpolate N2O5 x-sec. 200 to 280 nm to model grid:

       call  linterp ( L_no_T, Len_X, w_j, wlt(Num_beg),
     *                    x_j, xs(Num_beg,1) )
         do i = 2, Num_lev
           do l = Num_beg, Num_beg+Len_X-1
              xs(l,i) = xs(l,1)
           enddo
         enddo

c    Now, calculate x-sec. 285 to 380 nm, using formula:
c    ... first, calculate the number of grid points between 285 and 380 nm:

        Num_T = Num_beg + Len_X
        l = 1

        do while ( wlt(l+Num_T) .lt. 380. )
           l = l+1
        enddo

        Len_X = Len_X + l

        do i = 1, Num_lev
           do l = Num_T, Num_beg+Len_X-1
             xs(l,i) = 1.E-20*exp( 2.735+
     *                ( 4728.5 - 17.127*wlt(l) )/T(i) )
           enddo
        enddo
 20     format ( 2x, 0pf7.2, 1p4e10.2 )

        end

c =========================================================================
        Subroutine  vN2O_X ( Num_lev, T, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )
c
c       Notation: same as in  X_SEC
c
        real  xs (Len_t, Num_lev), wlt (Len_t), T (Num_lev),
     *        a(5), b(4)

        a (1) = 68.21023
        a (2) = -4.071805
        a (3) =  4.301146E-2
        a (4) = -1.777846E-4
        a (5) =  2.520672E-7

        b (1) = 123.4014
        b (2) = -2.116255
        b (3) =  1.111572E-2
        b (4) = -1.881058E-5

c       Temperature dependance: yes - K_T = 1, no - K_T = 0
        K_T = 1

        do l = 1, Len_t
           do i = 1, Num_lev
              xs(l,i) = 0.
           enddo
        enddo

c       N2O spectrum starts from 173 nm, so:
        Num_beg = 1

        l = 1
        do while ( wlt(l) .le. 240. )
           As = 0.
           Bs = 0.
           wl = wlt(l)
           do ia = 1, 5
               As = As + a(ia)*wl**(ia-1)
               if ( ia .le. 4 )
     *            Bs = Bs + b(ia)*wl**(ia-1)
           enddo
           do i = 1, Num_lev
              xs(l,i) = exp ( As + (T(i) - 300.)*exp(Bs) )
           enddo
        l = l+1
        enddo

        Len_X = l - 1

 20     format ( 2x, 0pf7.2, 1p4e10.2 )

        end
c =======================================================================
        Subroutine  vNO3_NO_X ( Num_lev, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T ) ! ,T  NOT USED GM 1/00
c
c       Notation: same as in  X_SEC
c
        Parameter  ( L_p = 3 )

        character*8  AA

        real  xs (Len_t, Num_lev), wlt (Len_t), ! T (Num_lev), NOT USED GM 1/00
     *        wb(L_p), we(L_p), wm(L_p), x_no2(L_p), x_no(L_p)

Cgal
      COMMON / XSEC_14 / wb_14(L_p),    we_14(L_p),
     *                x_no2_14(L_p),  x_no_14(L_p)
Cgal

c       Temperature dependance: yes - K_T = 1, no - K_T = 0
        K_T = 0  ! GM 1/00 after Victor's approval (it was K_T=1)

        do l = 1, Len_t
           do i = 1, Num_lev
              xs(l,i) = 0.
           enddo
        enddo

Cgal        do while ( AA .ne. 'NO3_new' )
Cgal           read (10,12) AA
Cgal        end do
Cgal
Cgal 12     format (2x,A8)
Cgal        read (10,12) AA
Cgal
Cgal        read (10, *) ( wb(l), we(l), x_no2(l), x_no(l),
Cgal     *                 l = 1, L_p )
Cgal 1      format ( 2x, 0p2f6.2, 1p2e12.5 )

Cgal
      do i=1,L_p
        wb(i)    =    wb_14(i)
        we(i)    =    we_14(i)
        x_no2(i) = x_no2_14(i)
        x_no(i)  =  x_no_14(i)
      end do
Cgal

        do l = 1, L_p
           wm(l) = 0.5*(wb(l)+we(l))
        enddo

c        Now,  find Num_beg and Len_X ...

         call  find_NL ( Len_t, wlt, L_p, wm, Num_beg, Len_X )

         call  linterp ( L_p, Len_X, wm, wlt(Num_beg), x_no,
     *                   xs(Num_beg,1) )
         do i = 2, Num_lev
            do l = Num_beg, Num_beg+Len_X-1
                 xs(l,i) = xs(l,1)
            enddo
         enddo

 20     format ( 2x, 0pf7.2, 1p4e10.2 )

        end
c =========================================================================
        Subroutine  vNO3_NO2_X ( Num_lev, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T ) ! ,T NOT USED GM 1/00
c
c       Notation: same as in  X_SEC
c
        Parameter  ( L_p = 3 )

        character*8 AA

        real  xs (Len_t, Num_lev), wlt (Len_t), ! T (Num_lev), NOT USED GM 1/00
     *        wb(L_p), we(L_p), wm(L_p), x_no2(L_p), x_no(L_p)

Cgal
      COMMON / XSEC_15 / wb_15(L_p),    we_15(L_p),
     *                x_no2_15(L_p),  x_no_15(L_p)
Cgal
c       Temperature dependance: yes - K_T = 1, no - K_T = 0
        K_T = 0

        do l = 1, Len_t
           do i = 1, Num_lev
              xs(l,i) = 0.
           enddo
        enddo

Cgal        do while ( AA .ne. 'NO3_new' )
Cgal           read (10,12) AA
Cgal        end do
Cgal
Cgal 12     format (2x,A8)
Cgal        read (10,12) AA
Cgal
Cgal        read (10, *) ( wb(l), we(l), x_no2(l), x_no(l),
Cgal     *                 l = 1, L_p )
Cgal
Cgal 1      format ( 2x, 0p2f6.2, 1p2e12.5 )

Cgal
      do i=1,L_p
        wb(i)    =    wb_15(i)
        we(i)    =    we_15(i)
        x_no2(i) = x_no2_15(i)
        x_no(i)  =  x_no_15(i)
      end do
Cgal

        do l = 1, L_p
           wm(l) = 0.5*(wb(l)+we(l))
        enddo

c        Now,  find Num_beg and Len_X ...

         call  find_NL ( Len_t, wlt, L_p, wm, Num_beg, Len_X )

         call  linterp ( L_p, Len_X, wm, wlt(Num_beg), x_no2,
     *                   xs(Num_beg,1) )
         do i = 2, Num_lev
            do l = Num_beg, Num_beg+Len_X-1
                 xs(l,i) = xs(l,1)
            enddo
         enddo

 20     format ( 2x, 0pf7.2, 1p4e10.2 )

        end

c ==========================================================================
        Subroutine  vHO2_X ( Num_lev, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T ) ! ,T NOT USED GM 1/00
c
c       Notation: same as in  X_SEC
c
        Parameter  ( L_j = 7  )
        include 'jpl.par'

        real  x_j (L_j), w_j (L_j),
     *        xs (Len_t, Num_lev), wlt (Len_t)  ! , T (Num_lev) GM 1/00

        character*8  AA

Cgal
      COMMON / XSEC_16 / w_j_16 (L_j),
     *                   x_j_16 (L_j)
Cgal

c       Temperature dependance: yes - K_T = 1, no - K_T = 0
        K_T = 0

        do l = 1, Len_t
           do i = 1, Num_lev
              xs(l,i) = 0.
           enddo
        enddo

Cgal        do while ( AA .ne. 'HO2' )
Cgal           read (10,12) AA
Cgal        end do
Cgal
Cgal 12     format (2x,A8)
Cgal        read (10,12) AA
Cgal
Cgal       read ( 10, * ) ( w_j(i), x_j(i),  i = 1, L_j )
Cgal
Cgal 1      format ( 2x, 2f6.1 )

Cgal
      do i=1,L_j
        w_j(i) =  w_j_16(i)
        x_j(i) =  x_j_16(i)
      end do
Cgal

         do l = 1, L_j
            x_j(l) = x_j(l)*1.E-20
         enddo

c        Now,  find Num_beg and Len_X ...

         call  find_NL ( Len_t, wlt, L_j, w_j, Num_beg, Len_X )

c    Interpolate HO2 x-sec. to model grid:

         call  linterp ( L_j, Len_X, w_j, wlt(Num_beg),
     *                    x_j, xs(Num_beg,1) )
         do i = 2, Num_lev
           do l = Num_beg, Num_beg+Len_X-1
              xs(l,i) = xs(l,1)
           enddo
         enddo

  2     format (2x, 0pf6.1, 1pe10.2)
         end
c ======================================================================
        Subroutine  vH2O2_X ( Num_lev, T, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )
c
c       Notation: same as in  X_SEC
c
        Parameter  ( L_no_T = 14  )
        include 'jpl.par'

        real  x_j (L_no_T), w_j (L_no_T),
     *        xs (Len_t, Num_lev), wlt (Len_t), T (Num_lev),
     *        a(8), b(5)

        character*8  AA

Cgal
      COMMON / XSEC_17 / w_j_17 (L_no_T),
     *                   x_j_17 (L_no_T)
Cgal

        a (1) = 6.4761e4
        a (2) = -9.2170972e2
        a (3) = 4.535649
        a (4) = -4.4589016e-3
        a (5) =  -4.035101e-5
        a (6) = 1.6878206e-7
        a (7) = -2.652014e-10
        a (8) =  1.5534675e-13

        b (1) = 6.8123e3
        b (2) =  -51.351
        b (3) = 0.11522
        b (4) = -3.0493e-5
        b (5) = -1.0924e-7

c       Temperature dependance: yes - K_T = 1, no - K_T = 0
        K_T = 1

        do l = 1, Len_t
           do i = 1, Num_lev
              xs(l,i) = 0.
           enddo
        enddo

Cgal        do while ( AA .ne. 'H2O2' )
Cgal           read (10,12) AA
Cgal        end do
Cgal
Cgal 12     format (2x,A8)
Cgal        read (10,12) AA
Cgal
Cgal       read ( 10, * ) ( w_j(i), x_j(i),  i = 1, L_no_T )
Cgal
Cgal 1      format ( 2x, 2f6.1 )

Cgal
      do i=1,L_no_T
        w_j(i) =  w_j_17(i)
        x_j(i) =  x_j_17(i)
      end do
Cgal

         do l = 1, L_no_T
            x_j(l) = x_j(l)*1.E-20
         enddo

c        Now,  find Num_beg and Len_X ...

         call  find_NL ( Len_t, wlt, L_no_T, w_j, Num_beg, Len_X )

c    Interpolate H2O2 x-sec. 190 to 255 nm to model grid:

       call  linterp ( L_no_T, Len_X, w_j, wlt(Num_beg),
     *                    x_j, xs(Num_beg,1) )
         do i = 2, Num_lev
           do l = Num_beg, Num_beg+Len_X-1
              xs(l,i) = xs(l,1)
           enddo
         enddo

c    Now, calculate x-sec. 260 to 350 nm, using formula:
c    ... first, calculate the number of grid points between 260 and 350 nm:

        Num_T = Num_beg + Len_X
        l = 1

        do while ( wlt(l+Num_T) .lt. 352. )
           l = l+1
        enddo

        Len_X = Len_X + l

        do i = 1, Num_lev
           hi = 1./(1.+exp(-1265./T(i)) )
           do l = Num_T, Num_beg+Len_X-1

             xsa = 0.
             do ia = 1, 8
                xsa = xsa + a(ia)*wlt(l)**(ia-1)
             enddo
             xsb = 0.
             do ib = 1, 5
                xsb = xsb + b(ib)*wlt(l)**(ib-1)
             enddo

             xs(l,i) = 1.E-21*(hi*xsa + (1.-hi)*xsb)

           enddo
        enddo
 20     format ( 2x, 0pf7.2, 1p4e10.2 )

        end

c =========================================================================
        Subroutine  vHO2NO2_HO2_X ( Num_lev, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )  ! ,T GM 1/00
c
c       Notation: same as in  X_SEC
c
        Parameter  ( L_hlf = 14, L_j = L_hlf*2  )
        include 'jpl.par'

        real  x_j (L_j), w_j (L_j),
     *        xs (Len_t, Num_lev), wlt (Len_t) ! , T (Num_lev) GM 1/00

        character*8  AA

Cgal
      COMMON / XSEC_18 / w_j_18 (L_j),
     *                   x_j_18 (L_j)
Cgal

c       Temperature dependance: yes - K_T = 1, no - K_T = 0
        K_T = 0

        do l = 1, Len_t
           do i = 1, Num_lev
              xs(l,i) = 0.
           enddo
        enddo

Cgal        do while ( AA .ne. 'HO2NO2' )
Cgal           read (10,12) AA
Cgal        end do
Cgal
Cgal 12     format (2x,A8)
Cgal        read (10,12) AA
Cgal
Cgal       read ( 10, * ) ( w_j(i), x_j(i),  w_j(i+L_hlf),
Cgal     *       x_j(i+L_hlf),  i = 1, L_hlf )
Cgal
Cgal 1      format ( 2x, 0pf7.2, 1p3e10.2 )

Cgal
      do i=1,L_j
        w_j(i) =  w_j_18(i)
        x_j(i) =  x_j_18(i)
      end do
Cgal

         do l = 1, L_j
            x_j(l) = x_j(l)*1.E-20*2./3.
         enddo

c        Now,  find Num_beg and Len_X ...

         call  find_NL ( Len_t, wlt, L_j, w_j, Num_beg, Len_X )

c      interpolate HO2NO2 x-sections to model wlt grid:

        call  linterp ( L_j, Len_X, w_j, wlt(Num_beg),
     *                    x_j, xs(Num_beg,1) )

         do i = 2, Num_lev
           do l = Num_beg, Num_beg+Len_X-1
              xs(l,i) = xs(l,1)
           enddo
         enddo

 20     format ( 2x, 0pf7.2, 1pe10.2 )

        end

c =======================================================================
        Subroutine  vHO2NO2_OH_X ( Num_lev, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T ) ! ,T GM 1/00
c
c       Notation: same as in  X_SEC
c
        Parameter  ( L_hlf = 14, L_j = L_hlf*2  )
        include 'jpl.par'

        real  x_j (L_j), w_j (L_j),
     *        xs (Len_t, Num_lev), wlt (Len_t)  ! , T (Num_lev) GM 1/00

        character*8  AA

Cgal
      COMMON / XSEC_19 / w_j_19 (L_j),
     *                   x_j_19 (L_j)
Cgal

c       Temperature dependance: yes - K_T = 1, no - K_T = 0
        K_T = 0

        do l = 1, Len_t
           do i = 1, Num_lev
              xs(l,i) = 0.
           enddo
        enddo

Cgal        do while ( AA .ne. 'HO2NO2' )
Cgal           read (10,12) AA
Cgal        end do
Cgal
Cgal 12     format (2x,A8)
Cgal        read (10,12) AA
Cgal
Cgal       read ( 10, * ) ( w_j(i), x_j(i),  w_j(i+L_hlf),
Cgal     *       x_j(i+L_hlf),  i = 1, L_hlf )
Cgal
Cgal 1      format ( 2x, 0pf7.2, 1p3e10.2 )

Cgal
      do i=1,L_j
        w_j(i) =  w_j_19(i)
        x_j(i) =  x_j_19(i)
      end do
Cgal

         do l = 1, L_j
            x_j(l) = x_j(l)*1.E-20*1./3.
         enddo

c        Now,  find Num_beg and Len_X ...

         call  find_NL ( Len_t, wlt, L_j, w_j, Num_beg, Len_X )

c      interpolate HO2NO2 x-sections to model wlt grid:

        call  linterp ( L_j, Len_X, w_j, wlt(Num_beg),
     *                    x_j, xs(Num_beg,1) )

         do i = 2, Num_lev
           do l = Num_beg, Num_beg+Len_X-1
              xs(l,i) = xs(l,1)
           enddo
         enddo

 20     format ( 2x, 0pf7.2, 1pe10.2 )

        end

c =======================================================================
        Subroutine  vCH2O_H_X ( Num_lev, T, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )
c
c       Notation: same as in  X_SEC
c  !!!  Note: CH2O requires higher resolution spectrum then that
c       that adopted in current version of this photodiss. code,
c       especially above 325 nm. So, the averages of the initial
c       available JPL x-sect. at 2.5 nm resolution for each model
c       interval are calculated. If the wavelength grid is changed,
c       changes in this program are required.

        Parameter  ( L_j = 23, L_j1 = L_j+1, L_c = 11 )
        include 'jpl.par'

        real  w_j (L_j), wb_j (L_j1),
     *        a_j (L_j), b_j (L_j), sig_j (L_j),
     *        xs (Len_t, Num_lev), wlt (Len_t), T (Num_lev),
     *        qh_j (L_j), qh2_j (L_j), wb (Len_tm), s1, s2

        character*8  AA

Cgal
      COMMON / XSEC_20 / w_j_20 (L_j),
     *                   a_j_20 (L_j),   b_j_20 (L_j),
     *                  qh_j_20 (L_j), qh2_j_20 (L_j)
Cgal

c       Temperature dependance: yes - K_T = 1, no - K_T = 0
        K_T = 1

        do l = 1, Len_t
           do i = 1, Num_lev
              xs(l,i) = 0.
           enddo
        enddo

Cgal        do while ( AA .ne. 'CH2O' )
Cgal           read (10,12) AA
Cgal        end do
Cgal
Cgal 12     format (2x,A8)
Cgal        read (10,12) AA
Cgal
Cgal       read ( 10, * ) ( w_j(i), s1, s2, a_j(i), b_j(i),
Cgal     *       qh_j(i), qh2_j(i), i = 1, L_j )
Cgal
Cgal
Cgal 1      format ( 2x, 5f8.3 )

Cgal
      do i=1,L_j
          w_j(i) =    w_j_20(i)
          a_j(i) =    a_j_20(i)
          b_j(i) =    b_j_20(i)
         qh_j(i) =   qh_j_20(i)
        qh2_j(i) =  qh2_j_20(i)
      end do
Cgal

         do l = 1, L_j1
            wb_j(l) = 300.+2.5*(l-1)
         enddo

         do l = 1, Len_t-1
            wb(l) = 0.5*( wlt(l)  + wlt(l+1) )
         enddo

c        Now,  find Num_beg and Len_X ...

         call  find_NL ( Len_t, wlt, L_j, w_j, Num_beg, Len_X )
         call  find_NL ( Len_t, wlt, L_c, w_j, Num_c, Len_X_c )

c      interpolate CH2O x-sections at each T to model wlt grid:

         do i = 1, Num_lev
            tc = T(i)-273.
            do l = 1, L_j
               sig_j(l) = 1.E-20*( a_j(l) + 1.E-3*b_j(l)*tc )*qh_j(l)
            enddo
            call  linterp ( L_c, Len_X_c, w_j, wlt(Num_beg),
     *                    sig_j, xs(Num_beg,i) )
            L_f = L_j-L_c+1
            Len_X_f = Len_X-Len_X_c
            call  hi_lo_int ( L_f, Len_X_f, wb_j(L_c),
     *      wb(Num_beg+Len_X_c-1), sig_j(L_c), xs(Num_beg+Len_X_c,i) )
         enddo

 20     format ( 2x, 0pf7.2, 1p4e10.2 )

        end

c =======================================================================
        Subroutine  vCH2O_H2_X ( Num_lev, T, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )
c
c       Notation: same as in  X_SEC
c  !!!  Note: CH2O requires higher resolution spectrum then that
c       that adopted in current version of this photodiss. code,
c       especially above 325 nm. So, the averages of the initial
c       available JPL x-sect. at 2.5 nm resolution for each model
c       interval are calculated. If the wavelength grid is changed,
c       changes in this program are required.

        Parameter  ( L_j = 23, L_j1 = L_j+1, L_c = 11 )
        include 'jpl.par'

        real  w_j (L_j), wb_j (L_j1),
     *        a_j (L_j), b_j (L_j), sig_j (L_j),
     *        xs (Len_t, Num_lev), wlt (Len_t), T (Num_lev),
     *        qh_j (L_j), qh2_j (L_j), wb (Len_tm), s1, s2

        character*8  AA

Cgal
      COMMON / XSEC_21 / w_j_21 (L_j),
     *                   a_j_21 (L_j),   b_j_21 (L_j),
     *                  qh_j_21 (L_j), qh2_j_21 (L_j)
Cgal

c       Temperature dependance: yes - K_T = 1, no - K_T = 0
        K_T = 1

        do l = 1, Len_t
           do i = 1, Num_lev
              xs(l,i) = 0.
           enddo
        enddo

Cgal        do while ( AA .ne. 'CH2O' )
Cgal           read (10,12) AA
Cgal        end do
Cgal
Cgal 12     format (2x,A8)
Cgal        read (10,12) AA
Cgal
Cgal       read ( 10, * ) ( w_j(i), s1, s2, a_j(i), b_j(i),
Cgal     *       qh_j(i), qh2_j(i), i = 1, L_j )
Cgal
Cgal
Cgal 1      format ( 2x, 5f8.3 )

Cgal
      do i=1,L_j
          w_j(i) =    w_j_21(i)
          a_j(i) =    a_j_21(i)
          b_j(i) =    b_j_21(i)
         qh_j(i) =   qh_j_21(i)
        qh2_j(i) =  qh2_j_21(i)
      end do
Cgal

         do l = 1, L_j1
            wb_j(l) = 300.+2.5*(l-1)
         enddo

         do l = 1, Len_t-1
            wb(l) = 0.5*( wlt(l)  + wlt(l+1) )
         enddo

c        Now,  find Num_beg and Len_X ...

         call  find_NL ( Len_t, wlt, L_j, w_j, Num_beg, Len_X )
         call  find_NL ( Len_t, wlt, L_c, w_j, Num_c, Len_X_c )

c      interpolate CH2O x-sections at each T to model wlt grid:

         do i = 1, Num_lev
            tc = T(i)-273.
            do l = 1, L_j
              sig_j(l) = 1.E-20*( a_j(l) + 1.E-3*b_j(l)*tc )*qh2_j(l)
            enddo
            call  linterp ( L_c, Len_X_c, w_j, wlt(Num_beg),
     *                    sig_j, xs(Num_beg,i) )
            L_f = L_j-L_c+1
            Len_X_f = Len_X-Len_X_c
            call  hi_lo_int ( L_f, Len_X_f, wb_j(L_c),
     *      wb(Num_beg+Len_X_c-1), sig_j(L_c), xs(Num_beg+Len_X_c,i) )
         enddo

 20     format ( 2x, 0pf7.2, 1p4e10.2 )

        end

c =======================================================================
        Subroutine  vCH3OOH_X ( Num_lev, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T ) ! ,T GM 1/00
c
c       Notation: same as in  X_SEC
c
        Parameter  ( L_hlf = 8, L_j = L_hlf*2  )
        include 'jpl.par'

        real  x_j (L_j), w_j (L_j),
     *        xs (Len_t, Num_lev), wlt (Len_t)  !, T (Num_lev) GM 1/00

        character*8  AA

Cgal
      COMMON / XSEC_22 / w_j_22 (L_j),
     *                   x_j_22 (L_j)
Cgal

c       Temperature dependance: yes - K_T = 1, no - K_T = 0
        K_T = 0

        do l = 1, Len_t
           do i = 1, Num_lev
              xs(l,i) = 0.
           enddo
        enddo

Cgal        do while ( AA .ne. 'CH3OOH' )
Cgal           read (10,12) AA
Cgal        end do
Cgal
Cgal 12     format (2x,A8)
Cgal        read (10,12) AA
Cgal
Cgal       read ( 10, * ) ( w_j(i), x_j(i),  w_j(i+L_hlf),
Cgal     *       x_j(i+L_hlf),  i = 1, L_hlf )
Cgal
Cgal 1      format ( 2x, 0pf7.2, 1p3e10.2 )

Cgal
      do i=1,L_j
         w_j(i) =  w_j_22(i)
         x_j(i) =  x_j_22(i)
      end do
Cgal
         do l = 1, L_j
            x_j(l) = x_j(l)*1.E-20
         enddo

c        Now,  find Num_beg and Len_X ...

         call  find_NL ( Len_t, wlt, L_j, w_j, Num_beg, Len_X )

c      interpolate CH3OOH x-sections to model wlt grid:

        call  linterp ( L_j, Len_X, w_j, wlt(Num_beg),
     *                    x_j, xs(Num_beg,1) )

         do i = 2, Num_lev
           do l = Num_beg, Num_beg+Len_X-1
              xs(l,i) = xs(l,1)
           enddo
         enddo

 20     format ( 2x, 0pf7.2, 1pe10.2 )

        end

c =======================================================================
        Subroutine  vHCL_X ( Num_lev, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T )  ! ,T GM 1/00
c
c       Notation: same as in  X_SEC
c
        Parameter  ( L_hlf = 9, L_j = L_hlf*2-1  )
        include 'jpl.par'

        real  x_j (L_j), w_j (L_j),
     *        xs (Len_t, Num_lev), wlt (Len_t) ! , T (Num_lev) GM 1/00

        character*8  AA

Cgal
      COMMON / XSEC_23 / w_j_23 (L_j),
     *                   x_j_23 (L_j)
Cgal

c       Temperature dependance: yes - K_T = 1, no - K_T = 0
        K_T = 0

        do l = 1, Len_t
           do i = 1, Num_lev
              xs(l,i) = 0.
           enddo
        enddo

Cgal        do while ( AA .ne. 'HCl' )
Cgal           read (10,12) AA
Cgal        end do
Cgal
Cgal 12     format (2x,A8)
Cgal        read (10,12) AA
Cgal
Cgal       read ( 10, * ) ( w_j(i), x_j(i),  w_j(i+L_hlf),
Cgal     *       x_j(i+L_hlf),  i = 1, L_hlf-1 )
Cgal
Cgal       read ( 10, * ) w_j(L_hlf), x_j(L_hlf)
Cgal
Cgal 1      format ( 2x, 0pf7.2, 1p3e10.2 )

Cgal
      do i=1,L_j
        w_j(i) =  w_j_23(i)
        x_j(i) =  x_j_23(i)
      end do
Cgal

         do l = 1, L_j
            x_j(l) = x_j(l)*1.E-20
         enddo

c        Now,  find Num_beg and Len_X ...

         call  find_NL ( Len_t, wlt, L_j, w_j, Num_beg, Len_X )

c      interpolate HCl x-sections to model wlt grid:

        call  linterp ( L_j, Len_X, w_j, wlt(Num_beg),
     *                    x_j, xs(Num_beg,1) )

         do i = 2, Num_lev
           do l = Num_beg, Num_beg+Len_X-1
              xs(l,i) = xs(l,1)
           enddo
         enddo

 20     format ( 2x, 0pf7.2, 1pe10.2 )

        end

c ==============================================================
        Subroutine  vHOCL_X ( Num_lev, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T ) ! ,T GM 1/00
c
c       Notation: same as in  X_SEC
c
        Parameter  ( L_trd = 31, L_j = L_trd*3-2  )
        include 'jpl.par'

        real  x_j (L_j), w_j (L_j),
     *        xs (Len_t, Num_lev), wlt (Len_t) ! , T (Num_lev) GM 1/00

        character*8  AA

Cgal
      COMMON / XSEC_24 / w_j_24 (L_j),
     *                   x_j_24 (L_j)
Cgal

c       Temperature dependance: yes - K_T = 1, no - K_T = 0
        K_T = 0

        do l = 1, Len_t
           do i = 1, Num_lev
              xs(l,i) = 0.
           enddo
        enddo

Cgal        do while ( AA .ne. 'HOCl' )
Cgal           read (10,12) AA
Cgal        end do
Cgal
Cgal 12     format (2x,A8)
Cgal        read (10,12) AA
Cgal
Cgal       read ( 10, * ) ( w_j(i), x_j(i),  w_j(i+L_trd),
Cgal     *       x_j(i+L_trd),  w_j(i+2*L_trd-1), x_j(i+2*L_trd-1),
Cgal     *             i = 1, L_trd-1 )
Cgal
Cgal       read ( 10, * ) w_j(L_trd), x_j(L_trd)
Cgal
Cgal 1      format ( 2x, 0pf7.2, 1p3e10.2 )

Cgal
      do i=1,L_j
        w_j(i) =   w_j_24(i)
        x_j(i) =   x_j_24(i)
      end do
Cgal

         do l = 1, L_j
            x_j(l) = x_j(l)*1.E-20
         enddo

c        Now,  find Num_beg and Len_X ...

         call  find_NL ( Len_t, wlt, L_j, w_j, Num_beg, Len_X )

c      interpolate HOCl x-sections to model wlt grid:

        call  linterp ( L_j, Len_X, w_j, wlt(Num_beg),
     *                    x_j, xs(Num_beg,1) )

         do i = 2, Num_lev
           do l = Num_beg, Num_beg+Len_X-1
              xs(l,i) = xs(l,1)
           enddo
         enddo

 20     format ( 2x, 0pf7.2, 1pe10.2 )

        end

c =======================================================================

        Subroutine  vCl2_X ( Num_lev, T, Len_t, wlt, Num_beg, Len_X,
     *            xs, K_T )
c
c       Notation: same as in  X_SEC
c
        parameter ( L_j = 2 )
        include 'jpl.par'

        real  w_j (L_j), xs (Len_t, Num_lev), wlt (Len_t), T (Num_lev)

C  character*8  AA  not used GM 1/00. Victor says the x-section for this
C  species is not read but calculated from analytical parameterization

        x_sect (alf,w) = 1.e-20*sqrt(alf)*( 27.3*exp(-99.*alf*
     *    (alog(329.5/w))**2) + .932*exp(-91.5*alf*(alog(406.5/w))**2) )

c       Temperature dependance: yes - K_T = 1, no - K_T = 0
        K_T = 1

        w_j (1) = 260.
        w_j (2) = 470.

        do l = 1, Len_t
           do i = 1, Num_lev
              xs(l,i) = 0.
           enddo
        enddo

c        Now,  find Num_beg and Len_X ...

         call  find_NL ( Len_t, wlt, L_j, w_j, Num_beg, Len_X )

c      calculate Cl2 x-sections :

         do i = 1, Num_lev
            alf = tanh ( 402.7/T(i) )
            do l = Num_beg, Num_beg+Len_X-1
               xs(l,i) = x_sect(alf,wlt(l))
            enddo
         enddo

 20     format ( 2x, 0pf7.2, 1p4e10.2 )

        end


c =========================================================================

        Subroutine  vCL2O2_X ( Num_lev, Len_t, wlt, Num_beg,
     *                        Len_X, xs, K_T ) ! ,T GM 1/00
c
c       Notation: same as in  X_SEC
c
        Parameter  ( L_4 = 33, L_j = L_4*4-1  )
        include 'jpl.par'

        real  x_j (L_j), w_j (L_j),
     *        xs (Len_t, Num_lev), wlt (Len_t) ! , T (Num_lev) GM 1/00

        character*8  AA

Cgal
      COMMON / XSEC_25 / w_j_25 (L_j),
     *                   x_j_25 (L_j)
Cgal

c       Temperature dependance: yes - K_T = 1, no - K_T = 0
        K_T = 0

        do l = 1, Len_t
           do i = 1, Num_lev
              xs(l,i) = 0.
           enddo
        enddo

Cgal        do while ( AA .ne. 'ClOOCl' )
Cgal           read (10,12) AA
Cgal        end do
Cgal
Cgal 12     format (2x,A8)
Cgal        read (10,12) AA
Cgal
Cgal       read ( 10, * ) ( w_j(i), x_j(i), w_j(i+L_4), x_j(i+L_4),
Cgal     *       w_j(i+L_4*2), x_j(i+L_4*2), w_j(i+L_4*3), x_j(i+L_4*3),
Cgal     *       i = 1, L_4-1 )
Cgal       read ( 10, * )  w_j(L_4), x_j(L_4), w_j(L_4*2), x_j(L_4*2),
Cgal     *       w_j(L_4*3), x_j(L_4*3)
Cgal
Cgal 1      format ( 2x, f6.0, f12.5 )

Cgal
      do i=1,L_j
        w_j(i) =   w_j_25(i)
        x_j(i) =   x_j_25(i)
      end do
Cgal

         do l = 1, L_j
            x_j(l) = x_j(l)*1.E-20
         enddo

c        Now,  find Num_beg and Len_X ...

         call  find_NL ( Len_t, wlt, L_j, w_j, Num_beg, Len_X )

c      interpolate ClOOCl x-sections to model wlt grid:

        call  linterp ( L_j, Len_X, w_j, wlt(Num_beg),
     *                    x_j, xs(Num_beg,1) )
         do i = 2, Num_lev
           do l = Num_beg, Num_beg+Len_X-1
              xs(l,i) = xs(l,1)
           enddo
         enddo

 20     format ( 2x, 0pf7.2, 1p4e10.2 )

        end

c ======================================================================
