      SUBROUTINE NAMID(MYID,CFLLOG)
      IMPLICIT NONE
C***********************************************************************
C Purpose: to generate unique file names for log file written
C          each MPI process
C
C Present version allows up to 1000 MPI processes (000-999)
C
C Given:
C         MYID=integer (0-999) MPI ID number

C Returns:
C          CFLLOG=name for output file containing running output
C                 from DDSCAT
C                 = ddscat.log_nnn
C                   where nnn = MYID
C
C B.T.Draine, Princeton Univ. Observatory, 2003.04.12
C History:
C 03.04.12 (BTD): Created using NAMER as an example
C end history
C
C Copyright (C) 2003, B.T. Draine and P.J. Flatau
C This code is covered by the GNU General Public License.
C***********************************************************************
C Arguments:

      INTEGER MYID
      CHARACTER CFLLOG*14

C Local variables:

      CHARACTER A1*11,ZLOG*14
      CHARACTER N(0:9)*1,V(1:3)*1,W(1:14)*1

C Equivalences:
      EQUIVALENCE (A1,W(1)),(V,W(12))
      EQUIVALENCE (W,ZLOG)

C DATA statements:

      DATA N/'0','1','2','3','4','5','6','7','8','9'/
C***********************************************************************
C*** Filename CFLLOG will be of the form ddscat.log_NNN
C     where NNN = MYID
C
      A1='ddscat.log_'

      V(1)=N(MYID/100)
      V(2)=N((MYID-100*(MYID/100))/10)
      V(3)=N(MYID-10*(MYID/10))

      CFLLOG=ZLOG

      RETURN
C
      END

