PRO dustem_write_align,file,st_align,help=help ;+ ; NAME: ; dustem_write_align ; ; PURPOSE: ; writes the ALIGN.DAT file ; ; CATEGORY: ; DustEMWrap, Distributed, LowLevel, Initialization ; ; CALLING SEQUENCE: ; dustem_write_align,file,st_align ; ; ; INPUTS: ; file : name of the file to be written ; st_align : structure describing alignment parameters for various grains (usually !dustem.grains.align) ; ; OPTIONAL INPUT PARAMETERS: ; None ; ; OUTPUTS: ; None ; ; OPTIONAL OUTPUT PARAMETERS: ; None ; ; ACCEPTED KEY-WORDS: ; help : whrites this help ; ; COMMON BLOCKS: ; None ; ; SIDE EFFECTS: ; a File is written ; ; RESTRICTIONS: ; The DustEM fortran code must be installed ; The DustEMWrap idl code must be installed ; ; PROCEDURES AND SUBROUTINES USED ; ; EXAMPLES ; ; MODIFICATION HISTORY: ; Evolution details on the DustEMWrap gitlab. ; See http://dustemwrap.irap.omp.eu/ for FAQ and help. ;- IF keyword_set(help) THEN BEGIN doc_library,'dustem_write_align' goto,the_end ENDIF Ncomments=13 c=strarr(Ncomments) ;NOTE: In vincent Guillet's model, the alignment parameters of all grains have to be the same. ;As a consquence, there is only one line in the ALIGN.DAT file. ;Here we use the first polarized grain value ;stop ii=0 c[ii]='# DUSTEM: definition of grain alignment' & ii=ii+1 c[ii]='# for each grain TYPE make sure you have the following files' & ii=ii+1 c[ii]='# Q1_TYPE.DAT and Q2_TYPE in /oprop' & ii=ii+1 c[ii]='# Qc_TYPE.DAT for circular polarization' & ii=ii+1 c[ii]='# QH1_TYPE.DAT QH2_TYPE.DAT for an anistropic radiation field' & ii=ii+1 c[ii]='# Q1_TYPE_RRFxxx.DAT and Q2_TYPE_RRFxxx.DAT when running with RRF option' & ii=ii+1 c[ii]='#' & ii=ii+1 c[ii]='# run keywords' & ii=ii+1 c[ii]='# lin for linear, circ for circular, anis for anistropic extinction and emission, univ for universal alignment law, RRF' & ii=ii+1 c[ii]='# degree of anisotropy of the radiation : if > 0, read QH1 and QH2 files' & ii=ii+1 c[ii]='# alignmentlaw (idg, rat, par), parameters (par1 par2 par3)' & ii=ii+1 c[ii]='# for alignmentlaw = par: parameters are aalign, pstiff, fmax (see Equ. 1 In Guillet et al. 2017' & ii=ii+1 c[ii]='#' ;WHAY IS FMAX in Guillet2017 here called plev ?? openw,unit,file,/get_lun FOR ii=0,Ncomments-1 DO printf,unit,c[ii] printf,unit,st_align.keywords,format='(A-40)' printf,unit,st_align.anisG0,format='(E10.2)' format='(A-10,2X,10(E18.10,2X))' IF !run_univ EQ 1 THEN BEGIN ind=where(st_align.grains.aligned eq 1,count) ii=ind[0] ;here we use alignment parameters of the first polarized grains and for them to be the same printf,unit,st_align.grains[ii].law,st_align.grains[ii].athresh,st_align.grains[ii].pstiff,st_align.grains[ii].plev,format=format ;stop ENDIF ELSE BEGIN FOR i=0,n_elements(st_align.grains)-1 DO BEGIN IF st_align.grains[i].aligned THEN BEGIN IF st_align.grains[i].law NE '' THEN BEGIN printf,unit,st_align.grains[i].law,st_align.grains[i].athresh,st_align.grains[i].pstiff,st_align.grains[i].plev,format=format ENDIF ENDIF ENDFOR ENDELSE close,unit free_lun,unit the_end: END