File: Test_PowderN_Res.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 (125 lines) | stat: -rw-r--r-- 4,652 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*******************************************************************************
*         McStas instrument definition URL=http://www.mcstas.org
*
* Instrument: Test_PowderN_Res
*
* %Identification
* Written by: Peter Willendrup
* Date: 20160309
* Origin: DTU
* %INSTRUMENT_SITE: Tests_samples
*
* Idealized powder diffractometer, to illustrate the difference between 'banana,theta' and 'banana,divergence' in Monitor_nD.
*
* %Description
* Idealized powder diffractometer, to illustrate the difference between 'banana,theta' and 'banana,divergence' in Monitor_nD. Includes a Na2Ca3Al2F14 powder sample.
*
* The beam from the source is very low-divergent, to allow studying effects at the sample "only".
*
* By default, absorption in the sample is effectively suppressed.
*
* Example: Lambda0=2.5667 dLambda=0.01 radius=0.001,0.021 TT=71.8 D_PHI=6 SPLITS=117 Distance=30 sig_abs=1e-09 -N21
* %Example: Lambda0=2.5667 dLambda=0.01 radius=0.01 TT=71.8 D_PHI=6 SPLITS=117 Distance=30 sig_abs=1e-09 Detector: DetectorSmall_I=288.57
*
* %Parameters
* Lambda0: [AA]     Central wavelength of the source
* dLambda: [AA]     Width of wavelength band from the source
* radius: [m]       Radius of cylindrical powder sample
* TT: [deg]         Two-theta (scattering angle) of small banana detectors
* D_PHI: [deg]      d_phi focusing around detector "plane" in degrees
* SPLITS: [1]       SPLIT statistics booster at sample position
* Distance: [m]     Distance between source and sample
* sig_abs: [barns]  Absorption cross-section in the sample
*
* %Link
* A reference/HTML link for more information
*
* %End
*******************************************************************************/
DEFINE INSTRUMENT Test_PowderN_Res(Lambda0=2.5667,dLambda=0.01,radius=0.01,TT=72,D_PHI=6, SPLITS=117,Distance=30,sig_abs=1e-9)

/* The DECLARE section allows us to declare variables or  small      */
/* functions in C syntax. These may be used in the whole instrument. */
DECLARE
%{
%}

/* The INITIALIZE section is executed when the simulation starts     */
/* (C code). You may use them as component parameter values.         */
INITIALIZE
%{
%}

/* Here comes the TRACE section, where the actual      */
/* instrument is defined as a sequence of components.  */
TRACE

/* The Arm() class component defines reference points and orientations  */
/* in 3D space. Every component instance must have a unique name. Here, */
/* Origin is used. This Arm() component is set to define the origin of  */
/* our global coordinate system (AT (0,0,0) ABSOLUTE). It may be used   */
/* for further RELATIVE reference, Other useful keywords are : ROTATED  */
/* EXTEND GROUP PREVIOUS. Also think about adding a neutron source !    */
/* Progress_bar is an Arm displaying simulation progress.               */
COMPONENT Origin = Progress_bar()
  AT (0,0,0) ABSOLUTE


COMPONENT Source = Source_div(
    xwidth = 2.01*radius, yheight = 0.1, focus_aw = 1e-3,
    focus_ah = 1e-3, lambda0 = Lambda0, dlambda = dLambda, flux = 1e16)
  AT (0, 0, 0) RELATIVE PREVIOUS

// COMPONENT Source = Source_simple(
//     radius = 0.1, dist = 10, focus_xw = 2.1*radius, focus_yh = 0.1,
//     lambda0 = Lambda0, dlambda = dLambda, flux = 1e16, gauss = 1,
//     dist=Distance)
//   AT (0, 0, 0) RELATIVE PREVIOUS

COMPONENT SampleSlit = Slit (xwidth=2.1*radius,yheight=0.1)
AT (0,0,0.89*Distance) RELATIVE PREVIOUS

SPLIT SPLITS COMPONENT Sample = PowderN(
    reflections = "Na2Ca3Al2F14.laz", radius = radius,
    yheight = 0.1,d_phi=D_PHI,sigma_abs=sig_abs)
  AT (0, 0, Distance) RELATIVE Source
EXTEND %{
  if(!SCATTERED) ABSORB;
%}

COMPONENT Detector = Monitor_nD(
  xwidth=3.0, yheight=0.09, filename="detector.dat", min=19.9, max=99.9, bins=400, restore_neutron=1,
  options="banana, theta")
AT (0,0,0) RELATIVE Sample

COMPONENT DetectorSmall = Monitor_nD(
  xwidth=3.001, yheight=0.09, filename="detectorsmall.dat", min=TT-2, max=TT+2, bins=41,restore_neutron=1,
  options="banana, theta")
AT (0,0,0) RELATIVE Sample

COMPONENT DetectorSmallDiv = Monitor_nD(
  xwidth=3.001, yheight=0.09, filename="detectorsmall2.dat", min=TT-2, max=TT+2, bins=41,restore_neutron=1,
  options="banana, divergence")
AT (0,0,0) RELATIVE Sample

COMPONENT TwoTheta = Arm(
    )
  AT (0, 0, 0) RELATIVE Sample
  ROTATED (0, TT, 0) RELATIVE Sample


/* COMPONENT PSD = PSD_monitor(
    filename = "smallPSD", xwidth = 0.001, yheight = 0.1)
  AT (0, 0, 1.51) RELATIVE PREVIOUS */


/* This section is executed when the simulation ends (C code). Other    */
/* optional sections are : SAVE                                         */
FINALLY
%{
%}
/* The END token marks the instrument definition end */
END