  subroutine wrsize(nopr,iout,outdir,&
  r1,r2,&
  den1,rad1,sig1,&
  den2,rad2,sig2,&
  ndist,radr,sized,&
  lset)

! ***********************
! See getfilnm.f90
  character(len=30) :: fil
  character(len=100) :: filnm
  character(len=60) :: outdir

! See rdindices.f90
  character(len=100) :: lset

! See rdwork.f90
  integer :: iwave
  real :: w1,w2,dw
  real :: r1,r2
  real :: den1,rad1,sig1
  real :: den2,rad2,sig2

! See calcsized.f90
  integer,parameter :: ndist2=200
  real :: radr(ndist2),sized(ndist2)

! used here
  integer :: noprf,idat

! *************************
!     '123456789012345678901234567890'
  fil='size.ascii                    '
   noprf=1
  call getfilnm(noprf,iout,fil,outdir,filnm)
  if (noprf .eq. 1) then 
!  stop
  end if

! *************************
! Open the output ascii file for the refractive indices
   idat=30
  open(idat,form='formatted',file=filnm,status='unknown')

  write(0,fmt=190) filnm
  190 format(2x,"Will write to ",/,2x,a100)

! *************************
   write(idat,fmt=200) lset,ndist 
   200 format(2x,a60,/,&
   2x,"Radr is in microns ",/,&
   2x,"Sized is the size distribution",/,&
   2x," number per cm3 per micron radius increment ",/,&
   2x,"Number of size distribution bins",/,&
   2x,i4,/,&
   2x,"i,radr(i),sized(i) ")
   do i=1,ndist
    write(idat,fmt=210) i,radr(i),sized(i)
    210 format(1(1x,i4,","),1p,2(1x,e11.4,","))
   end do

! *************************
! Close the output file
   close (idat)

! *************************
  return
  end
