77* Written by: E. Farhi
88* Date: Sept 26th 2019
99* Origin: Synchrotron Soleil
10- * Version: 0.2
10+ * Release: McXtrace 3.5
11+ * Version: $Revision$
1112* %INSTRUMENT_SITE: Tests_samples
1213*
1314* Unit-test instrument for the Single_crystal sample component.
1415*
1516* Simply a model source illuminating a SX sample.
16- * The sample itself is a Mo bulk crystal.
17+ * The default sample itself is a Mo bulk crystal.
1718* The idea is to compare the fluorescence and diffraction patterns:
1819* - index=1: use Single_crystal
1920* - index=2: use FluoCrystal
2021* - index=3: use Fluorescence+Single_crystal in a GROUP
2122*
22- * %Example: index=1 Detector: psd4pi_I=1.18843e -13
23- * %Example: index=2 Detector: psd4pi_I =6.89931e-12
24- * %Example: index=3 Detector: psd4pi_I=4.4547e -13
23+ * %Example: index=1 Detector: psd_Diff_I=2.29638e -13
24+ * %Example: index=2 Detector: psd_Diff_I =6.60276e-14
25+ * %Example: index=3 Detector: psd_Diff_I=1.19386e -13
2526*
2627* %Parameters
2728* reflections: [str] List of powder reflections, LAU/CIF format.
2829* index: [1] Index of the sample component to use. 1=Single_crystal, 2=FluoCrystal, 3=Fluorescence+Single_crystal in a GROUP
30+ * E0: [keV] Source mean energy of xrays.
31+ * dE: [keV] Source energy half spread of x-rays.
2932*
3033* %End
3134*******************************************************************************/
3235
33- DEFINE INSTRUMENT Test_SX(string reflections="Mo.lau", index=1)
36+ DEFINE INSTRUMENT Test_SX(string reflections="Mo.lau", int index=1, E0 = 7, dE = 6.9 )
3437
3538USERVARS %{
3639 int Stype;
3740%}
3841
42+ INITIALIZE %{
43+ MPI_MASTER(
44+ switch (index) {
45+ case 1:
46+ printf("%s: Using Single_crystal (pure diffraction)\n", NAME_INSTRUMENT); break;
47+ case 2:
48+ printf("%s: Using FluoCrystal (fluorescence+diffraction)\n", NAME_INSTRUMENT); break;
49+ case 3:
50+ printf("%s: Using Fluorescence+Single_crystal in a GROUP (fluorescence+diffraction)\n", NAME_INSTRUMENT); break;
51+ default:
52+ exit(printf("%s: Unknown sample index %i. Use index=1-4.", NAME_INSTRUMENT, index));
53+ });
54+ %}
55+
3956TRACE
4057COMPONENT src = Source_flat(
4158 yheight = 1e-3, xwidth = 1e-3, dist = 10, focus_xw = 1e-3,
42- focus_yh = 1e-3, E0 = 7 , dE = 6.9 )
59+ focus_yh = 1e-3, E0 = E0 , dE = dE )
4360AT (0, 0, 0) ABSOLUTE
4461
4562COMPONENT sample_pos=Arm()
4663AT (0, 0, 10) RELATIVE PREVIOUS
4764
4865COMPONENT sample = Single_crystal(reflections=reflections, material_datafile="NULL",
49- radius = .5e-4, yheight = 1e-3, mosaic=1 )
66+ radius = .5e-4, yheight = 1e-3, mosaic=5 )
5067 WHEN(index==1)
5168AT (0, 0, 0) RELATIVE sample_pos
5269EXTEND %{
5370 if(!SCATTERED) ABSORB;
54- else Stype=DIFFRACTION;
71+ else if (hkl_info.type == 'c') Stype=DIFFRACTION;
72+ else Stype=FLUORESCENCE;
5573%}
5674
5775COMPONENT sampleF = FluoCrystal(material=reflections,
58- radius = .5e-4, yheight = 1e-3, sx_mosaic =5)
76+ radius = .5e-4, yheight = 1e-3, mosaic =5)
5977 WHEN(index==2)
6078AT (0, 0, 0) RELATIVE sample_pos
6179EXTEND %{
@@ -64,7 +82,7 @@ EXTEND %{
6482%}
6583
6684COMPONENT FluoG = Fluorescence(
67- radius = .5e-4, yheight = 1e-3, material=reflections)
85+ radius = .5e-4, yheight = 1e-3, material=reflections, p_interact=0.5 )
6886WHEN (index == 3)
6987AT (0, 0, 0) RELATIVE sample_pos
7088GROUP FluSX
@@ -77,8 +95,10 @@ WHEN (index == 3)
7795AT (0, 0, 0) RELATIVE sample_pos
7896GROUP FluSX
7997EXTEND %{
80- if (SCATTERED) Stype=DIFFRACTION;
81- else ABSORB;
98+ if (SCATTERED) {
99+ if (hkl_info.type == 'c') Stype=DIFFRACTION;
100+ else Stype=FLUORESCENCE;
101+ } else ABSORB;
82102%}
83103
84104COMPONENT psd4pi = PSD_monitor_4PI(
0 commit comments