Ticket #7: ILL_H22_D1B.instr

File ILL_H22_D1B.instr, 12.5 KB (added by farhi, 3 years ago)

D1B difractometer on H22 guide at ILL: compare 3 available collimators

Line 
1/******************************************************************************* 
2* McStas instrument definition URL=http://mcstas.risoe.dk     
3*   
4* Instrument: ILL_H22_D1B
5*   
6* %Identification
7* Written by: FARHI Emmanuel (farhi@ill.fr) and SANCHEZ Javier (sanchez-montero@ill.fr)   
8* Date: June, 2008
9* Origin:ILL
10* Release: McStas 1.12   
11* Version: $Revision: 1.3 $   
12* %INSTRUMENT_SITE: ILL   
13*   
14* The D1B diffractometer on the H22 curved thermal guide at the ILL   
15*   
16* %Description   
17* The D1B diffractometer on the H22 curved thermal guide at the ILL.
18*
19* D1B is a two-axis spectrometer dedicated to diffraction experiments requesting a
20* high neutron flux. A great number of experiments performed on D1B concern the
21* determination of magnetic structures. At small angles where the magnetic peaks
22* are expected, a high spatial resolution can be achieved, the FWHM reaches 0.2°
23* (for a sample with = 8 mm). Three pyrolitic graphite monochromators focusing
24* onto the sample position provide a flux of 6.5·106 n cm-2s-1. A second
25* wavelength with = 1.28 Å is available by using a germanium monochromator. D1B is
26* equipped with 3He/Xe position-sensitive detector composed of a system of
27* multi-electrodes with 400 cells, which span a 2 range of 80°. The detector can
28* be moved so that an angular range of 2°<2<130° can be covered. The specially
29* designed cryostat is known for its low background crucial for some experiments
30* with small intensity changes. Because of its high flux at = 2.52 Å together with
31* the large multi-detector, surface studies such as adsorbed phases as well as
32* real-time diffraction experiments are possible. Collecting a diffraction pattern
33* with sufficient statistics in minutes (1-5 min) even seconds allows in situ
34* studies of reaction kinetics. A fast detection of phase transitions can also be
35* obtained by scanning the temperature. A complete thermal variation of the
36* diffraction patterns (1.5 - 300 K) can be achieved in few hours (3-5h).
37*
38* Input parameters:
39* m: [1]   m-value of whole guide coating. 0 absorbing, 1 for Ni, 1.2 for Ni58, 2-4 for SM
40* lambda:    [AA]  mean incident wavelength.
41* dlambda:   [AA]  wavelength full width.
42* RV:[m]   Monochromator vertical curvature, 0 for flat, -1 for automatic setting
43* L1:[m]   Source-Monochromator distance
44* L2:[m]   Monochromator-Sample distance
45* L3:[m]   Sample-Detector distance
46* Powder:    [str] File name for powder description, LAZ/LAU/Fullprof
47* verbose:   [1]   Print DIF configuration. 0 to be quiet
48* R_pitch:   [deg] Angular pitch between the absorbing blades
49* R_ri:      [m]   Inner radius of the collimator
50* R_ro:      [m]   Outer radius of the collimator
51* R_h:       [m]   Height of the collimator
52* R_ttmin:   [deg] Lower scattering angle limit
53* R_ttmax:   [deg] Higher scattering angle limit
54* R_present: [1]   Presence flag of this component
55* Inc_Cryo:  [1]   Cryostat incoherent fraction
56* Trans_Cryo:[1]   Cryostat event transmission
57* Trans_Spl: [1]   Sample event transmission
58* Inc_Spl:   [1]   Sample incoherent fraction
59* TILT:      [deg] Monochromator additional tilt, for rocking curves
60* TRAS_X:    [m]   Additional monochromator translation along X, left/righ w.r.t beam
61* TRAS_Z:    [m]   Additional monochromator translation along Z, along guide
62*   
63* %End     
64*******************************************************************************/ 
65
66DEFINE INSTRUMENT ILL_H22_D1B(lambda=2.52, dlambda=0.03, DM=3.355, 
67  string Powder="Na2Ca3Al2F14.laz", RV=2.2,
68  L1=0.25, L2=3.0, L3=1.500, 
69  TRAS_X=-0, TRAS_Z=0, TILT=0, TAKE_OFF=0,
70  R_pitch=.42, R_ri=0.324, R_ro=0.419, R_h=0.090,   
71  R_ttmin=-130, R_ttmax=-2, R_present=1,
72  verbose=1, Inc_Cryo=0.02, Trans_Cryo=0.85, Trans_Spl=0.2, Inc_Spl=0.05)
73
74/* The DECLARE section allows us to declare variables or  small      */       
75/* functions in C syntax. These may be used in the whole instrument. */       
76DECLARE     
77%{     
78
79/* for D1B monochromator */   
80double A1; /* rotation of monok and d-spacing */
81/* flags to separate scattering processes */
82double flag_sample=0, flag_env=0;     
83
84%} 
85
86/* The INITIALIZE section is executed when the simulation starts     */       
87/* (C code). You may use them as component parameter values. */       
88INITIALIZE 
89%{ 
90/* transfert instrument parameters for components */
91double KI, Vi, EI;
92
93A1 =asin(lambda/(2*DM))*RAD2DEG; 
94if (TAKE_OFF==0) TAKE_OFF=2*A1;         
95if (RV < 0) RV=2*L2*sin(DEG2RAD*A1);   
96KI = 2*PI/lambda;   
97Vi = K2V*fabs(KI);
98EI = VS2E*Vi*Vi; 
99
100if (verbose) {   
101  printf("%s: Detailed D1B configuration\n", NAME_CURRENT_COMP);
102  printf("* Incoming beam: lambda=%.4g [Angs] EI=%.4g [meV]  KI=%.4g [Angs-1] Vi=%g [m/s]\n",   
103    lambda, EI, KI, Vi); 
104  printf("* Monochromator:  DM=%.4g [Angs] RV=%.4g [m] %s, take-off A1=%.4g [deg]\n",     
105    DM, RV, (!RV ? "flat" : "curved"), A1);
106  printf("* Sample: '%s' in Al cryostat.\n", Powder);   
107}   
108
109%} 
110
111/* Here comes the TRACE section, where the actual      */       
112/* instrument is defined as a sequence of components.  */       
113TRACE   
114
115%include "ILL_H22.instr"   
116
117/* additional horizontal divergence monitor at end of guide */
118/* also defines a static position to orient remaining instrument */
119COMPONENT alpha1_b = Monitor_nD(
120  xwidth=0.03, yheight=0.2, restore_neutron=1,
121  options="dx, all auto, per cm2, slit", restore_neutron=1)     
122AT (0, 0, L1) RELATIVE PREVIOUS     
123
124/* TIP: monochromator cradle */     
125SPLIT COMPONENT mono_cradle = Arm() 
126  AT (TRAS_X, 0, TRAS_Z) RELATIVE alpha1_b
127  ROTATED (0, A1, 0) RELATIVE alpha1_b
128
129/* TIP: curved monochromator with NH>1 NV>1 et RH>0 RV>0 */
130COMPONENT Monok = Monochromator_curved(     
131    width = 0.060, height = 0.15, NH = 1, NV = 3, RV=RV,
132    mosaich = 20, mosaicv = 20, DM = DM)   
133AT (0, 0, 0) RELATIVE mono_cradle
134ROTATED (0, TILT, 0) RELATIVE mono_cradle
135
136/* TIP: positioning diffraction direction for monok (order 1) */   
137COMPONENT mono_out = Arm()
138AT (0, 0, 0) RELATIVE mono_cradle 
139ROTATED (0, A1, 0) RELATIVE mono_cradle
140
141/* descentrado del tubo de colimacion */ 
142COMPONENT mono_out2 = Arm()   
143AT (0, 0, 2.5) RELATIVE mono_out 
144ROTATED (0, 0.0, 0) RELATIVE mono_out
145
146/* Monitor a la altura del shuttle  */
147COMPONENT monitor_shuttle = Monitor_nD(     
148  options="x y", bins=50, xwidth = 0.030,
149  yheight = 0.20)     
150AT (0,0,0.75) RELATIVE mono_out   
151
152/* filtro de grafito -ocupa toda la linea- */       
153COMPONENT filtro_D1B = Filter_graphite(     
154        xmin=-0.05, xmax=0.05, ymin=-.10, ymax=.10, length=0.20)
155AT (0,0,0.75) RELATIVE mono_out     
156
157
158/* Linea propia de D1B, desde el monocromador hasta Slits*/   
159/*                                                      distancia desde el monocromador         ancho           alto   */   
160/*slit_fijo                     985.5                                                                                                                   50                      118    */   
161/*Ventana_1                     1176                                                                                                                    50                      112    */   
162/*Ventana_2                     1436                                                                                                                    50                      112    */   
163/*Ventana_3                     1753                                                                                                                    50                      112    */   
164
165
166/* slit fija  */ 
167COMPONENT slit_fija = Slit(   
168  xmin = -0.025, xmax = 0.025,
169  ymin = -0.059, ymax = 0.059)
170  AT (0, 0, 0.9855-2.500) RELATIVE mono_out2
171
172/* ventana 1  */ 
173COMPONENT ventana_1 = Slit(   
174  xmin = -0.025, xmax = 0.025,
175  ymin = -0.056, ymax = 0.056)
176  AT (0, 0, 1.176-2.500) RELATIVE mono_out2
177
178/* ventana 2  */ 
179COMPONENT ventana_2 = Slit(   
180  xmin = -0.025, xmax = 0.025,
181  ymin = -0.056, ymax = 0.056)
182  AT (0, 0, 1.436-2.500) RELATIVE mono_out2
183
184/* ventana 3  */ 
185COMPONENT ventana_3 = Slit(   
186  xmin = -0.025, xmax = 0.025,
187  ymin = -0.056, ymax = 0.056)
188  AT (0, 0, 1.753-2.500) RELATIVE mono_out2
189
190/* linea completamente absorbente m = 0 */ 
191/* COMPONENT D1B_line = Guide_gravity(  */ 
192/*   w1=0.15, h1=0.25, w2=0.15, h2=0.25, l=0.70,*/ 
193/*   R0=gR0, Qc=gQc, alpha=gAlpha, m=0, W=gW)   */ 
194/* AT (0,0,0.3) RELATIVE mono_out */ 
195
196
197/* Monitor de control que coincide con las cuentas de monitor del D1B. Se ha introducido el comando SPLIT en los dos siguientes */
198COMPONENT monitor_D1B = Monitor_nD(   
199     options="auto lambda", bins=50, xwidth = 0.100,
200     yheight = 0.100)     
201     AT (0, 0, 2.478) RELATIVE mono_out     
202
203COMPONENT PSD_D1B = Monitor_nD(       
204     options="x y", bins=50, xwidth = 0.100,
205     yheight = 0.100)     
206         AT (0, 0, 2.478) RELATIVE mono_out     
207
208
209/* Slits ... Valores anteriores ~ xmin=-0.020, xmax=0.020,  */ 
210SPLIT COMPONENT slit_D1B = Slit(
211        xmin=-0.010, xmax=0.010, 
212        ymin = -0.015, ymax = 0.015)     
213        AT (0, 0, 0) RELATIVE mono_out2   
214EXTEND %{   
215  flag_sample=flag_env=0;   
216%} 
217
218/* Definicion del entorno.     */   
219/* Se fuerza que la difraccion se concentre en el detector, para aumentar la eficiencia.   */   
220
221
222COMPONENT Cryo_1 = PowderN(reflections="Al.laz",
223    radius = 0.061, thickness = 0.001, yheight = 0.10,     
224    concentric = 1, d_phi=RAD2DEG*atan(R_h/L3),
225    p_inc=Inc_Cryo, p_transmit=Trans_Cryo) 
226                AT (0,0,L2) RELATIVE mono_out     
227EXTEND     
228%{ 
229  flag_env+=SCATTERED;
230%} 
231
232COMPONENT Cryo_2 = COPY(Cryo_1)(radius = 0.0545, thickness = 0.001) 
233                AT (0,0,L2) RELATIVE mono_out     
234EXTEND     
235%{ 
236  flag_env+=SCATTERED;
237%} 
238
239COMPONENT Cryo_3 = COPY(Cryo_1)(radius = 0.039, thickness = 0.001) 
240                AT (0,0,L2) RELATIVE mono_out     
241EXTEND     
242%{ 
243  flag_env+=SCATTERED;
244%} 
245
246COMPONENT Cryo_4 = COPY(Cryo_1)(radius = 0.036, thickness = 0.001) 
247                AT (0,0,L2) RELATIVE mono_out     
248EXTEND     
249%{ 
250  flag_env+=SCATTERED;
251%}
252
253COMPONENT Sample = PowderN(                                                                     
254    reflections = Powder, radius = 0.0030,
255    p_transmit=Trans_Spl, p_inc=Inc_Spl,                                             
256    yheight = 0.040, d_phi=RAD2DEG*atan(R_h/L3))                 
257    AT (0, 0, L2) RELATIVE mono_out       
258EXTEND     
259%{ 
260  flag_sample=SCATTERED;
261%}
262
263COMPONENT COPY(Cryo_4)=COPY(Cryo_4)(concentric = 0)
264                AT (0,0,L2) RELATIVE mono_out     
265EXTEND     
266%{ 
267  flag_env+=SCATTERED;
268%} 
269
270COMPONENT COPY(Cryo_3)=COPY(Cryo_3)(concentric = 0)
271                AT (0,0,L2) RELATIVE mono_out     
272EXTEND     
273%{ 
274  flag_env+=SCATTERED;
275%} 
276
277COMPONENT COPY(Cryo_2)=COPY(Cryo_2)(concentric = 0)
278                AT (0,0,L2) RELATIVE mono_out     
279EXTEND     
280%{ 
281  flag_env+=SCATTERED;
282%} 
283
284COMPONENT COPY(Cryo_1)=COPY(Cryo_1)(concentric = 0)
285AT (0,0,L2) RELATIVE mono_out
286EXTEND     
287%{ 
288  flag_env+=SCATTERED;
289  if (!flag_sample && !flag_env) ABSORB;  /* TIP: perfect beamstop */     
290%} 
291
292
293/* se introduce el Collimator radial, he introducido el comando ROC       */ 
294/* http://www.mcstas.org/download/components/contrib/Collimator_ROC.comp  */ 
295/* ROC_pitch:  [deg] Angular pitch between the absorbing blades (1)       */ 
296/* ROC_ri:     [m]   Inner radius of the collimator     (0.4)     */ 
297/* ROC_ro:     [m]   Outer radius of the collimator     (1.2)     */ 
298/* ROC_h:      [m]   Height of the collimator     (0.153)   */ 
299/* ROC_ttmin:  [deg] Lower scattering angle limit (0)       */ 
300/* ROC_ttmax:  [deg] Higher scattering angle limit(100)     */ 
301/* ROC_sign:   [1]   Chirality/takeoff sign       (1)       */ 
302/* ROC_present:[1]   Presence flag of this component    (1)       */ 
303
304COMPONENT collimador_d20 = Collimator_ROC( 
305     ROC_pitch=R_pitch, ROC_ri=R_ri, ROC_ro=R_ro, ROC_h=R_h,   
306     ROC_ttmin=R_ttmin, ROC_ttmax=R_ttmax, ROC_sign=-1)
307  WHEN (R_present==1)
308        AT (0, 0, 0) RELATIVE Sample
309       
310COMPONENT collimador_rad = Collimator_radial( 
311     nchan=32, nslit=ceil((R_ttmax-R_ttmin)/32/R_pitch),
312     w1=0.015, w2=0.015, radius=R_ri, length=R_ro-R_ri, h1=R_h, h2=R_h,
313     theta_min=R_ttmin, theta_max=R_ttmax, roc=0, verbose=1)
314  WHEN (R_present==2)
315        AT (0, 0, 0) RELATIVE Sample
316
317COMPONENT collimador_contrib = Exact_radial_coll( 
318     nslit=ceil(128/R_pitch), radius=R_ri, length=R_ro-R_ri, h_in=R_h, h_out=R_h,
319     theta_min=R_ttmin, theta_max=R_ttmax, verbose=1)
320  WHEN (R_present==3)
321        AT (0, 0, 0) RELATIVE Sample
322
323/* perfect detector: 1D(theta). Se ha modificado los limites. Originalm ~ [-4 -130]*/     
324COMPONENT BananaTheta = Monitor_nD(   
325    options = "banana, theta limits=[-130 -2], bins=1280",     
326    xwidth = L3*2, yheight = R_h, restore_neutron=1)   
327  AT (0, 0, 0) RELATIVE Sample
328 
329COMPONENT BananaTheta_Sample = Monitor_nD(   
330    options = "banana, theta limits=[-130 -2], bins=1280",     
331    xwidth = L3*2, yheight = R_h)   
332  WHEN (flag_sample)
333  AT (0, 0, 0) RELATIVE Sample
334
335/* perfect detector: 2D(theta,y) to see diffraction rings. Originalmente: y bins=25 */   
336/* COMPONENT BananaPSD = Monitor_nD(  */       
337/*    options = "banana, theta limits=[-130 -2] bins=1280, y bins=150",   */   
338/*    xwidth = L3*2*1.005, yheight = 0.3) */ 
339/*  AT (0, 0, 0) RELATIVE Sample*/
340
341
342
343END
344
345
346