



      subroutine gausslegendre(n,size,x,w)

      implicit none
      integer size
      real x(size),w(size)
      integer n

      if(n.gt.size)then
	write(6,*)' too many points '
        return
      endif

      if(n.eq.2)then
	x(1) = 0.577350269189626
        x(2) = - x(1)

        w(1) = 1.00000
        w(2) = 1.00000

        return
      endif

      if(n.eq.3)then
        x(1) = 0.0
        x(2) = 0.774596669241483
        x(3) = -x(2)

        w(1) = 0.888888888888889
        w(2) = 0.555555555555556
        w(3) = w(2)

        return 
      endif

      if(n.eq.4)then 
        x(1) = 0.339981043584856
        x(2) = 0.861136311594053
        x(3) = -x(1)
        x(4) = -x(2)

        w(1) = 0.652145154862546
        w(2) = 0.347854845137454          
        w(3) = w(1)
        w(4) = w(2)
        return
      endif

     
      print*,' that value of n not coded '
      stop

      end
