
C----- gg -channel 

      double precision function xggrNN(x)
      double precision x, xlo, xnlo, xnnlo, xnlosoft, xnlohard
      double precision xnnlosoft, xnnlohard, t0
      double precision pi, z2, z3, L, Lt, Lr, alphas, z4, NF
      double precision Li2, Li3, S12, delta, DD0, DD1, DD2, DD3
      double precision s1,s2,s3,s4,s5,s6,s7,s8,s9,s10
      double precision s11,pp12,s13,s14,s15,s16,s17,s18,s19,s20
      external Li2, Li3, S12, DD0, DD1, DD2, DD3, delta
      common /xsection/ L, Lt, Lr, alphas, NF 
      common /consts/ pi, z2, z3
      z4=1.082323234d0

      xnlo= -12*(x**3-x**2+2*x-1)/x*dlog(-x+1)+6*(x**2-x+1)**2/(x-1
     &     )/x*dlog(x)+6*(x**3-x**2+2*x-1)/x*L+11.D0/2.D0*(x-1)**3/x

      s3 = (2.D0/3.D0*(27*x**4-103*x**3+81*x**2+27-5*x)/x/(x-1)*dlog(x)-
     #36*(x**3-x**2+2*x-1)/x*dlog(-x+1)+(1261*x**3-969*x**2-66*x-1261)/x
     #/36)*L**2+((196*x**2-61*x**3-196*x**4+81*x**5+54+61*x)/x/(x-1)/(x+
     #1)*dlog(x)**2/3+(-126*(x**2-x+1)**2/(x-1)/x*dlog(-x+1)-18*(x**2+1+
     #x)**2/(x+1)/x*dlog(x+1)+(4178*x**4-7679*x**3+5460*x**2-3661*x+1288
     #)/(x-1)/x/18)*dlog(x)+108*(x**3-x**2+2*x-1)/x*dlog(-x+1)**2-(2179*
     #x**3-2481*x**2+2067*x-2179)/x*dlog(-x+1)/9-9*(x**2+1+x)**2/x/(x+1)
     #*Li2(x**2)+2.D0/3.D0*(27*x**4-142*x**3-311*x**2-142*x+27)/(x+1)/x*
     #Li2(x)-(-568*x**2-203*x-338*x**3+162*x**4-108)/(x+1)/x*z2/3+(25397
     #*x**3-13188*x**2+20190*x-26117)/x/108)*L
      s2 = s3+69.D0/2.D0*(x**3-x**2+2*x-1)/x*Lr*L+(-409*x**4+436*x**2-13
     #9*x**3+139*x+243*x**5+108)/x/(x-1)/(x+1)*dlog(x)**3/18+(-(1296*x**
     #4-2371*x**3+3873*x**2-2572*x+1286)/(x-1)/x*dlog(-x+1)/24-9.D0/4.D0
     #*(4*x**4+8*x**3+27*x**2+18*x+9)/(x+1)/x*dlog(x+1)+(-20574*x**3+182
     #88*x**2+9438*x**4-10763*x+3818)/(x-1)/x/72)*dlog(x)**2
      s3 = s2+((-6259*x**3+9543*x**2-6352*x+3176+3186*x**4)/(x-1)/x*dlog
     #(-x+1)**2/24-(5105*x**4-10185*x**3+10728*x**2-10732*x+5429)/(x-1)/
     #x*dlog(-x+1)/12+27.D0/2.D0*(3*x**2+2*x+1)/(x+1)/x*dlog(x+1)**2+3.D
     #0/2.D0*(11*x**3+21*x**2-12*x-14)/x*dlog(x+1)+9.D0/4.D0*(2*x**4-15*
     #x**2-10*x-5)/x/(x+1)*Li2(x**2)+(2941*x**2+594*x**5+1424*x-3275*x**
     #4+604-1100*x**3)/x/(x-1)/(x+1)*Li2(x)/12-(-151*x**4+142*x**2-34*x*
     #*3+34*x+90*x**5+18)/x/(x-1)/(x+1)*z2+(104666*x**4-172580*x**3+1724
     #04*x**2-148507*x+56581)/(x-1)/x/216)*dlog(x)-72*(x**3-x**2+2*x-1)/
     #x*dlog(-x+1)**3
      s1 = s3+(2800*x**3-3102*x**2+3309*x-2800)/x*dlog(-x+1)**2/9+(-(-43
     #7*x**3+501*x**2-344*x+172+162*x**4)/(x-1)/x*Li2(x)/12+(1242*x**4-2
     #597*x**3+3741*x**2-3584*x+1252)/(x-1)/x*z2/12-(61243*x**3-57021*x*
     #*2+71079*x-62683)/x/108)*dlog(-x+1)+(27.D0/2.D0*(3*x**2+2*x+1)/x/(
     #x+1)*Li2(x**2)-9*(4*x**4+8*x**3+21*x**2+14*x+7)/x/(x+1)*Li2(x)+9.D
     #0/2.D0*(8*x**4+16*x**3+33*x**2+22*x+11)/(x+1)/x*z2)*dlog(x+1)
      t0 = s1+3.D0/4.D0*(11*x**3+21*x**2-12*x-14)/x*Li2(x**2)+(3287*x**4
     #-6965*x**3+2454*x**2+9236*x-8219)/(x-1)/x*Li2(x)/36+(-2768*x**3+28
     #76*x+2547*x**2+270*x**5-2429*x**4-604)/x/(x-1)/(x+1)*S12(x)/12+9*(
     #4*x**4+8*x**3+21*x**2+14*x+7)/(x+1)/x*S12(-x)-18*(x**2+1+x)**2/(x+
     #1)/x*S12(x**2)-(-4057*x**4-1396*x**3+3885*x**2+1720*x+1468+324*x**
     #5)/x/(x-1)/(x+1)*Li3(x)/12-9.D0/8.D0*(8*x**4+8*x**3-3*x**2-2*x-1)/
     #x/(x+1)*Li3(x**2)-(12705*x**4-21987*x**3+14733*x**2-6938*x+1280)/(
     #x-1)/x*z2/36-(-320*x**4+421*x**3-615*x**2-1474*x+71+891*x**5)/x/(x
     #-1)/(x+1)*z3/6+(521789*x**3-631884*x**2+602823*x-459176)/x/1296+(-
     #69*(x**3-x**2+2*x-1)/x*dlog(-x+1)+253.D0/8.D0*(x-1)**3/x+69.D0/2.D
     #0*(x**2-x+1)**2/(x-1)/x*dlog(x))*Lr
      xnnlo=t0
      xggrNN = xnnlo*alphas**2+xnlo*alphas
      end



      double precision function xggrN(x)
      double precision x, xlo, xnlo, xnnlo, xnlosoft, xnlohard
      double precision xnnlosoft, xnnlohard, t0
      double precision pi, z2, z3, L, Lt, Lr, alphas, z4, NF
      double precision Li2, Li3, S12
      double precision s1,s2,s3,s4,s5,s6,s7,s8,s9,s10
      double precision s11,pp12,s13,s14,s15,s16,s17,s18,s19,s20
      common /xsection/ L, Lt, Lr, alphas, NF 
      common /consts/ pi, z2, z3
      z4=1.082323234
      xnlo= -12*(x**3-x**2+2*x-1)/x*dlog(-x+1)+6*(x**2-x+1)**2/(x-1
     &     )/x*dlog(x)+6*(x**3-x**2+2*x-1)/x*L+11.D0/2.D0*(x-1)**3/x
      xggrN = xnlo*alphas
      end


C ----  qi - qj channel 
      doubleprecision function xqqprime(x)
      doubleprecision x
      double precision pi, z2, z3, L, Lt, Lr, alphas
      double precision Li2, Li3, S12, NF
      double precision s1,s2,s3,s4,s5,s6,s7,s8,s9,s10
      external Li2, Li3, S12
      common /xsection/ L, Lt, Lr, alphas, NF 
      common /consts/ pi, z2, z3       
      xqqprime=((-4.D0/9.D0*(x+2)**2/x*dlog(x)+8.D0/9.D0*(x+3)*(x-1)/x)
     #     *L**2
     #+(-16.D0/9.D0*(x+2)**2/x*Li2(x)-4.D0/9.D0*(x+2)**2/x*dlog(x)**2+4.
     #D0/9.D0*(-12+5*x**2+8*x)/x*dlog(x)-32.D0/9.D0*(x+3)*(x-1)/x*dlog(-
     #x+1)+16.D0/9.D0*(x+2)**2/x*z2+2.D0/3.D0*(5*x+17)*(x-1)/x)*L-8.D0/3
     #.D0*(x+2)**2/x*dlog(x)*Li2(x)-8.D0/9.D0*(4*x+x**2-6)/x*Li2(x)+32.D
     #0/9.D0*(x+2)**2/x*Li3(x)-32.D0/9.D0*(x+2)**2/x*S12(x)-4.D0/27.D0*(
     #x+2)**2/x*dlog(x)**3+8.D0/9.D0*(4*x-3+x**2)/x*dlog(x)**2-16.D0/3.D
     #0*(x+3)*(x-1)/x*dlog(-x+1)*dlog(x)+8.D0/9.D0*(x+2)**2/x*z2*dlog(x)
     #+2.D0/9.D0*(44*x-59+29*x**2)/x*dlog(x)+32.D0/9.D0*(x+3)*(x-1)/x*dl
     #og(-x+1)**2-4.D0/3.D0*(5*x+17)*(x-1)/x*dlog(-x+1)-8.D0/9.D0*(-6+3*
     #x**2+4*x)/x*z2+2.D0/9.D0*(11*x+105)*(x-1)/x)*alphas**2
        return
      end





C -----  quark-quark channel

      double precision function xqqNN(x)
      double precision x
      double precision pi, z2, z3, L, Lt, Lr, alphas
      double precision Li2, Li3, S12, NF
      double precision s1,s2,s3,s4,s5,s6,s7,s8,s9,s10
      common /xsection/ L, Lt, Lr, alphas, NF 
      common /consts/ pi, z2, z3       

      s2 = (-4.D0/9.D0*(x+2)**2/x*dlog(x)+8.D0/9.D0*(x+3)*(x-1)/x)*L**2+
     #(-16.D0/9.D0*(x+2)**2/x*Li2(x)-4.D0/9.D0*(x+2)**2/x*dlog(x)**2+4.D
     #0/9.D0*(-12+5*x**2+8*x)/x*dlog(x)-32.D0/9.D0*(x+3)*(x-1)/x*dlog(-x
     #+1)+16.D0/9.D0*(x+2)**2/x*z2+2.D0/3.D0*(5*x+17)*(x-1)/x)*L-16.D0/2
     #7.D0*(17*x+5*x**2+19)/x*dlog(x)*Li2(x)-8.D0/9.D0*(4*x+x**2-6)/x*Li
     #2(x)+8.D0/27.D0*(46*x+50+13*x**2)/x*Li3(x)-32.D0/9.D0*(x+2)**2/x*S
     #12(x)-4.D0/27.D0*(x+2)**2/x*dlog(x)**3-4.D0/27.D0*(x**2-2*x+2)/x*d
     #log(x)**2*dlog(-x+1)
      s1 = s2+4.D0/27.D0*(26*x-18+9*x**2)/x*dlog(x)**2-16.D0/3.D0*(x+3)*
     #(x-1)/x*dlog(-x+1)*dlog(x)+8.D0/9.D0*(x+2)**2/x*z2*dlog(x)+2.D0/27
     #.D0*(124*x+69*x**2-177)/x*dlog(x)+32.D0/9.D0*(x+3)*(x-1)/x*dlog(-x
     #+1)**2-4.D0/3.D0*(5*x+17)*(x-1)/x*dlog(-x+1)-8.D0/9.D0*(-6+3*x**2+
     #4*x)/x*z2-8.D0/27.D0*(x**2-2*x+2)/x*z3+4.D0/27.D0*(27*x+160)*(x-1)
     #/x

      s2 = alphas**2

      xqqNN= s1*s2
        return
      end



C------  quark-qbar channel

      doubleprecision function xqqbN(x)
      doubleprecision x
      double precision pi, z2, z3, L, Lt, Lr, alphas
      double precision Li2, Li3, S12, NF
      external Li2, Li3, S12
      common /xsection/ L, Lt, Lr, alphas, NF 
      common /consts/ pi, z2, z3
C      print*, L, Lr
        xqqbN = -32.D0/27.D0*(x-1)**3/x*alphas
        return
      end




      doubleprecision function xqqbNN(x)
      doubleprecision x
      double precision pi, z2, z3, L, Lt, Lr, alphas
      double precision Li2, Li3, S12, NF
      double precision s1,s2,s3,s4,s5,s6,s7,s8,s9,s10
      external Li2, Li3, S12
      common /xsection/ L, Lt, Lr, alphas, NF 
      common /consts/ pi, z2, z3       
      s1 = -32.D0/27.D0*(x-1)**3/x*alphas
      s4 = (16.D0/27.D0*Lr*(x-1)**3/x+16.D0/81.D0*(4*x**3-3-12*x**2+15*x
     #)/x*dlog(x)+8.D0/243.D0*(x-1)*(41*x**2-88*x+23)/x-32.D0/81.D0*(x-1
     #)**3/x*dlog(-x+1))*NF-2.D0/81.D0*(135-2111*x**2+1448*x+768*x**3)/x
     #*dlog(x)-4.D0/81.D0*(x-1)*(783*x**2-1925*x+373)/x-4.D0/27.D0*(x+2)
     #**2/x*dlog(x)**3+8.D0/81.D0*(10*x**3+12-87*x**2+42*x)/x*Li2(x)+32.
     #D0/9.D0*(x+2)**2/x*Li3(x)-32.D0/9.D0*(x+2)**2/x*S12(x)-8.D0/81.D0*
     #(27+44*x**3+39*x-81*x**2)/x*dlog(x)**2-8.D0/9.D0*(x**2+2*x+2)/x*Li
     #3(-x)+(-4.D0/9.D0*(x+2)**2/x*dlog(x)+8.D0/9.D0*(x+3)*(x-1)/x)*L**2
     #+4.D0/81.D0*(x-1)*(384*x**2-967*x-75)/x*dlog(-x+1)-16.D0/27.D0*(x*
     #*2+2*x+2)/x*z3+16.D0/81.D0*(5-102*x**2+75*x+47*x**3)/x*z2
      s5 = s4+16.D0/81.D0*(x-1)*(37*x**2-101*x-44)/x*dlog(-x+1)*dlog(x)+
     #(2.D0/81.D0*(x-1)*(263*x+459)/x+16.D0/9.D0*(x+2)**2/x*z2-4.D0/81.D
     #0*(-141*x**2+64*x**3+24*x+108)/x*dlog(x)+32.D0/81.D0*(x-1)*(8*x**2
     #-25*x-19)/x*dlog(-x+1)-16.D0/9.D0*(x+2)**2/x*Li2(x)-4.D0/9.D0*(x+2
     #)**2/x*dlog(x)**2)*L+(32.D0/27.D0+32.D0/9.D0*x**2+16.D0/27.D0*x)*L
     #i2(-x)-8.D0/27.D0*(x**2+2*x+2)*z2/x*dlog(x+1)+8.D0/9.D0*(x+2)**2/x
     #*z2*dlog(x)-8.D0/3.D0*(x+2)**2/x*dlog(x)*Li2(x)
      s3 = s5-32.D0/81.D0*(x-1)*(13*x**2-35*x-14)/x*dlog(-x+1)**2-8.D0/2
     #7.D0*(x**2+2*x+2)/x*dlog(x)*dlog(x+1)**2+4.D0/9.D0*(x**2+2*x+2)/x*
     #dlog(x)**2*dlog(x+1)+8.D0/9.D0*(x**2+2*x+2)/x*dlog(x)*Li2(-x)-16.D
     #0/27.D0*(x**2+2*x+2)/x*Li2(-x)*dlog(x+1)+(32.D0/27.D0+32.D0/9.D0*x
     #**2+16.D0/27.D0*x)*dlog(x)*dlog(x+1)-16.D0/27.D0*(x**2+2*x+2)/x*S1
     #2(-x)-88.D0/9.D0*Lr*(x-1)**3/x
      s4 = alphas**2
      s2 = s3*s4
      xqqbNN = s1+s2
        return
      end




C------ Quark-gluon channel

      doubleprecision function xqgN(x)
      implicit none
      double precision x, tmp
      double precision pi, z2, z3, L, Lt, Lr, alphas, NF
      double precision Li2, Li3, S12
      common /xsection/ L, Lt, Lr, alphas, NF 
      common /consts/ pi, z2, z3

      tmp =0d0 
      tmp = tmp -2.D0/3.D0*(x**2-2*x+2)/x*L
      tmp = tmp -(x**2-6*x+3)/x/3
      tmp = tmp -2.D0/3.D0*(x**2-2*x+2)/x*dlog(x)
      tmp = tmp +4.D0/3.D0*(x**2-2*x+2)/x*dlog(1-x)        

       tmp = tmp*alphas
       xqgN = tmp
       
      end




c The options were    : operatorarrow
      doubleprecision function xqgNN(x)
      doubleprecision x
      double precision pi, z2, z3, L, Lt, Lr, alphas, NF
      double precision Li2, Li3, S12
      double precision s1,s2,s3,s4,s5,s6,s7,s8,s9,s10
      external Li2, Li3, S12
      common /xsection/ L, Lt, Lr, alphas, NF 
      common /consts/ pi, z2, z3
      s5 = (-(67*x**2+64*x+54)/x*dlog(x)**2/9+106.D0/9.D0*(x**2-2*x+2)/x
     #*dlog(x)*dlog(-x+1)-2*(x**2+2*x+2)/x*dlog(x)*dlog(x+1)-31.D0/3.D0*
     #(x**2-2*x+2)/x*dlog(-x+1)**2-11.D0/2.D0*(x**2-2*x+2)/x*Lr+(400*x**
     #3+33*x**2+1470*x-1080)/x*dlog(x)/54-(72*x**3+101*x**2+418*x-489)/x
     #*dlog(-x+1)/9-2.D0/9.D0*(81*x**2+162*x+46)/x*Li2(x)-2*(x**2+2*x+2)
     #/x*Li2(-x)+2.D0/9.D0*(89*x**2+128*x+62)*z2/x+(784*x**3+3105*x**2+1
     #2978*x-21925)/x/324)*L-(292*x**3-144*x**2+738*x-221)*z2/x/27-(784*
     #x**3+2646*x**2+17172*x-23671)/x*dlog(-x+1)/162+(288*x**3+111*x**2+
     #2278*x-2592)/x*dlog(-x+1)**2/36
      s4 = s5-(652*x**3+363*x**2+4956*x-5935)/x*dlog(x)*dlog(-x+1)/54-3*
     #(x**2+2*x+2)/x*dlog(x)**2*dlog(x+1)+2*(x**2+2*x+2)/x*dlog(x)*dlog(
     #x+1)**2+(6148*x**3+7179*x**2+197580*x-210115)/x/1944
      s5 = s4+6*(x**2+2*x+2)*z2/x*dlog(x+1)+107.D0/18.D0*(x**2-2*x+2)/x*
     #dlog(x)**2*dlog(-x+1)-115.D0/9.D0*(x**2-2*x+2)/x*dlog(x)*dlog(-x+1
     #)**2+(-11.D0/2.D0*(x**2-2*x+2)/x*dlog(x)+11*(x**2-2*x+2)/x*dlog(-x
     #+1)-11.D0/4.D0*(x**2-6*x+3)/x)*Lr
      s3 = s5+(-2.D0/9.D0*(x**2-2*x+2)/x*L**2+(x**2-2*x+2)/x*dlog(x)**2/
     #9-2.D0/9.D0*(x**2-2*x+2)/x*dlog(x)*dlog(-x+1)+(x**2-2*x+2)/x*dlog(
     #-x+1)**2/18+((x**2-2*x+2)/x*Lr/3-(x**2-2*x+2)/x*dlog(x)/9+4.D0/9.D
     #0*(x**2-2*x+2)/x*dlog(-x+1)+(29*x**2-22*x+31)/x/54)*L+((x**2-2*x+2
     #)/x*dlog(x)/3-2.D0/3.D0*(x**2-2*x+2)/x*dlog(-x+1)+(x**2-6*x+3)/x/6
     #)*Lr+(19*x**2-38*x+29)/x*dlog(x)/27-(9*x**2-16*x+13)/x*dlog(-x+1)/
     #9+(179*x**2-418*x+265)/x/162)*NF-59.D0/9.D0*(x**2-2*x+2)*z2/x*dlog
     #(-x+1)+(x**2-2*x+2)/x*dlog(-x+1)*Li2(x)+4.D0/9.D0*(32*x**2+35*x+13
     #)*z2/x*dlog(x)+(x**2+2*x+2)/x*Li3(x**2)/2
      s4 = s3+4*(x**2+2*x+2)/x*Li2(-x)*dlog(x+1)-4*(x**2+2*x+2)/x*Li2(x)
     #*dlog(x+1)-4*(x**2+2*x+2)/x*dlog(x)*Li2(-x)-(4*x**3+33*x**2+222*x+
     #166)/x*dlog(x)*dlog(x+1)/27+8*(x**2+2*x+2)/x*S12(-x)+(148*x**3-711
     #*x**2-876*x+2605)/x*Li2(x)/54-(281*x**2+446*x+214)/x*dlog(x)*Li2(x
     #)/9-(4*x**3+33*x**2+222*x+166)/x*Li2(-x)/27
      s2 = s4+(339*x**2+474*x+302)/x*Li3(x)/9+(2464*x**3+5955*x**2+28800
     #*x-24418)/x*dlog(x)/324+367.D0/54.D0*(x**2-2*x+2)/x*dlog(-x+1)**3-
     #(269*x**2+614*x+74)/x*S12(x)/9+(226*x**3-234*x**2+1464*x-837)/x*dl
     #og(x)**2/54+(-2.D0/9.D0*(28*x**2+25*x+27)/x*dlog(x)+31.D0/9.D0*(x*
     #*2-2*x+2)/x*dlog(-x+1)+(36*x**3+91*x**2+92*x-147)/x/18)*L**2-2*(x*
     #*2+2*x+2)/x*S12(x**2)+2.D0/9.D0*(45*x**2-81*x+46)*z3/x-(145*x**2+1
     #42*x+108)/x*dlog(x)**3/54
      s3 = alphas**2
      s1 = s2*s3
      s2 = (-2.D0/3.D0*(x**2-2*x+2)/x*L-2.D0/3.D0*(x**2-2*x+2)/x*dlog(x)
     #+4.D0/3.D0*(x**2-2*x+2)/x*dlog(-x+1)-(x**2-6*x+3)/x/3)*alphas**1
      xqgNN = s1+s2

        return
      end



      
