File: Test_PowderN.instr

package info (click to toggle)
mccode 3.5.19%2Bds5-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,113,256 kB
  • sloc: ansic: 40,697; python: 25,137; yacc: 8,438; sh: 5,405; javascript: 4,596; lex: 1,632; cpp: 742; perl: 296; lisp: 273; makefile: 226; fortran: 132
file content (105 lines) | stat: -rw-r--r-- 3,801 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*******************************************************************************
*         McXtrace instrument definition URL=http://www.mcxtrace.org
*
* Instrument: Test_PowderN
*
* %Identification
* Written by: Erik B Knudsen (erkn@fysik.dtu.dk)
* Date: 2009
* Origin: DTU Physics
* Version: 1.0
* %INSTRUMENT_SITE: Tests_samples
*
* Unit-test instrument for the PowderN sample component.
*
* %Description
* Simply a model source illuminating a powder sample.
* The default sample itself is an LaB6-powder. 
* Alternatively, the Single_crystal component can also be tested in powder mode.
*
* %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
* %Example: Test_PowderN.instr E0=15 Detector: Sph_mon_I=6.24257e-12
* %Example: Test_PowderN.instr E0=15 d_phi=10 Detector: Sph_mon_I=6.59782e-13
* %Example: Test_PowderN.instr E0=15 directbeam=1 SPLITS=2 Detector: Sph_mon_I=7.94366e-10
* %Example: Test_PowderN.instr E0=15 directbeam=1 SPLITS=5 Detector: Sph_mon_I=7.94366e-10
* %Example: Test_PowderN.instr E0=15 directbeam=1 SPLITS=10 Detector: Sph_mon_I=7.94366e-10
* %Example: Test_PowderN.instr E0=15 directbeam=1 SPLITS=20 Detector: Sph_mon_I=7.94366e-10
*
* %Parameters
* E0:          [keV]  Source energy (width 1 keV)
* L1:          [m]    Source-sample distance
* directbeam:  [1]    Suppress direct beam (0) or not (1)
* reflections: [str]  List of powder reflections, LAU/CIF format.
* SPLITS:      [1]    Number of SPLIT's before sample
* frac_c:      [1]    Fraction of stats assigned to coherent scattering
* frac_i:      [1]    Fraction of stats assigned to incoherent scattering
* frac_t:      [1]    Fraction of stats assigned to unscattered, "direct beam"
* TTH:         [deg]  Rotation of secondary detector arm.
* d_phi:       [deg]  Angle corresponding to the vertical angular range to focus to, e.g. detector height. 0 for no focusing.
* index:       [1]    Index of the sample component to use. 1=PowderN, 2=Single_crystal
*
* %End
*******************************************************************************/
DEFINE INSTRUMENT Test_PowderN(E0=15, L1=10, int directbeam=0, string reflections="LaB6_660b_AVID2.hkl", 
  int SPLITS=1, frac_c=0.8, frac_i=0.1, frac_t=0.1, d_phi=0, TTH=0, int index=1)

TRACE

REMOVABLE COMPONENT Origin = Progress_bar()
  AT (0,0,0) ABSOLUTE

COMPONENT src = Source_flat(
    yheight = 1e-3, xwidth = 1e-3, dist = 10, focus_xw = 1e-3,
    focus_yh = 1e-3, E0 = E0, dE = 1)
  AT (0, 0, 0) RELATIVE Origin

SPLIT SPLITS COMPONENT sample_cradle = Arm()
  AT (0, 0, L1) RELATIVE PREVIOUS

COMPONENT Pow = PowderN(
    radius=0.5e-4, yheight=1e-3, reflections=reflections,format={ 4,5,7,0,0,0,0,0 },
    p_inc=frac_i, p_transmit=frac_t, p_interact=frac_c,
    d_phi=d_phi, pack = 0.5, Vc = 123)
WHEN (index == 1)
AT (0, 0, 0) RELATIVE sample_cradle
EXTEND %{
  if(INSTRUMENT_GETPAR(directbeam) == 0) {
    if (!SCATTERED) {
      ABSORB;
    }
  }
%}

COMPONENT SX = Single_crystal(
    radius=0.5e-4, yheight=1e-3, reflections=reflections,powder=1,
    p_transmit=frac_t, mosaic=5, sigma_inc=-1)
WHEN (index == 2)
AT (0, 0, 0) RELATIVE sample_cradle
EXTEND %{
  if(INSTRUMENT_GETPAR(directbeam) == 0) {
    if (!SCATTERED) {
      ABSORB;
    }
  }
%}


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

COMPONENT ttharm= Arm()
AT(0,0,0) RELATIVE Pow
ROTATED (0,TTH,0) RELATIVE Pow

COMPONENT detector2 = PSD_monitor(
    nx=200, ny=200, xwidth=2e-3, yheight=1e-2, filename="psd2",restore_xray=1
)
AT(0,0,0.1) RELATIVE ttharm

// ideal "banana" detector
COMPONENT det_angle = Monitor_nD(options="abs theta limits=[5 90]",
  radius=0.6, yheight=1e-2, bins=10000)
AT (0,0,0) RELATIVE Pow


END