C     ***********************
C     *  SUBROUTINE PV1232  *
C     ***********************
C
      SUBROUTINE PV1232(SXI,SX2,SZ2,ND1,P,V,OM,NI,NJ,IND,NCF)
C
      IMPLICIT REAL*8(A-H,L,O-Z)
      COMPLEX*16 P(ND1,ND1),V(ND1,ND1)
      DIMENSION SXI(ND1),SX2(ND1),SZ2(ND1),NCF(10)
      COMMON /CONS/ RT,VR,DV,FW,VS1,VS2,DN1,DN2,Q1,Q2
     *       / XZ / FX0(10),FZ0(10),DA(10),NFLT
     *       /EXTE/ SS,XN,ZN,A1,A2,A3,A4
     *       /GAUSS/NG / QF / NQF
C
      IF(IND.EQ.1) THEN
        VS=VS1
        DN=DN1
        QF=Q1
      ELSE
        VS=VS2
        DN=DN2
        QF=Q2
      END IF
C
      SS=OM/VS
C
      DO 200 I=1,NI
C
        XI=(SXI(I)+SXI(I+1))*.5D0
        ZI=0.D0
C
        DO 100 J=1,NJ
C
          XJ1=SX2(J)
          ZJ1=SZ2(J)
          XJ2=SX2(J+1)
          ZJ2=SZ2(J+1)
C
          LXJ=XJ2-XJ1
          LZJ=ZJ2-ZJ1
          LJ=DSQRT(LXJ*LXJ+LZJ*LZJ)
C
          RX1=XJ1-XI
          RZ1=ZJ1-ZI
          R1 =DSQRT(RX1*RX1+RZ1*RZ1)
          RX2=XJ2-XI
          RZ2=ZJ2-ZI
          R2 =DSQRT(RX2*RX2+RZ2*RZ2)
C
          IF(IND.EQ.1) THEN
            XN=-LZJ/LJ
            ZN=+LXJ/LJ
          ELSE
            XN=+LZJ/LJ
            ZN=-LXJ/LJ
          END IF
C
          A1=(RX2-RX1)/LJ
          A2=RX1
          A3=(RZ2-RZ1)/LJ
          A4=RZ1
C
          CALL GAUSPV(0.D0,LJ,NG,PSPR,PSPI,VSPR,VSPI,IER)
          PY1=0.25D0*SS*PSPR
          PY2=0.25D0*SS*PSPI
          VY1=-0.25D0/(VS*VS*DN)*VSPR
          VY2=-0.25D0/(VS*VS*DN)*VSPI
C
          AQF=1.D0
          IF(NQF.NE.0)THEN
          RR=(R1+R2)*0.5D0
          AQF=DEXP(-OM*RR/(2.D0*QF*VS))
          END IF
          P(I,J)=DCMPLX(PY1,PY2)*AQF
          V(I,J)=DCMPLX(VY1,VY2)*AQF
C
  100   CONTINUE
  200 CONTINUE
C
C     *****  CHECKER'S FLAG NO.2  *****
C
      IF(NCF(2).EQ.1) THEN
      WRITE(6,*) ' *****  MATRIX P1232  *****'
      WRITE(6,*) ((P(I,J),J=1,NJ),I=1,NI)
      WRITE(6,*) ' *****  MATRIX V1232  *****'
      WRITE(6,*) ((V(I,J),J=1,NJ),I=1,NI)
      END IF
C
      RETURN
      END
