|
36 | 36 | * in the material. Leaving 'order=0' handles the single scattering only. |
37 | 37 | * |
38 | 38 | * Example: FluoCrystal(material="LaB6.cif", |
39 | | -* xwidth=0.001,yheight=0.001,zdepth=0.0001, p_interact=0.99, |
40 | | -* target_index=1, focus_xw=0.0005, focus_yh=0.0005) |
| 39 | +* xwidth=0.001,yheight=0.001,zdepth=0.0001, p_interact=0.99, mosaic=1) |
41 | 40 | * |
42 | 41 | * <b>Sample shape:</b> |
43 | 42 | * Sample shape may be a cylinder, a sphere, a box or any other shape |
@@ -844,9 +843,7 @@ do { /* while (intersect) Loop over multiple scattering events */ |
844 | 843 | int flag=0; |
845 | 844 | double d_path, p_trans, p_scatt, mc_trans, mc_scatt; |
846 | 845 |
|
847 | | - /* actual fluorescence calculation */ |
848 | | - |
849 | | - /* compute total scattering cross section for incoming photon energy Ei */ |
| 846 | + /* compute total scattering cross section ------------------------------ */ |
850 | 847 | /* compute each contribution XS */ |
851 | 848 | xs[FLUORESCENCE]=xs[COMPTON]=xs[RAYLEIGH]=xs[TRANSMISSION]=xs[DIFFRACTION]=sigma_barn=0; |
852 | 849 | cum_xs_fluo[0] = cum_xs_Compton[0] = cum_xs_Rayleigh[0] = 0; |
@@ -911,7 +908,8 @@ do { /* while (intersect) Loop over multiple scattering events */ |
911 | 908 | } |
912 | 909 | } |
913 | 910 |
|
914 | | - /* probability to absorb/scatter */ |
| 911 | + /* probability to absorb/scatter --------------------------------------- */ |
| 912 | + /* determine scattering location in sample */ |
915 | 913 | my_s = fluo_rho*100*sigma_barn; /* mu 100: convert from barns to fm^2. my_s in [1/m] */ |
916 | 914 | d_path = ( dl0 +dl2 ); /* total path lenght in sample */ |
917 | 915 |
|
@@ -953,6 +951,7 @@ do { /* while (intersect) Loop over multiple scattering events */ |
953 | 951 |
|
954 | 952 | } /* if intersect (propagate) */ |
955 | 953 |
|
| 954 | + /* select scattering line ------------------------------------------------ */ |
956 | 955 | if (intersect) { /* scattering event */ |
957 | 956 | int i_Z=-1, Z, j=-1; |
958 | 957 | double solid_angle; |
@@ -986,15 +985,15 @@ do { /* while (intersect) Loop over multiple scattering events */ |
986 | 985 | sum=0; |
987 | 986 | // choose a line among those possible, using F2 as relative probability/intensity |
988 | 987 | j = hkl_select(T, tau_count, coh_refl, &sum,_particle); |
989 | | - printf("DEBUG: %s: DIFF j=%i sum=%g\n", NAME_CURRENT_COMP, j, sum); |
990 | 988 | if(j >= tau_count) j = tau_count - 1; |
991 | | - } else j = 0;/* Select between tau_count Bragg spots */ |
| 989 | + } else j = 0; /* Select between tau_count Bragg spots */ |
992 | 990 | break; |
993 | 991 | default: // should never happen |
994 | 992 | // printf("WARNING: %s: process %i unknown. Absorb.\n", NAME_CURRENT_COMP, type); |
995 | 993 | ABSORB; |
996 | 994 | } |
997 | 995 |
|
| 996 | + // select scattering direction -------------------------------------------- |
998 | 997 | if (i_Z >= 0) { |
999 | 998 | // fluorescence/Rayleigh/Compton: 4PI scattering |
1000 | 999 | Z = compound->Elements[i_Z]; |
@@ -1028,14 +1027,15 @@ do { /* while (intersect) Loop over multiple scattering events */ |
1028 | 1027 | double kfy = T[j].rho_y + T[j].oy + T[j].b1y*y1 + T[j].b2y*y2; |
1029 | 1028 | double kfz = T[j].rho_z + T[j].oz + T[j].b1z*y1 + T[j].b2z*y2; |
1030 | 1029 |
|
1031 | | - /* kf(x,y,z) is already normalized to kf (in) */ |
| 1030 | + /* Normalize kf to length of ki, to account for planer |
| 1031 | + approximation of the Ewald sphere. */ |
| 1032 | + double adjust = ki/sqrt(kfx*kfx + kfy*kfy + kfz*kfz); |
| 1033 | + kfx *= adjust; |
| 1034 | + kfy *= adjust; |
| 1035 | + kfz *= adjust; |
1032 | 1036 |
|
1033 | 1037 | /* Adjust photon weight (see manual for explanation). */ |
1034 | 1038 | double pmul = T[j].xsect*coh_refl/(coh_xsect*T[j].refl); |
1035 | | - printf("DEBUG: L[%i] hkl=[%i %i %i] pmul=%g\n", |
1036 | | - i, L[i].h, L[i].k, L[i].l, pmul); |
1037 | | - printf(" kf(in)=%g %g %g -> kf(xyz)=%g %g %g \n", |
1038 | | - kf_x, kf_y, kf_z, kfx, kfy, kfz); |
1039 | 1039 | if (!isnan(pmul)) p *= pmul; |
1040 | 1040 | kf_x = L[i].u1x*kfx + L[i].u2x*kfy + L[i].u3x*kfz; |
1041 | 1041 | kf_y = L[i].u1y*kfx + L[i].u2y*kfy + L[i].u3y*kfz; |
@@ -1123,8 +1123,6 @@ FINALLY %{ |
1123 | 1123 | MPI_MASTER( |
1124 | 1124 | printf("FluoCrystal: %s: scattered intensity: fluo=%g Compton=%g Rayleigh=%g Diffraction=%g\n", |
1125 | 1125 | NAME_CURRENT_COMP, p_fluo, p_Compton, p_Rayleigh, p_diff); |
1126 | | - printf("FluoCrystal: %s: scattered events : fluo=%i Compton=%i Rayleigh=%i Diffraction=%i\n", |
1127 | | - NAME_CURRENT_COMP, n_fluo, n_Compton, n_Rayleigh, n_diff); |
1128 | 1126 | ); |
1129 | 1127 | %} |
1130 | 1128 |
|
|
0 commit comments