      SUBROUTINE RESTORE(CXV,CXUNOC,IOCC,MXN3,MXNAT,NAT,NAT0)
      IMPLICIT NONE
C***********************************************************************
C Given:
C      CXV(1-3*NAT0) defined for NAT0 occupied lattice sites
C      IOCC(1-NAT) = 0 or 1 depending on whether lattice site
C                      is vacant or occupied
C      CXUNOC      = value to use for unoccupied sites 
C      MXN3,MXNAT  = dimensioning information
C      NAT         = number of lattice sites
C      NAT0        = number of occupied lattice sites
C Returns
C      CXV(1-3*NAT) defined for NAT lattice sites, occupied and 
C                   unoccupied, with CXV(J)=CXFILL for unoccupied sites
C Arguments:
      INTEGER MXN3,MXNAT,NAT,NAT0
      INTEGER*2 IOCC(MXNAT)
      COMPLEX CXUNOC
      COMPLEX CXV(MXN3)
C Local variables:
      INTEGER J,JUN,M
C
C B.T.Draine, Princeton Univ. Observatory
C History:
C 98.01.01 (BTD): Created for use in DDSCAT.6
C end history
C
C Copyright (C) 1998, B.T. Draine and P.J. Flatau
C This code is covered by the GNU General Public License.
C***********************************************************************
      DO 20 M=2,0,-1
         JUN=NAT-NAT0
         DO 10 J=NAT,1,-1
            IF(IOCC(J).EQ.0)THEN
               JUN=JUN-1
               CXV(J+M*NAT)=CXUNOC
            ELSE
               CXV(J+M*NAT)=CXV(M*NAT0+J-JUN)
            ENDIF
  10     CONTINUE
  20  CONTINUE
      RETURN
      END
