      SUBROUTINE ESELF(CMETHD,CXZP,NX,NY,NZ,AKD,CXZC,CXZW,CXZE)
C Arguments:
      CHARACTER*6 CMETHD
      REAL AKD
      INTEGER NX,NY,NZ
      COMPLEX CXZC(NX+1,NY+1,NZ+1,6),CXZE(NX,NY,NZ,3),
     &        CXZP(NX,NY,NZ,3),CXZW(2*NX,2*NY,2*NZ,*)
C Local scalars:
      COMPLEX CXEX,CXEY,CXEZ,CXFAC,CXPHAS,CXUNIT,CXXX,CXXY,CXXZ,
     &        CXYY,CXYZ,CXZERO,CXZZ
      REAL FAC,R,R2,R3,WOLD,XX
      INTEGER I,IER,II,IR,ISGN,J,JJ,JR,JSGN,K,KR,KSGN,M,NGRID
C Local arrays:
      REAL X(3)
      INTEGER ISYM(3),NN(3)
C
      EXTERNAL C3DFFT,EXTND,FOURX,PAD,TRIM
      INTRINSIC EXP,MIN,NINT,SIGN,SQRT
      SAVE CXUNIT,CXZERO,NN,NGRID,WOLD
***********************************************************************
C
C       Given the dipole moments, CXZP, at all points on
C       a rectangular grid,oscillating at frequency AKD,
C       compute the electric field amplitude, CXZE,
C       at each point produced by all the other dipoles except the one
C       at that point.
C       The relationship between the dipoles and the field
C       values at the grid points can be expressed as a convolution,
C       and the convolution is efficiently evaluated using 3D FFTs.
C
C       3-dimensional FFT is performed using either
C       a) FOURX code by  N. Brenner + slight PJF mods
C          Works with either MXMEM=0 or 1 in DDSCAT.f
C          Select CMETHD='BRENNR' (in the DDSCAT parameter file)
C       b) CXFFT3 interface to Temperton's CFFT99F code.
C          This option is more suitable for vector machines
C          (CRAY) but takes (8*nx*ny*nz) more memory in comparison
C          with FOURX.  It also requires that NX,NY,NZ each be of form
C          (2**I)*(3**J)*(5**K), for integer I,J,K.  Subroutine EXTEND
C          takes care of choosing suitable NX,NY,NZ.
C          *** Requires that DDSCAT be compiled with MXMEM=1 ***
C          Select CMETHD='TMPRTN' (in the DDSCAT parameter file).
C       c) Native 3d FFT routine in Convex vector library.
C          This option is available only on Convex hardware, and
C          linking must be done with -lveclib option (see the Makefile).
C          This also requires that NX,NY,NZ be of form
C          (2**I)*(3**J)*(5**K); subroutine EXTEND takes care of choosing
C          suitable NX,NY,NZ.
C          Works with either MXMEM=0 or 1 in DDSCAT.f
C          Select CMETHD='CONVEX' (in the DDSCAT parameter file).
C       d) CXFFT3N interface to GPFA code of Temperton. 
C          Good points: 
C             -On CRAY the code is on average 30-40% faster in comparison
C              to TMPRTN (and 10-15 faster in comparison to BRENNR)
C             -On scalar machines the code is 2-8 faster in comparison
C              to BRENNR or TMPRTN
C             -Doesn't require additional storage
C          Problems:
C              -Requires that NX,NY,NZ be of form (2**I)*(3**J)*(5**K); 
C               subroutine EXTEND takes care of choosing suitable NX,NY,NZ.
C              -The code is NOT ON PUBLIC DOMAIN and we do not distribute it.
C              -The choice of "lvr" variable in gpfa2f, gpfa3f, gpfa5f
C               depends on machine. WARNING: on C90 use lvr=128, on
C               all other CRAY's use lvr=64; wrong lvr will produce WRONG
C               RESULTS. On scalar machines lvr depends on cache length
C               but the bad choice degrades performance but still produces
C               correct results.
C        
C       INPUT:
C       CXZP(I,J,K,L)   Lth cartesian component of the dipole
C                       moment at the grid point (I,J,K);
C                       the DIMENSIONed length of CXZP in
C                       the calling routine is CXZP(NX,NY,NZ,3)
C                       [or CXZP(NX*NY*NZ,3) or CXZP(3*NX*NY*NZ)]
C
C       NX,NY,NZ        Size of grid in x,y,z directions (INTEGER).

C       AKD             Frequency of oscillation of dipoles and electric
C                       field; also absolute value of wave vector of
C                       incident wave [c=1]  (REAL*4).

C       CXZC            (NX+1) by (NY+1) by (NZ+1) by 6 array of Green
C                       function coefficients used
C                       internally by ESELF and
C                       *************NOT TO BE OVERWRITTEN***********
C                       between calls, because these coefficients are
C                       recomputed only if W has changed since the last
C                       call to ESELF.

C       CXZW            Complex, scratch-space vector of length:
C                       2*NX*2*NY*2*NY*3   --- for  FOURX FFT
C                       2*NX*2*NY*2*NZ*4   --- for CXFFT3 solver
C                       See comment about FFT usage and CMETHD
C                       flag.
C                       Can be overwritten between calls to ESELF

C       OUTPUT:

C       CXZE(I,J,K,L)   Lth component of dipole-induced electric field
C                       at grid point (I,J,K);
C                       the DECLARED length of ZE in the calling
C                       program is CXZE(NX,NY,NZ,3)
C                       [or CXZE(NX*NY*NZ,3) or CXZE(3*NX*NY*NZ)]
C
C Written by Jeremy J. Goodman, Princeton Univ. Observatory, 90.09.22
C History:
C 90.11.29 (BTD): Modified to set untransformed ZC(1,1,1,1-6)=0.
C 90.11.29 (PJF): Modified to use FOURX and CXFFT99
C 90.12.05 (BTD): Modified for new ordering of elements of polarization
C                 and electric field vectors in calling program.  Modified
C                 ESELF and PAD to remove distinction between NX,NY,NZ
C                 and dimensions CXZE and CXZP, since our new ordering
C                 always assumes this.
C 90.12.13 (BTD): Modified to include CONVEX option.
C 92.04.20 (BTD): removed ISYM from argument list of TRIM (was not used)
C 94.06.20 (PJF): modified to call CXFFT3N when CMETHD='NEWTMP'
C 96.10.18 (BTD): changed NEWTMP to GPFAFT
C 99.04.26 (BTD): changed notation CXY -> CXZE for clarity
C
C Copyright (C) 1993,1994,1996,1999 B.T. Draine and P.J. Flatau
C This code is covered by the GNU General Public License.
C***********************************************************************
      DATA WOLD/-999e-33/,CXUNIT/ (0.,1.)/,CXZERO/(0.,0.)/
C
      IF(AKD.EQ.WOLD)GOTO 70
C
C               AKD.NE.WOLD :
C
C               We have to recompute the
C               Green-function coefficients giving
C               components of field strength at a each grid point R
C               produced by unit-valued component of dipole moment at
C               point R', and then Fourier transform these components.
      WOLD=AKD
      NN(1)=2*NX
      NN(2)=2*NY
      NN(3)=2*NZ
      NGRID=8*NX*NY*NZ
C
C               Compute the actual coefficients:
C
      DO 60 K=1,NZ
         DO 50 J=1,NY
            DO 40 I=1,NX
               IF(I.EQ.1.AND.J.EQ.1.AND.K.EQ.1)GOTO 40
C Note: to use lattice with other than unit spacing in each direction,
C simply multiply RHS of each of next three lines by dx(1),dx(2),dx(3),
C declare real dx(3), and add dx to argument list
C This flexibility has been removed from present code for simplicity.
C 90.11.04 (BTD)
               X(1)=I-1
               X(2)=J-1
               X(3)=K-1
               R2=X(1)**2+X(2)**2+X(3)**2
               R=SQRT(R2)
               R3=R*R2
               CXPHAS=EXP(CXUNIT*AKD*R)
               M=0
               DO 30 II=1,3
                  M=M+1
                  CXFAC=(1.-CXUNIT*AKD*R)/R2
                  CXZC(I,J,K,M)=-CXPHAS/R3*
     &                          (AKD**2*(X(II)**2-R2)+
     &                          CXFAC*(R2-3*X(II)**2))
                  DO 20 JJ=II+1,3
                     M=M+1
                     XX=X(II)*X(JJ)
                     CXZC(I,J,K,M)=-CXPHAS/R3*
     &                             (AKD**2*XX-CXFAC*(3*XX))
   20             CONTINUE
   30          CONTINUE
   40       CONTINUE
   50    CONTINUE
   60 CONTINUE
C
C Set zero-lag elements to zero (they were skipped above)
      DO 65 M=1,6
         CXZC(1,1,1,M)=CXZERO
   65 CONTINUE
C
C          At this point, zc(i,j,k,*) contains the upper triangular
C          part of the symmetric 3 x 3 matrix giving the electric
C          field at grid point (i,j,k) caused by a dipole at (1,1,1)

C          Fill out zc to twice the size in each grid dimension
C          to accomodate negative lags [periodicity in each dimension is
C          assumed, so (e.g.)
C          nx < i <= 2*nx is equivalent to -nx < i <= 0],
C          exploiting symmetries, and Fourier transform.
C          Store only the first octant of the transform,
C          since the others can be obtained by symmetry.
C
      ISYM(1)=1
      ISYM(2)=1
      ISYM(3)=1
      CALL EXTND(CXZC(1,1,1,1),NX,NY,NZ,ISYM,CXZW(1,1,1,1))
      IF(CMETHD.EQ.'BRENNR')THEN
         CALL FOURX(CXZW(1,1,1,1),NN,3,+1)
      ELSEIF(CMETHD.EQ.'TMPRTN')THEN
         CALL CXFFT3(CXZW(1,1,1,1),2*NX,2*NY,2*NZ,+1,CXZW(1,1,1,4))
      ELSEIF(CMETHD.EQ.'GPFAFT')THEN
         CALL CXFFT3N(CXZW(1,1,1,1),2*NX,2*NY,2*NZ,+1)
      ELSEIF(CMETHD.EQ.'CONVEX')THEN
         CALL C3DFFT(CXZW(1,1,1,1),2*NX,2*NY,2*NZ,2*NX,2*NY,+1,IER)
      ENDIF
C 92.04.20 (BTD) removed ISYM from argument list of TRIM:
C      CALL TRIM(CXZW(1,1,1,1),NX,NY,NZ,ISYM,CXZC(1,1,1,1))
      CALL TRIM(CXZW(1,1,1,1),NX,NY,NZ,CXZC(1,1,1,1))
C
      ISYM(1)=-1
      ISYM(2)=-1
      ISYM(3)=1
      CALL EXTND(CXZC(1,1,1,2),NX,NY,NZ,ISYM,CXZW(1,1,1,1))
      IF(CMETHD.EQ.'BRENNR')THEN
         CALL FOURX(CXZW(1,1,1,1),NN,3,+1)
      ELSEIF(CMETHD.EQ.'TMPRTN')THEN
         CALL CXFFT3(CXZW(1,1,1,1),2*NX,2*NY,2*NZ,+1,CXZW(1,1,1,4))
      ELSEIF(CMETHD.EQ.'GPFAFT')THEN
         CALL CXFFT3N(CXZW(1,1,1,1),2*NX,2*NY,2*NZ,+1)
      ELSEIF(CMETHD.EQ.'CONVEX')THEN
         CALL C3DFFT(CXZW(1,1,1,1),2*NX,2*NY,2*NZ,2*NX,2*NY,+1,IER)
      ENDIF
C 92.04.20 (BTD) removed ISYM from argument list of TRIM:
C      CALL TRIM(CXZW(1,1,1,1),NX,NY,NZ,ISYM,CXZC(1,1,1,2))
      CALL TRIM(CXZW(1,1,1,1),NX,NY,NZ,CXZC(1,1,1,2))
C
      ISYM(1)=-1
      ISYM(2)=1
      ISYM(3)=-1
      CALL EXTND(CXZC(1,1,1,3),NX,NY,NZ,ISYM,CXZW(1,1,1,1))
      IF(CMETHD.EQ.'BRENNR')THEN
         CALL FOURX(CXZW(1,1,1,1),NN,3,+1)
      ELSEIF(CMETHD.EQ.'TMPRTN')THEN
         CALL CXFFT3(CXZW(1,1,1,1),2*NX,2*NY,2*NZ,+1,CXZW(1,1,1,4))
      ELSEIF(CMETHD.EQ.'GPFAFT')THEN
         CALL CXFFT3N(CXZW(1,1,1,1),2*NX,2*NY,2*NZ,+1)
      ELSEIF(CMETHD.EQ.'CONVEX')THEN
         CALL C3DFFT(CXZW(1,1,1,1),2*NX,2*NY,2*NZ,2*NX,2*NY,+1,IER)
      ENDIF
C 92.04.20 (BTD) removed ISYM from argument list of TRIM:
C      CALL TRIM(CXZW(1,1,1,1),NX,NY,NZ,ISYM,CXZC(1,1,1,3))
      CALL TRIM(CXZW(1,1,1,1),NX,NY,NZ,CXZC(1,1,1,3))
C
      ISYM(1)=1
      ISYM(2)=1
      ISYM(3)=1
      CALL EXTND(CXZC(1,1,1,4),NX,NY,NZ,ISYM,CXZW(1,1,1,1))
      IF(CMETHD.EQ.'BRENNR')THEN
         CALL FOURX(CXZW(1,1,1,1),NN,3,+1)
      ELSEIF(CMETHD.EQ.'TMPRTN')THEN
         CALL CXFFT3(CXZW(1,1,1,1),2*NX,2*NY,2*NZ,+1,CXZW(1,1,1,4))
      ELSEIF(CMETHD.EQ.'GPFAFT')THEN
         CALL CXFFT3N(CXZW(1,1,1,1),2*NX,2*NY,2*NZ,+1)
      ELSEIF(CMETHD.EQ.'CONVEX')THEN
         CALL C3DFFT(CXZW(1,1,1,1),2*NX,2*NY,2*NZ,2*NX,2*NY,+1,IER)
      ENDIF
C 92.04.20 (BTD) removed ISYM from argument list of TRIM:
C      CALL TRIM(CXZW(1,1,1,1),NX,NY,NZ,ISYM,CXZC(1,1,1,4))
      CALL TRIM(CXZW(1,1,1,1),NX,NY,NZ,CXZC(1,1,1,4))
C
      ISYM(1)=1
      ISYM(2)=-1
      ISYM(3)=-1
      CALL EXTND(CXZC(1,1,1,5),NX,NY,NZ,ISYM,CXZW(1,1,1,1))
      IF(CMETHD.EQ.'BRENNR')THEN
         CALL FOURX(CXZW(1,1,1,1),NN,3,+1)
      ELSEIF(CMETHD.EQ.'TMPRTN')THEN
         CALL CXFFT3(CXZW(1,1,1,1),2*NX,2*NY,2*NZ,+1,CXZW(1,1,1,4))
      ELSEIF(CMETHD.EQ.'GPFAFT')THEN
         CALL CXFFT3N(CXZW(1,1,1,1),2*NX,2*NY,2*NZ,+1)
      ELSEIF(CMETHD.EQ.'CONVEX')THEN
         CALL C3DFFT(CXZW(1,1,1,1),2*NX,2*NY,2*NZ,2*NX,2*NY,+1,IER)
      ENDIF
C 92.04.20 (BTD) removed ISYM from argument list of TRIM:
C      CALL TRIM(CXZW(1,1,1,1),NX,NY,NZ,ISYM,CXZC(1,1,1,5))
      CALL TRIM(CXZW(1,1,1,1),NX,NY,NZ,CXZC(1,1,1,5))
C
      ISYM(1)=1
      ISYM(2)=1
      ISYM(3)=1
      CALL EXTND(CXZC(1,1,1,6),NX,NY,NZ,ISYM,CXZW(1,1,1,1))
      IF(CMETHD.EQ.'BRENNR')THEN
         CALL FOURX(CXZW(1,1,1,1),NN,3,+1)
      ELSEIF(CMETHD.EQ.'TMPRTN')THEN
         CALL CXFFT3(CXZW(1,1,1,1),2*NX,2*NY,2*NZ,+1,CXZW(1,1,1,4))
      ELSEIF(CMETHD.EQ.'GPFAFT')THEN
         CALL CXFFT3N(CXZW(1,1,1,1),2*NX,2*NY,2*NZ,+1)
      ELSEIF(CMETHD.EQ.'CONVEX')THEN
         CALL C3DFFT(CXZW(1,1,1,1),2*NX,2*NY,2*NZ,2*NX,2*NY,+1,IER)
      ENDIF
C 92.04.20 (BTD) removed ISYM from argument list of TRIM:
C      CALL TRIM(CXZW(1,1,1,1),NX,NY,NZ,ISYM,CXZC(1,1,1,6))
      CALL TRIM(CXZW(1,1,1,1),NX,NY,NZ,CXZC(1,1,1,6))
C
C          End of recomputation of Green-function coefficients
C
   70 CONTINUE
C
C       Fourier transform the polarizations:
C
      DO 80 M=1,3
         CALL PAD(CXZP(1,1,1,M),NX,NY,NZ,CXZW(1,1,1,M))
         IF(CMETHD.EQ.'BRENNR')THEN
            CALL FOURX(CXZW(1,1,1,M),NN,3,+1)
         ELSEIF(CMETHD.EQ.'TMPRTN')THEN
            CALL CXFFT3(CXZW(1,1,1,M),2*NX,2*NY,2*NZ,+1,CXZW(1,1,1,4))
        ELSEIF(CMETHD.EQ.'GPFAFT')THEN
           CALL CXFFT3N(CXZW(1,1,1,M),2*NX,2*NY,2*NZ,+1)
         ELSEIF(CMETHD.EQ.'CONVEX')THEN
            CALL C3DFFT(CXZW(1,1,1,M),2*NX,2*NY,2*NZ,2*NX,2*NY,+1,IER)
         ENDIF
C
C***********************************************************************
   80 CONTINUE
C
C       Multiply by F.T. of Green function:
C
      DO 110 K=1,2*NZ
         KSGN=NINT(SIGN(1.,NZ+1.5-K))
         KR=MIN(K,2*NZ+2-K)
         DO 100 J=1,2*NY
            JSGN=NINT(SIGN(1.,NY+1.5-J))
            JR=MIN(J,2*NY+2-J)
            DO 90 I=1,2*NX
               ISGN=NINT(SIGN(1.,NX+1.5-I))
               IR=MIN(I,2*NX+2-I)
               CXXX=CXZC(IR,JR,KR,1)
               CXXY=CXZC(IR,JR,KR,2)*(ISGN*JSGN)
               CXXZ=CXZC(IR,JR,KR,3)*(ISGN*KSGN)
               CXYY=CXZC(IR,JR,KR,4)
               CXYZ=CXZC(IR,JR,KR,5)*(JSGN*KSGN)
               CXZZ=CXZC(IR,JR,KR,6)
               CXEX=CXXX*CXZW(I,J,K,1)+CXXY*CXZW(I,J,K,2)+
     &              CXXZ*CXZW(I,J,K,3)
               CXEY=CXXY*CXZW(I,J,K,1)+CXYY*CXZW(I,J,K,2)+
     &              CXYZ*CXZW(I,J,K,3)
               CXEZ=CXXZ*CXZW(I,J,K,1)+CXYZ*CXZW(I,J,K,2)+
     &              CXZZ*CXZW(I,J,K,3)
               CXZW(I,J,K,1)=CXEX
               CXZW(I,J,K,2)=CXEY
               CXZW(I,J,K,3)=CXEZ
   90       CONTINUE
  100    CONTINUE
  110 CONTINUE
C
C       Inverse Fourier transform to obtain electric field:
C
      DO 150 M=1,3
         IF(CMETHD.EQ.'BRENNR')THEN
            CALL FOURX(CXZW(1,1,1,M),NN,3,-1)
         ELSEIF(CMETHD.EQ.'TMPRTN')THEN
            CALL CXFFT3(CXZW(1,1,1,M),2*NX,2*NY,2*NZ,-1,CXZW(1,1,1,4))
         ELSEIF(CMETHD.EQ.'GPFAFT')THEN
           CALL CXFFT3N(CXZW(1,1,1,M),2*NX,2*NY,2*NZ,-1)
         ELSEIF(CMETHD.EQ.'CONVEX')THEN
            CALL C3DFFT(CXZW(1,1,1,M),2*NX,2*NY,2*NZ,2*NX,2*NY,-1,IER)
         ENDIF
C
C***********************************************************************
C Note: the Convex FFT routine already normalizes result.
C       For other FFT routines need to divide result by NGRID
C
         IF(CMETHD.EQ.'CONVEX')THEN
            DO 118 K=1,NZ
               DO 116 J=1,NY
                  DO 114 I=1,NX
                     CXZE(I,J,K,M)=CXZW(I,J,K,M)
  114             CONTINUE
  116          CONTINUE
  118       CONTINUE
         ELSE
            FAC=1./NGRID
            DO 140 K=1,NZ
               DO 130 J=1,NY
                  DO 120 I=1,NX
                     CXZE(I,J,K,M)=FAC*CXZW(I,J,K,M)
  120             CONTINUE
  130          CONTINUE
  140       CONTINUE
         ENDIF
  150 CONTINUE
C
      RETURN
      END
C***********************************************************************
C
      SUBROUTINE EXTND(CXA,NX,NY,NZ,ISYM,CXB)
C
C       Using symmetries, extend first octant of coefficient matrix to
C       other octants.
C
C Originally written by J.J. Goodman
C
C Copyright (C) 1993, B.T. Draine and P.J. Flatau
C This code is covered by the GNU General Public License.
C***********************************************************************
C Arguments:
      INTEGER NX,NY,NZ
      COMPLEX CXA(NX+1,NY+1,NZ+1),CXB(2*NX,2*NY,2*NZ)
      INTEGER ISYM(3)
C Local variables:
      INTEGER I,J,K
      COMPLEX CXZERO
C SAVE statement:
      SAVE CXZERO
C DATA statement:
      DATA CXZERO/(0.,0.)/
C***********************************************************************
      DO 30 K=1,NZ
         DO 20 J=1,NY
            DO 10 I=1,NX
               CXB(I,J,K)=CXA(I,J,K)
   10       CONTINUE
   20    CONTINUE
   30 CONTINUE
C
      DO 60 K=1,NZ
         DO 50 J=1,NY
            CXB(NX+1,J,K)=CXZERO
            DO 40 I=NX+2,2*NX
               CXB(I,J,K)=CXA(2*NX+2-I,J,K)*ISYM(1)
   40       CONTINUE
   50    CONTINUE
   60 CONTINUE
C
      DO 90 K=1,NZ
         DO 80 I=1,2*NX
            CXB(I,NY+1,K)=CXZERO
            DO 70 J=NY+2,2*NY
               CXB(I,J,K)=CXB(I,2*NY+2-J,K)*ISYM(2)
   70       CONTINUE
   80    CONTINUE
   90 CONTINUE
C
      DO 120 J=1,2*NY
         DO 110 I=1,2*NX
            CXB(I,J,NZ+1)=CXZERO
            DO 100 K=NZ+2,2*NZ
               CXB(I,J,K)=CXB(I,J,2*NZ+2-K)*ISYM(3)
  100       CONTINUE
  110    CONTINUE
  120 CONTINUE
C
      RETURN
      END
C***********************************************************************
C
      SUBROUTINE TRIM(CXB,NX,NY,NZ,CXA)
C
C Copy the first octant of CXB into CXA
C
C Originally written by J.J. Goodman
C History:
C 92.04.20 (BTD) removed ISYM from argument list of TRIM:
C
C Copyright (C) 1993, B.T. Draine and P.J. Flatau
C This code is covered by the GNU General Public License.
C***********************************************************************
C Arguments:
      INTEGER NX,NY,NZ
      COMPLEX CXA(NX+1,NY+1,NZ+1),CXB(2*NX,2*NY,2*NZ)
C Local variables:
      INTEGER I,J,K
C***********************************************************************
      DO 30 K=1,NZ+1
         DO 20 J=1,NY+1
            DO 10 I=1,NX+1
               CXA(I,J,K)=CXB(I,J,K)
   10       CONTINUE
   20    CONTINUE
   30 CONTINUE
      RETURN
      END
C***********************************************************************
C
      SUBROUTINE PAD(CXA,NX,NY,NZ,CXB)
C
C Pad the array CXA with zeros out to twice its length in each
C dimension, and put the result in CXB.
C
C Originally written by J.J. Goodman
C
C Copyright (C) 1993, B.T. Draine and P.J. Flatau
C This code is covered by the GNU General Public License.
C***********************************************************************
C Arguments:
      INTEGER NX,NY,NZ
      COMPLEX CXA(NX,NY,NZ),CXB(2*NX,2*NY,2*NZ)
C Local variables:
      COMPLEX CXZERO
      INTEGER I,J,K
      SAVE CXZERO
      DATA CXZERO/(0.,0.)/
C***********************************************************************
      DO 30 K=1,2*NZ
         DO 20 J=1,2*NY
            DO 10 I=1,2*NX
               CXB(I,J,K)=CXZERO
   10       CONTINUE
   20    CONTINUE
   30 CONTINUE
C
      DO 60 K=1,NZ
         DO 50 J=1,NY
            DO 40 I=1,NX
               CXB(I,J,K)=CXA(I,J,K)
   40       CONTINUE
   50    CONTINUE
   60 CONTINUE
C
      RETURN
      END

