diff --git a/mcxtrace-comps/samples/Single_crystal.comp b/mcxtrace-comps/samples/Single_crystal.comp index 14ab7b69d8..bb73913c38 100644 --- a/mcxtrace-comps/samples/Single_crystal.comp +++ b/mcxtrace-comps/samples/Single_crystal.comp @@ -1490,7 +1490,7 @@ TRACE double V0; /* Volume of unit cell */ double l_full; /* photon path length for transmission */ double l; /* Path length to scattering event */ - double abs_xsect, abs_xlen; /* Absorption cross section and length */ + double abs_xlen; /* Absorption length */ double inc_xsect, inc_xlen; /* Incoherent scattering cross section and length */ double coh_xsect, coh_xlen; /* Coherent cross section and length */ double tot_xsect, tot_xlen; /* Total cross section and length */ @@ -1539,23 +1539,14 @@ TRACE ki = sqrt (kx * kx + ky * ky + kz * kz); event_counter = 0; - /*absorption cross-section */ - abs_xsect = 0; + V0 = hkl_info.V0; + /* absorption: sigma [cm^2] = atomic_weight [g/mol] / NA [1/mol] * mu [cm^2/g], + then * 1e26 -> [fm^2] and / V0 [Angs^3] -> [1/m]. Independent of the barns flag. */ + abs_xlen = 0; if (abs_info.muc) { double mu = Table_Value (abs_info.table, ki * K2E, abs_info.muc); - abs_xsect = (abs_info.atomic_weight / (6.02214076 * 1E23)) * mu; // this is in cm^2 - // atomic weight = [g . mol^-1] - // Avogadro number = [mol^-1] - // mu = [cm squared . g⁻1] - // therefore convert to barns if barns set to 1, otherwise to fm^2 - if (hkl_info.flag_barns) { // convert cm^2 into barns - abs_xsect *= 1E24; - } else { // convert cm^2 into fm^2, else we assume fm^2 - abs_xsect *= 1E26; - } + abs_xlen = abs_info.atomic_weight / NA * mu * 1e26 / V0; } - V0 = hkl_info.V0; - abs_xlen = abs_xsect / V0; /*look into Compton scattering*/ inc_xsect = hkl_info.sigma_i; @@ -1564,7 +1555,6 @@ TRACE if (hkl_info.flag_barns) { /*If cross sections are given in barns, we need a scaling factor of 100 to get scattering lengths in m, since V0 is assumed to be in AA*/ - abs_xlen *= 100; inc_xlen *= 100; } /* else assume fm^2 */ L = hkl_list;