Skip to content

Commit ee7c031

Browse files
authored
Merge pull request #1972 from farhi/mcxtrace-fluo-sx-1
Mcxtrace fluo sx 1
2 parents 5c80fab + 4c55318 commit ee7c031

File tree

14 files changed

+1473
-321
lines changed

14 files changed

+1473
-321
lines changed

mcxtrace-comps/data/C-diamond.lau

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# TITLE *Diamond-C-[FD3-MS] Fayos, J.[1999]
1+
# TITLE C [FD3-MS] Diamond - Fayos, J.[1999]
22
# CELL 3.567000 3.567000 3.567000 90.000000 90.000000 90.000000
33
# SPCGRP F D 3 M CUBIC STRUCTURE
44
# ATOM C 1 0.000000 0.000000 0.000000

mcxtrace-comps/data/C_diamond.laz

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# TITLE *Diamond-C-[FD3-MS] Fayos, J.[1999]
1+
# TITLE C [FD3-MS] Diamond - Fayos, J.[1999]
22
# CELL 3.567000 3.567000 3.567000 90.000000 90.000000 90.000000
33
# SPCGRP F D 3 M CUBIC STRUCTURE
44
# ATOM C 1 0.000000 0.000000 0.000000

mcxtrace-comps/data/Fe.lau

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# TITLE *Iron-Fe-[IM3-M] Swanson, H.E.;Tatge, E.[1954] [Iron alpha phase]
1+
# TITLE Fe [IM3-M] Iron - Swanson, H.E.;Tatge, E.[1954] [Iron alpha phase]
22
# CELL 2.886000 2.886000 2.886000 90.000000 90.000000 90.000000
33
# SPCGRP I M 3 M CUBIC STRUCTURE
44
# ATOM FE 1 0.000000 0.000000 0.000000

mcxtrace-comps/data/Fe_bcc229_lt13deg.dat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# TITLE *Iron-Fe-[IM3-M] Swanson, H.E.;Tatge, E.[1954] [Iron alpha phase]
1+
# TITLE Fe [IM3-M] Iron - Swanson, H.E.;Tatge, E.[1954] [Iron alpha phase]
22
# CELL 2.886000 2.886000 2.886000 90.000000 90.000000 90.000000
33
# SPCGRP I M 3 M CUBIC STRUCTURE
44
# ATOM FE 1 0.000000 0.000000 0.000000

mcxtrace-comps/data/adrenaline.lau

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# TITLE *Adrenaline C9H13NO3 (epinephrine, (R)-4-(1-hydroxy-2-(méthylamino)éthyl)benzène-1,2-dio)
1+
# TITLE C9H13NO3 Adrenaline (epinephrine, (R)-4-(1-hydroxy-2-(méthylamino)éthyl)benzène-1,2-dio)
22
# L-Adrenaline: P 21 (4) monoclinic
33
# a=7.873, b=6.790, c=8.638; aa=cc=90, bb=98.02;
44
# Reference: A.M. Anderson; Acta Chem.Scand.Ser.B, 29, (1975), 239

mcxtrace-comps/examples/Tests_samples/Test_FluoPowder/Test_FluoPowder.instr

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ USERVARS %{
4545
%}
4646

4747
INITIALIZE %{
48+
MPI_MASTER(
4849
switch (index) {
4950
case 1:
5051
printf("%s: Using PowderN (pure diffraction)\n", NAME_INSTRUMENT); break;
@@ -58,7 +59,7 @@ INITIALIZE %{
5859
printf("%s: Using Fluorescence+PowderN in a GROUP (fluorescence+diffraction)\n", NAME_INSTRUMENT); break;
5960
default:
6061
exit(printf("%s: Unknown sample index %i. Use index=1-4.", NAME_INSTRUMENT, index));
61-
}
62+
});
6263
%}
6364

6465
TRACE
@@ -95,7 +96,8 @@ EXTEND %{
9596
%}
9697

9798
COMPONENT FL_pow = FluoPowder(
98-
radius=0.5e-6, material=material)
99+
radius=0.5e-6, material=material,
100+
escape_ratio=0.01, pileup_ratio=0.01)
99101
WHEN (index == 3)
100102
AT (0, 0, 0) RELATIVE sample_cradle
101103
EXTEND %{
@@ -125,7 +127,7 @@ WHEN (index == 5)
125127
AT (0, 0, 0) RELATIVE sample_cradle
126128
GROUP FluPow
127129
EXTEND %{
128-
if (SCATTERED) scatt_type=3;
130+
if (SCATTERED) scatt_type=DIFFRACTION;
129131
else ABSORB;
130132
%}
131133

@@ -136,11 +138,11 @@ COMPONENT Sph_mon = PSD_monitor_4PI(nx=512,ny=512,
136138
AT (0, 0, 0) RELATIVE PREVIOUS
137139

138140
COMPONENT Sph_mon_pow = COPY(Sph_mon)(filename="Sphere_pow")
139-
WHEN (scatt_type == 3)
141+
WHEN (scatt_type == DIFFRACTION)
140142
AT (0, 0, 0) RELATIVE PREVIOUS
141143

142144
COMPONENT Sph_mon_flu = COPY(Sph_mon)(filename="Sphere_fluo")
143-
WHEN (scatt_type != 3)
145+
WHEN (scatt_type != DIFFRACTION)
144146
AT (0, 0, 0) RELATIVE PREVIOUS
145147

146148
COMPONENT E_mon = Monitor_nD(
@@ -149,11 +151,16 @@ COMPONENT E_mon = Monitor_nD(
149151
AT(0,0,0) RELATIVE PREVIOUS
150152

151153
COMPONENT E_mon_pow = COPY(E_mon)(filename="Energy_pow")
152-
WHEN (scatt_type == 3)
154+
WHEN (scatt_type == DIFFRACTION)
153155
AT (0, 0, 0) RELATIVE PREVIOUS
154156

155157
COMPONENT E_mon_flu = COPY(E_mon)(filename="Energy_flu")
156-
WHEN (scatt_type != 3)
158+
WHEN (scatt_type != DIFFRACTION)
157159
AT (0, 0, 0) RELATIVE PREVIOUS
158160

161+
// ideal "banana" detector
162+
COMPONENT det_angle = Monitor_nD(options="abs theta limits=[5 90]",
163+
radius=0.6, yheight=1e-2, bins=10000)
164+
AT (0,0,0) RELATIVE PREVIOUS
165+
159166
END

mcxtrace-comps/examples/Tests_samples/Test_Fluorescence/Test_Fluorescence.instr

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,15 @@ AT(0,0,3) RELATIVE Origin
5959

6060
COMPONENT sample=Fluorescence(material=material,
6161
xwidth=0.001,yheight=0.001,zdepth=0.0001, p_interact=0.99,
62-
target_index=1, focus_xw=0.0005, focus_yh=0.0005)
62+
target_index=1, focus_xw=0.0005, focus_yh=0.0005,
63+
escape_ratio=0.01, pileup_ratio=0.01)
6364
AT (0,0,0) RELATIVE sample_mount_point
6465
EXTEND %{
6566
if (!SCATTERED) ABSORB;
6667
Stype=type;
6768
%}
6869

69-
COMPONENT emon = E_monitor(restore_xray=1,nE=2001,Emin=0, Emax=1.2*E0,
70+
COMPONENT emon = E_monitor(restore_xray=1,nE=2001,Emin=0, Emax=1.5*E0,
7071
filename="emon.dat",xwidth=0.007, yheight=0.007)
7172
AT(0,0,0.1) RELATIVE PREVIOUS
7273

@@ -85,5 +86,13 @@ COMPONENT emon_Rayleigh = COPY(emon)(filename="Rayleigh.dat")
8586
WHEN (Stype == RAYLEIGH)
8687
AT(0,0,0.1) RELATIVE PREVIOUS
8788

89+
COMPONENT emon_Escape = COPY(emon)(filename="Si_Escape.dat")
90+
WHEN (Stype == FLUORESCENCE_ESCAPE)
91+
AT(0,0,0.1) RELATIVE PREVIOUS
92+
93+
COMPONENT emon_PileUp = COPY(emon)(filename="Si_PileUp.dat")
94+
WHEN (Stype == FLUORESCENCE_PILEUP)
95+
AT(0,0,0.1) RELATIVE PREVIOUS
96+
8897

8998
END

mcxtrace-comps/examples/Tests_samples/Test_PowderN/Test_PowderN.instr

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,28 @@
1515
* %Description
1616
* Simply a model source illuminating a powder sample.
1717
* The default sample itself is an LaB6-powder.
18-
* Alternatively, the Single_crystal component can also be tested in powder mode.
18+
* Alternatively, the Single_crystal (powder mode) and FluoPowder components can also be tested.
1919
*
20-
* %Example: Test_PowderN.instr reflections="Fe_bcc229_lt13deg.dat" -n1e7 TTH=13.4 d_phi=45 frac_i=0 Detector: Sph_mon_I=2.68295e-14
21-
* %Example: Test_PowderN.instr E0=15 Detector: Sph_mon_I=6.24257e-12
22-
* %Example: Test_PowderN.instr E0=15 d_phi=10 Detector: Sph_mon_I=6.59782e-13
23-
* %Example: Test_PowderN.instr E0=15 directbeam=1 SPLITS=2 Detector: Sph_mon_I=7.94366e-10
24-
* %Example: Test_PowderN.instr E0=15 directbeam=1 SPLITS=5 Detector: Sph_mon_I=7.94366e-10
25-
* %Example: Test_PowderN.instr E0=15 directbeam=1 SPLITS=10 Detector: Sph_mon_I=7.94366e-10
26-
* %Example: Test_PowderN.instr E0=15 directbeam=1 SPLITS=20 Detector: Sph_mon_I=7.94366e-10
20+
* %Example: index=1 Detector: Sph_mon_I=1.26755e-11
21+
* %Example: index=2 Detector: Sph_mon_I=4.44793e-13
22+
* %Example: index=3 Detector: Sph_mon_I=5.23579e-11
2723
*
2824
* %Parameters
2925
* E0: [keV] Source energy (width 1 keV)
3026
* L1: [m] Source-sample distance
3127
* directbeam: [1] Suppress direct beam (0) or not (1)
32-
* reflections: [str] List of powder reflections, LAU/CIF format.
28+
* reflections: [str] List of powder reflections, LAU/LAZ/CIF format.
3329
* SPLITS: [1] Number of SPLIT's before sample
3430
* frac_c: [1] Fraction of stats assigned to coherent scattering
3531
* frac_i: [1] Fraction of stats assigned to incoherent scattering
3632
* frac_t: [1] Fraction of stats assigned to unscattered, "direct beam"
37-
* TTH: [deg] Rotation of secondary detector arm.
3833
* d_phi: [deg] Angle corresponding to the vertical angular range to focus to, e.g. detector height. 0 for no focusing.
39-
* index: [1] Index of the sample component to use. 1=PowderN, 2=Single_crystal
34+
* index: [1] Index of the sample component to use. 1=PowderN, 2=Single_crystal, 3=FluoPowder
4035
*
4136
* %End
4237
*******************************************************************************/
43-
DEFINE INSTRUMENT Test_PowderN(E0=15, L1=10, int directbeam=0, string reflections="LaB6_660b_AVID2.hkl",
44-
int SPLITS=1, frac_c=0.8, frac_i=0.1, frac_t=0.1, d_phi=0, TTH=0, int index=1)
38+
DEFINE INSTRUMENT Test_PowderN(E0=15, L1=10, int directbeam=0, string reflections="LaB6.cif",
39+
int SPLITS=1, frac_c=0.8, frac_i=0.1, frac_t=0.1, d_phi=0, int index=1)
4540

4641
TRACE
4742

@@ -55,11 +50,13 @@ COMPONENT src = Source_flat(
5550

5651
SPLIT SPLITS COMPONENT sample_cradle = Arm()
5752
AT (0, 0, L1) RELATIVE PREVIOUS
53+
54+
// samples -------------------------------------------------------------------
5855

5956
COMPONENT Pow = PowderN(
6057
radius=0.5e-4, yheight=1e-3, reflections=reflections,format={ 4,5,7,0,0,0,0,0 },
6158
p_inc=frac_i, p_transmit=frac_t, p_interact=frac_c,
62-
d_phi=d_phi, pack = 0.5, Vc = 123)
59+
d_phi=d_phi, pack = 0.5)
6360
WHEN (index == 1)
6461
AT (0, 0, 0) RELATIVE sample_cradle
6562
EXTEND %{
@@ -72,7 +69,7 @@ EXTEND %{
7269

7370
COMPONENT SX = Single_crystal(
7471
radius=0.5e-4, yheight=1e-3, reflections=reflections,powder=1,
75-
p_transmit=frac_t, mosaic=5, sigma_inc=-1)
72+
p_transmit=frac_t, mosaic=1, sigma_inc=-1)
7673
WHEN (index == 2)
7774
AT (0, 0, 0) RELATIVE sample_cradle
7875
EXTEND %{
@@ -83,19 +80,24 @@ EXTEND %{
8380
}
8481
%}
8582

83+
COMPONENT FlPow = FluoPowder(
84+
radius=0.5e-4, yheight=1e-3, material=reflections, powder_d_phi=d_phi,
85+
packing_factor = 0.5, p_interact=frac_c)
86+
WHEN (index == 3)
87+
AT (0, 0, 0) RELATIVE sample_cradle
88+
EXTEND %{
89+
if(INSTRUMENT_GETPAR(directbeam) == 0) {
90+
if (!SCATTERED) {
91+
ABSORB;
92+
}
93+
}
94+
%}
95+
96+
// detectors -------------------------------------------------------------------
8697

8798
COMPONENT Sph_mon = PSD_monitor_4PI(nx=200,ny=200, radius=1, restore_xray=1, filename="Sphere")
8899
AT (0, 0, 0) RELATIVE PREVIOUS
89100

90-
COMPONENT ttharm= Arm()
91-
AT(0,0,0) RELATIVE Pow
92-
ROTATED (0,TTH,0) RELATIVE Pow
93-
94-
COMPONENT detector2 = PSD_monitor(
95-
nx=200, ny=200, xwidth=2e-3, yheight=1e-2, filename="psd2",restore_xray=1
96-
)
97-
AT(0,0,0.1) RELATIVE ttharm
98-
99101
// ideal "banana" detector
100102
COMPONENT det_angle = Monitor_nD(options="abs theta limits=[5 90]",
101103
radius=0.6, yheight=1e-2, bins=10000)

mcxtrace-comps/examples/Tests_samples/Test_SX/Test_SX.instr

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,47 +15,56 @@
1515
* Simply a model source illuminating a SX sample.
1616
* The sample itself is a Mo bulk crystal.
1717
*
18-
* %Example: TTH=13.4 Detector: psd4pi_I=7.95747e-10
18+
* %Example: index=1 Detector: psd4pi_I=1.18843e-13
19+
* %Example: index=2 Detector: psd4pi_I=4.80386e-13
1920
*
2021
* %Parameters
21-
* TTH: [deg.] Two theta rotation. Only places the last detector.
22+
* reflections: [str] List of powder reflections, LAU/CIF format.
23+
* index: [1] Index of the sample component to use. 1=Single_crystal, 2=FluoCrystal
2224
*
2325
* %End
2426
*******************************************************************************/
2527

26-
DEFINE INSTRUMENT Test_SX(TTH=13.4)
28+
DEFINE INSTRUMENT Test_SX(string reflections="Mo.lau", index=1)
29+
30+
USERVARS %{
31+
int Stype;
32+
%}
2733

2834
TRACE
2935
COMPONENT src = Source_flat(
3036
yheight = 1e-3, xwidth = 1e-3, dist = 10, focus_xw = 1e-3,
3137
focus_yh = 1e-3, E0 = 7, dE = 6.9)
3238
AT (0, 0, 0) ABSOLUTE
3339

34-
COMPONENT psd0 = PSD_monitor(
35-
nx = 100, ny = 100, filename = "psd0", xwidth = 2e-3, yheight = 2e-3)
36-
AT (0, 0, 1e-9) RELATIVE src
37-
38-
COMPONENT sample = Single_crystal(reflections="Mo.lau", material_datafile="NULL",
39-
radius = .5e-4, yheight = 1e-3,mosaic=1e-4)
40+
COMPONENT sample_pos=Arm()
4041
AT (0, 0, 10) RELATIVE PREVIOUS
41-
ROTATED (0,0,0) RELATIVE PREVIOUS
42-
/*EXTEND %{*/
43-
/* if(!SCATTERED) ABSORB;*/
44-
/*%}*/
42+
43+
COMPONENT sample = Single_crystal(reflections=reflections, material_datafile="NULL",
44+
radius = .5e-4, yheight = 1e-3, mosaic=1)
45+
WHEN(index==1)
46+
AT (0, 0, 0) RELATIVE sample_pos
47+
EXTEND %{
48+
if(!SCATTERED) ABSORB;
49+
else Stype=DIFFRACTION;
50+
%}
51+
52+
COMPONENT sampleF = FluoCrystal(material=reflections,
53+
radius = .5e-4, yheight = 1e-3, sx_mosaic=5)
54+
WHEN(index==2)
55+
AT (0, 0, 0) RELATIVE sample_pos
56+
EXTEND %{
57+
if(!SCATTERED) ABSORB;
58+
else Stype=type;
59+
%}
4560

4661
COMPONENT psd4pi = PSD_monitor_4PI(
4762
nx = 180, ny = 180, filename = "psd4pi", radius = 0.1, restore_xray = 1)
4863
AT (0, 0, 0) RELATIVE sample
4964

50-
/*COMPONENT detector = PSD_monitor(*/
51-
/* nx=200, ny=200, xwidth=0.1, yheight=0.1, filename="psd1",restore_xray=1)*/
52-
/*AT(0,0,0.1) RELATIVE sample*/
53-
/**/
54-
/*COMPONENT ttharm= Arm()*/
55-
/*AT(0,0,0) RELATIVE sample*/
56-
/*ROTATED (TTH,TTH,0) RELATIVE sample*/
57-
/**/
58-
/*COMPONENT detector2 = PSD_monitor(*/
59-
/* nx=200, ny=200, xwidth=2e-3, yheight=1e-2, filename="psd2",restore_xray=1)*/
60-
/*AT(0,0,0.1) RELATIVE ttharm*/
65+
COMPONENT psd_Diff = PSD_monitor_4PI(
66+
nx = 180, ny = 180, filename = "psd4pi_diff", radius = 0.1, restore_xray = 1)
67+
WHEN (Stype == DIFFRACTION)
68+
AT (0, 0, 0) RELATIVE sample
69+
6170
END

0 commit comments

Comments
 (0)