dustem_write_mix.pro
865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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