ccccccccccccccccccccccccc     Program 5.4     cccccccccccccccccccccccccc
c
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c                                                                      c
c Please Note:                                                         c
c                                                                      c
c (1) This computer program is part of the book, "An Introduction to   c
c     Computational Physics," written by Tao Pang and published and    c
c     copyrighted by Cambridge University Press in 1997.               c
c                                                                      c
c (2) No warranties, express or implied, are made for this program.    c
c                                                                      c
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
      SUBROUTINE LGND(LMAX,X,P)
C
C Subroutine to generate Legendre polynomials P_L(X)
C for L = 0,1,...,LMAX with given X.
C
      DIMENSION P(0:LMAX)
      P(0) = 1.
      P(1) = X
      DO 100 L = 1, LMAX-1
        P(L+1) = ((2.0*L+1)*X*P(L)-L*P(L-1))/(L+1)
  100 CONTINUE
      RETURN
      END
