      SUBROUTINE READLIJINGTABLE_COEFF(maxtype,a1,a2,b1,b2,at1,tt1,tt2)

C     READLIJINGTABLE_COEFF READS COEFF DATA FROM LIJING ET AL. 2014

      parameter (icmax=20)
      character*80 text,filename
 
      dimension a1(maxtype),a2(maxtype)
      dimension b1(maxtype),b2(maxtype)
      dimension at1(maxtype),tt1(maxtype)
      dimension tt2(maxtype)
      dimension icomma(icmax,2)

      call extraname('sys.inf'//CHAR(0),
     * 'CH14_coeff.txt'//CHAR(0),filename)
      open(9,file=filename,status='old')

c     read in headers

      do 30 nn=1,2
30     read(9,'(a)') text

c     read in data
c    column 1: Type
c     row1 = T4/T6 - SX - T10
c     row2 = T7/DB - DX - T5
c     row3 = all TSK
c    column 2: a1
c    column 3: a2
c    column 4: b1
c    column 5: b2

c     put in arrays as
c    1: T7/DB
c    2: unk_deep
c    3: T4/T6
c    4: unk_shallow
c    5: T10
c    6: T5
c    7: TSK T4/T6
c    8: TSK T5
c    9: TSK T7

      do 50 ny=1,4

       call clearstring(text,80)
       read(9,'(a)',end=4) text
       call findlastchar(nsp,text,80)

       call commafindx(nsp,icmax,ncomma,icomma,text)

       read(text(icomma(2,1):icomma(2,1)+icomma(2,2)-1),*) a1in
       read(text(icomma(3,1):icomma(3,1)+icomma(3,2)-1),*) a2in
       read(text(icomma(4,1):icomma(4,1)+icomma(4,2)-1),*) b1in
       read(text(icomma(5,1):icomma(5,1)+icomma(5,2)-1),*) b2in
       if ( ncomma .gt. 5 ) then
        read(text(icomma(6,1):icomma(6,1)+icomma(6,2)-1),*) atx
        read(text(icomma(7,1):icomma(7,1)+icomma(7,2)-1),*) tta
        read(text(icomma(8,1):icomma(8,1)+icomma(8,2)-1),*) ttb
       endif

       if ( ny .eq. 1 ) then
        a1(3)=a1in
        a2(3)=a2in
        a1(4)=a1in
        a2(4)=a2in
        a1(5)=a1in
        a2(5)=a2in
        b1(3)=b1in
        b2(3)=b2in
        b1(4)=b1in
        b2(4)=b2in
        b1(5)=b1in
        b2(5)=b2in
        at1(3)=atx
        tt1(3)=tta
        tt2(3)=ttb
        at1(4)=atx
        tt1(4)=tta
        tt2(4)=ttb
        at1(5)=atx
        tt1(5)=tta
        tt2(5)=ttb
        at1(5)=atx
        tt1(5)=tta
        tt2(5)=ttb
        at1(7)=atx
        tt1(7)=tta
        tt2(7)=ttb
       elseif ( ny .eq. 2 ) then
        a1(1)=a1in
        a2(1)=a2in
        a1(2)=a1in
        a2(2)=a2in
        b1(1)=b1in
        b2(1)=b2in
        b1(2)=b1in
        b2(2)=b2in
        at1(1)=atx
        tt1(1)=tta
        tt2(1)=ttb
        at1(2)=atx
        tt1(2)=tta
        tt2(2)=ttb
        at1(9)=atx
        tt1(9)=tta
        tt2(9)=ttb
       elseif ( ny .eq. 3 ) then
        a1(6)=a1in
        a2(6)=a2in
        b1(6)=b1in
        b2(6)=b2in
        at1(6)=atx
        tt1(6)=tta
        tt2(6)=ttb
        at1(8)=atx
        tt1(8)=tta
        tt2(8)=ttb
       else
        a1(7)=a1in
        a2(7)=a2in
        a1(8)=a1in
        a2(8)=a2in
        a1(9)=a1in
        a2(9)=a2in
        b1(7)=b1in
        b2(7)=b2in
        b1(8)=b1in
        b2(8)=b2in
        b1(9)=b1in
        b2(9)=b2in
       endif
50    continue
4     continue

      close(9)

      return
      end
