      subroutine gengrid(nreal,maxpoints,ngridtype,nscf,ncenters,nconts,
     &                   ncontp,ncontd,ilfunc,icfunc,ngauss,nptrs,nptrp,
     &                   nptrd,natomtype,nptsatom,iwkvec,cent,alpha,
     &                   coeff,wkvec)

c  this subroutine written by alain st-amant of the department of
c  pharmaceutical chemistry, university of california, san francisco.
c  all rights reserved.  this is part of the DeFT project.

      implicit real*8(a-h,o-z)

      dimension ilfunc(*),icfunc(*),ngauss(*),nptrs(*),nptrp(*),nptrd(*)
      dimension natomtype(*),nptsatom(*),iwkvec(*)

      dimension cent(3,*),alpha(*),coeff(*),wkvec(*)

      ja=1
      jb=ja+maxpoints
      jc=jb+maxpoints
      jd=jc+maxpoints
      je=jd+maxpoints
      jf=je+ncenters*maxpoints
      jg=jf+ncenters*ncenters
      jh=jg+ncenters

      ji=jh+ncenters

      if(ji.gt.nreal) stop 'real overflow in gengrid'

      call gridgen(ngridtype,nscf,ncenters,nconts,ncontp,ncontd,ilfunc,
     &             icfunc,ngauss,nptrs,nptrp,nptrd,natomtype,nptsatom,
     &             iwkvec,cent,alpha,coeff,wkvec(ja),wkvec(jb),
     &             wkvec(jc),wkvec(jd),wkvec(je),wkvec(jf),wkvec(jg),
     &             wkvec(jh))

      return
      end
