File: Test_Mono.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 (163 lines) | stat: -rw-r--r-- 5,528 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/*****************************************************************************
*         McXtrace instrument definition URL=http://www.mcxtrace.org
*
* Instrument: Test_Monochromators
*
* %Identification
* Written by: A. Vickery, A. Prodi and E. Knudsen
* Date: July 2011.
* Origin: NBI,Risø DTU Physics
* %INSTRUMENT_SITE: Tests_optics
*
* Compares intensities of Monochromator components.
*
* %Description
*
* Very simple setup to compare intensities diffracted by Monochromators. 
* It shows that implementations are equivalent.
*
* The input parameter 'Mono' chooses which model to use:
* 0: Obsolete Perfect_crystal
* 1: Bragg_crystal - validated component
* 2: Bragg_crystal_bent - bent version of the above
* 3: Bragg_crystal_BC - variant of the above based on Mendenhall et. al., J. Appl. Cryst 2019
* 4: Bragg_crystal_bent_BC - variant of the above based on Mendenhall et. al., J. Appl. Cryst 2019
* 5: Bragg_crystal_simple - a simple mono with a static (flat) Darwin width.
*
* %Example: Test_Mono.instr Mono=1 Detector: emon_I=5.39036e-17
* %Example: Test_Mono.instr Mono=2 Detector: emon_I=5.41029e-17
* %Example: Test_Mono.instr Mono=3 Detector: emon_I=5.33687e-17
* %Example: Test_Mono.instr Mono=4 Detector: emon_I=5.33687e-17
* %Example: Test_Mono.instr Mono=5 Detector: emon_I=5.33687e-17
*
* %Parameters
* INPUT PARAMETERS:
* Mono:   [ ]   Which monochromator model to use. See description above.
* lambda: [AA]  Source wavelength.
* L1:     [m]   Distance from source to monochromator.
* OMM:    [deg] Rotation angle of monochromator, i.e. angle of incidence.
* TTM:    [deg] Scattering angle at which to put the detector.
* BEND:   [m]   Curvature radius of the monochromator crystal lattice. Only relevant for Mono==2.
* monsiz: [m]   Size (h and w) of PSD measuring diffracted beam.
*
* %End
****************************************************************************/

DEFINE INSTRUMENT Test_Mono(int Mono=1, lambda=1.0, L1=10.0,OMM=14.2208,TTM=28.4416, BEND=1, monsiz=5e-5)

DECLARE
%{
  double DM  = 3.1356 ; /* Monochromator d-spacing in Angs */
			/* Si(111):           3.1356 */
      /* PG002 Orders : 1st 3.355 2e 1.6775, 3e 1.1183 */
  
  /* This variable helps us switch on and off the different setups*/
  double filterProb;
%}
/* end of DECLARE */

INITIALIZE
%{
  int    ORDER = 1;
  double Ki, mono_q, SM;
  
  /* SM : scattering at mono to the right (-1)/left(+1) */
  SM = -1;
  
  mono_q = 2*PI*ORDER/DM;  /* Q mono in Angs-1 */

  Ki = 2*PI/lambda; 
  
  if (!TTM)
    TTM = asin(mono_q/2/Ki)*RAD2DEG*2*SM;
    
  if (!OMM)
    OMM = TTM/2;

%}
/* end of INITIALIZE */

TRACE
/* Source description */

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

/* a flat constant source */

COMPONENT generic_source=Source_flat(
    E0=8.05, dE=0.9,
    xwidth=1.0e-5, yheight=1.0e-5,
    focus_xw=1.0e-5,focus_yh=1.0e-5, dist=L1
)
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT psd_pre = PSD_monitor(xwidth = 0.10, yheight = 0.10,
        nx=20, ny=20, filename="psd2.dat")
AT (0, 0, 0.5) RELATIVE generic_source

COMPONENT emon_pre = E_monitor(nE=200, xwidth=0.1, yheight=0.1,
        xwidth=0, yheight=0, nE=200, Emin=8,Emax=8.1, restore_xray=1,filename="emon_pre.dat")
AT (0, 0, 0.6) RELATIVE generic_source

COMPONENT Mono_Arm = Arm()
AT (0, 0, L1) RELATIVE generic_source
ROTATED (-OMM, 0, 0) RELATIVE generic_source

% ------------------------------------------------------------------------------
% rotation along X, monochromator surface is in the XZ plane

COMPONENT Mono_obso = Perfect_crystal(
        length=0.05, width=0.02, V=160.1826, h=1, k=1, l=1, alpha=0)
WHEN Mono==0 AT (0, 0, 0) RELATIVE Mono_Arm

COMPONENT Mono1 = Bragg_crystal(
        length=0.05, width=0.02, V=160.1826, h=1, k=1, l=1, alpha=0)
WHEN Mono==1 AT (0, 0, 0) RELATIVE Mono_Arm

COMPONENT Mono1b = Bragg_crystal_bent(
        length=0.05, width=0.02, V=160.1826, h=1, k=1, l=1, alpha=0,y_b=BEND, lattice_y_b=BEND, z_c=BEND, lattice_z_c=BEND)
WHEN Mono==2 AT (0, 0, 0) RELATIVE Mono_Arm

COMPONENT MonoBC = Bragg_crystal_BC(
        length=0.05, width=0.02, V=160.1826, h=1, k=1, l=1, alphay=1)
WHEN Mono==3 AT (0, 0, 0) RELATIVE Mono_Arm

COMPONENT MonoBCb = Bragg_crystal_bent_BC(
        length=0.05, width=0.02, V=160.1826, h=1, k=1, l=1, alpha=0)
WHEN Mono==4 AT (0, 0, 0) RELATIVE Mono_Arm

COMPONENT MonoBCs = Bragg_crystal_simple(
    yheight=0.05, xwidth=0.02, DM=DM, err_Q= 0.000075, r0=1.0)
WHEN Mono==5 AT (0,0,0) RELATIVE Mono_Arm
ROTATED(90,0,0) RELATIVE Mono_Arm

COMPONENT MonoBCsx = Single_crystal(xwidth=0.02, yheight=0.0001, zdepth=0.05,
      delta_d_d=1e-4, mosaic = 5,
      reflections="Si.lau")
WHEN Mono==6 AT (0,0,0) RELATIVE Mono_Arm
ROTATED(0,0,0) RELATIVE Mono_Arm

% ------------------------------------------------------------------------------

COMPONENT Mono_Out = Arm()
AT (0, 0, 0) RELATIVE Mono_Arm
ROTATED (-TTM, 0, 0) RELATIVE generic_source

COMPONENT fpi = PSD_monitor_4PI(radius=0.1, filename="fpi",nx=51,ny=51)
AT(0,0,0) RELATIVE Mono_Out

COMPONENT psd1 = PSD_monitor(xwidth = monsiz, yheight = monsiz,
        nx=50, ny=50, filename="psd1.dat")
AT (0, 0, 1) RELATIVE Mono_Out

COMPONENT emon = E_monitor(nE=200, xwidth=0.1, yheight=0.1,
        xwidth=0, yheight=0, nE=200, Emin=8,Emax=8.1, restore_xray=1,filename="emon.dat")
AT (0, 0, 1.1) RELATIVE Mono_Out

COMPONENT emon_zm = E_monitor(nE=50, xwidth=0.1, yheight=0.1,
        xwidth=0, yheight=0, nE=200, Emin=8.0475,Emax=8.05, restore_xray=1,filename="emonzm.dat")
AT (0, 0, 1.1) RELATIVE Mono_Out

END