dustem_write_mix.pro 865 Bytes
PRO dustem_write_mix,dir,st

;Writes ALL the MIX_xxx.DAT files
  
  Ncomments=5
  c=strarr(Ncomments)
  
  c(0)='# DUSTEM: mixing coefficient'
  c(1)='# fraction of neutral PAHs'
  c(2)='#'
  c(3)='# f_mix'
  c(4)='#'
  
  Nst=n_elements(st)
  
;stop
  
  frmt='(E14.6)'

;Start loop over type of grain
  FOR i=0L,Nst-1 DO BEGIN
;Test if the pointer is pointing to something
     IF ptr_valid(st(i)) THEN BEGIN
;Get filename
        ffile=(*st(i)).file
        fv=str_sep(ffile,'/')
        file=dir+fv(n_elements(fv)-1)
;Open file
        openw,unit,file,/get_lun
;Print comments
        FOR ii=0,Ncomments-1 DO BEGIN
           printf,unit,c(ii)
        ENDFOR
;Print FMIX
        FOR k=0L,n_elements((*st(i)).fmix)-1 DO BEGIN
           printf,unit,((*st(i)).fmix)(k),format=frmt
        ENDFOR
        close,unit
        free_lun,unit
     ENDIF
  ENDFOR

END