1      Subroutine qdist(rq0, rq, qxyz, xyz, nq, ncenters)
2c
3C$Id$
4c
5      implicit none
6      integer nq, ncenters
7c
8c     Distance Squared Between Quadrature Points & Integration Centers
9c
10      double precision rq(nq,ncenters)
11      double precision rq0(ncenters)
12c
13c     Cartesian Coordinates of Quadrature Points
14c
15      double precision qxyz(3,nq)
16c
17c     Cartesian Coordinates of Integration Centers
18c
19      double precision xyz(3,ncenters)
20c
21c     Evaluate the distances (squared) between each center and the
22c     sampling points.
23c
24      integer m, n
25      double precision r2min, x, y, z, r2
26c
27      do 20 m = 1, ncenters
28         r2min = 1.D+06
29         do 10 n = 1, nq
30            x = qxyz(1,n) - xyz(1,m)
31            y = qxyz(2,n) - xyz(2,m)
32            z = qxyz(3,n) - xyz(3,m)
33            r2 = x*x + y*y + z*z
34            r2min = min(r2,r2min)
35            rq(n,m) = r2
36   10    continue
37         rq0(m) = r2min
38   20 continue
39      return
40      end
41