Next: 11.2.9 grid_obtain_gradwt: obtain a Up: 11.2 Using the grid Previous: 11.2.7 grid_get_size: report size

11.2.8 grid_obtain: obtain a block of grid points

      subroutine grid_obtain(iatom,npt,xyz,wt,jwt,coord)
      implicit double precision (a-h,o-z)
      logical coord
      dimension xyz(3,*), wt(*)
Obtain a block of grid points and weights.
iatom
if non-zero, only grid points belonging to that atom are returned.
npt
on entry, the maximum number of points to return, and on exit the actual number; $\verb*+npt+=0$ means no further points. The first point to be returned is the one after the last of the last call to this routine, unless that returned $\verb*+npt+=0$, in which case it is the first point. Thus successive calls to this routine have the effect of reading sequentially through the grid.
xyz
on exit, the cartesian coordinates of the grid points.
wt
on exit, the integration weights.
jwt
on entry, which type of weight is wanted: 0 no voronoi, -1 full molecule voronoi, $j\gt0$ voronoi with atom $j$
coord
if false on entry, do not fill the array xyz.

Note that the grid is returned sequentially within each atom, but it is possible to take individual atoms in any order. Note also that at the first call for an atom, grid_obtain allocates memory internally, which persists for the benefit of later calls. Thus when an atom is done, the calling routine should take steps to release the stack.

The following is a complete code fragment which will read through the whole molecular grid.

      include "common/big"
      include "common/cgeom"
      nblock=128
      ipt=icorr(nblock*3)
      iwt=icorr(nblock)
      call grid_open(record)
      do icen=1,ncen
        ibase = icorr(0)
        do iblock=1,2**30     ! effectively an infinite loop
          npt=nblock
          call grid_obtain (icen,npt,q(ipt),q(iwt),-1,.true.)
          if (npt.le.0) goto 448
          write (iout,449) 'X',(q(ipt-3+i*3),i=1,npt)
          write (iout,449) 'Y',(q(ipt-2+i*3),i=1,npt)
          write (iout,449) 'Z',(q(ipt-1+i*3),i=1,npt)
          write (iout,449) 'W',(q(iwt-1+i),i=1,npt)
          write (iout,*) ' '
 449      format(1x,a,8f15.8)
        end  do
 448    call corlsr(ibase)
      end do
      call corlsr(ipt)


Next: 11.2.9 grid_obtain_gradwt: obtain a Up: 11.2 Using the grid Previous: 11.2.7 grid_get_size: report size

P.J. Knowles and H.-J. Werner
molpro-support@tc.bham.ac.uk
Jan 10, 2000