Imaginary refractive index to absorption converter

The attached FRED script file will retrieve the imaginary refractive index value for a Sampled Material type, create corresponding wavelength and absorption coefficient pairs for that material, and set the absorption flag active.

In this implementation the conversion between imaginary refractive index and absorption coefficient includes a scale factor assuming that the system units are in millimeters.

    Dim matID As Long, numWvls As Long, ii As Long
    Dim wvl As Double, rl As Double, im As Double

    'this is the sampled material we are converting
    matID = FindMaterial( "Material 1" )

    'loop over wavelengths, get imaginary refractive index
    numWvls = GetSampledMaterialWavelengthCount( matID )
    For ii = 0 To numWvls-1
        GetSampledMaterialIthWavelength matID, ii, wvl, rl, im

        'use 4*pi*k/lambda, assuming units are in mm
        SetMaterialAbsorb( matID, wvl, 4*Acos(-1)*im/(wvl*10^-3) )
    Next ii

    'now set the absorption flag for the material to be active
    SetMaterialAbsorbFlag matID, True

    'and that we are defining absorption coefficients, not Internal Transmittance
    SetMaterialAbsorbRefDist matID, 0<br><br>

Still need help? Contact Us Contact Us