Here the BHMIE code of Bohren & Huffman is used to compute the full scattering matrix table. Instead of writing the dustkappa_xxx.inp file it will write the dustkapscatmat_xxx.inp file, which contains in addition to kappa_abs and kappa_scat also the scattering matrix elements
Z_11, Z_12, Z_22, Z_33, Z_34 and Z_44 from Mie theory.
Steps
Get the bhmie.f code and put it in this directory.
Type "make", which should compile bhmie.f and make_scatmat.f90 and produce a code called "makeopac". It also compiles the code make_scatmat_distr.f90 and produces "makeopac_distr". The latter does the same as the former, but for a distribution of grain sizes.
This can be important in order to wash out all too extreme phase function fluctuations (see below).
Edit param.inp to put the name "pyrmg70" on the first line (if you use indeed pyrmg70.lnk).
pyrmg70 ; Name of the grain, referring to the file pyrmg70.lnk
1.00d-4 ; Grain radius in cm
3.0d0 ; Material density in gram/cm^3
181 ; Nr of angle sampling points between 0 and 180
0.1 ; Error tolerance for testing kappascat = 2 pi int{-1}^{+1} Z_11(mu) dmu
The second line should be the grain size in cm.
The third line the material density in gram/cm^3 (note: you can find this either on the jena website or you'll have to look for this on other databases).
The fourth line is the number of angle sampling points for the phase function (uniformly distributed in angle in degrees between 0 and 180) ; a reasonable value for this could be 181, meaning one sampling per degree.
Finally (optionally) you can give the maximum allowed error in the integration of the scattering matrix over angle: T*he code will automatically integrate the Z_11 matrix element over 4pi and checks if this is equal to the kappa_scat that BHMIE gives independently; if it exceeds the error tolerance given here, it will stop. The default error tolerance is 0.01.**
Now type ./makeopac and this produces a file dustkapscatmat_pyrmg70.inp.
If you want to use makeopac_distr:
Edit param_distr.inp. It has almost the same structure as param.inp, but there are a few lines added to it to allow you to specify the distribution of particles. The second line should be the nr of grain sizes you wish to use for the computation of the distribution. The more the better, but in the end just a single averaged opacity comes out anyway (so, a large number here does not affect the speed of RADMC-3D in any way). Then follows the minimal and maximal grain size in cm (each on a separate line). Then (the fifth line) gives the powerlaw index for the distribution function (-3.5 is the usuall MRN distribution). From here on the file is again the same as param.inp, i.e. the 6th and 7th line contain the material density in gram/cm^3 and the number of angle sampling points for the phase function. And on the 8th line (optionally) you can give the maximum allowed error in the integration of the scattering matrix over angle.
Now type ./makeopac_distr and this produces dustkapscatmat_pyrmg70.inp. This is a file that can be used as if it is the opacity of a single grain, but it is now an average over the grain size distribution.
How works
Here the BHMIE code of Bohren & Huffman is used to compute the full scattering matrix table. Instead of writing the dustkappa_xxx.inp file it will write the dustkapscatmat_xxx.inp file, which contains in addition to kappa_abs and kappa_scat also the scattering matrix elements Z_11, Z_12, Z_22, Z_33, Z_34 and Z_44 from Mie theory.
Steps
pyrmg70 ; Name of the grain, referring to the file pyrmg70.lnk 1.00d-4 ; Grain radius in cm 3.0d0 ; Material density in gram/cm^3 181 ; Nr of angle sampling points between 0 and 180 0.1 ; Error tolerance for testing kappascat = 2 pi int{-1}^{+1} Z_11(mu) dmu
The second line should be the grain size in cm. The third line the material density in gram/cm^3 (note: you can find this either on the jena website or you'll have to look for this on other databases). The fourth line is the number of angle sampling points for the phase function (uniformly distributed in angle in degrees between 0 and 180) ; a reasonable value for this could be 181, meaning one sampling per degree. Finally (optionally) you can give the maximum allowed error in the integration of the scattering matrix over angle: T*he code will automatically integrate the Z_11 matrix element over 4pi and checks if this is equal to the kappa_scat that BHMIE gives independently; if it exceeds the error tolerance given here, it will stop. The default error tolerance is 0.01.**
If you want to use makeopac_distr: