subroutine default_filename_ptcl(workpath,runid,filename,suffix,myid,numprocs)
!  workpath - working directory
!  runid - runid
!  filename - if provided will be same on output,
!             if filename is blank, provide a default:  
!             /workpath/<runid>_<suffix>_cpu<myid>_<numprocd>.cdf
!  suffix - filename suffix, see above
!  myid - process id# (if serial usually 0, 
!          exclusion for mpi-debugging on sublist of ptcl.by nubeam_test)
!  numprocs -number of processors (if serial usually 1, with same exclusion as above)
!  mg 03/2009
!
  implicit none
  character*(*), intent(in) :: suffix,workpath,runid
  integer, intent(in) :: myid, numprocs
  character*(*), intent(inout) :: filename
  character*9 cmyid,cnumprocs
  
  write(cmyid,'(i5)') myid
  cnumprocs=' '
  write(cnumprocs,'(i5)') numprocs
  if(filename.eq.' ') then
     filename = trim(workpath)//trim(runid)//trim(suffix)//&
          &        trim(adjustl(cmyid))//'_'//trim(adjustl(cnumprocs))//'.cdf'
  endif
  
end subroutine default_filename_ptcl
