
c
c
c
c     =====================================================
       subroutine qinit(maxmx,maxmy,meqn,mbc,mx,my,xlower,ylower,
     &                   dx,dy,q,maux,aux)
c     =====================================================
c
c     # Set initial conditions for q.
c
       implicit double precision (a-h,o-z)
       dimension q(1-mbc:maxmx+mbc, 1-mbc:maxmy+mbc, meqn)
       dimension aux(1-mbc:maxmx+mbc, 1-mbc:maxmy+mbc, maux)
       common /comic/ x1,y1,z1
c
       pi = 4.d0*datan(1.d0)

       do 20 i=1,mx
	  xc = xlower + (i-0.5d0)*dx
          do 20 j=1,my
	     yc = ylower + (j-0.5d0)*dy
 	     call mapc2m(xc,yc,xp,yp,zp)

             q(i,j,1) = 1.d0
             q(i,j,2) = 0.d0
             q(i,j,3) = 0.d0
             q(i,j,4) = 0.d0

c            # add a Gaussian peak:
             d = dsqrt((xp-x1)**2 + (yp-y1)**2 + (zp-z1)**2)
             d = 1.d0 - (xp*x1 + yp*y1 + zp*z1)
             q1 = 2.d0*dexp(-40.d0*d**2)
             if (q1 .gt. 1.d-10) then
                q(i,j,1) = q(i,j,1) + q1
                endif
           
  20         continue
       return
       end
