File: SOLEIL_MARS.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 (343 lines) | stat: -rw-r--r-- 9,972 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
/*******************************************************************************
* Instrument: SOLEIL_MARS
*
* %Identification
* Written by: IGUILIZ Salah-Eddine, MENUT Denis and FARHI Emmanuel.
* Date: July 2022
* Origin: SOLEIL
* Version: 1.0
* %INSTRUMENT_SITE: SOLEIL
*
* The MARS beam-line at Synchrotron SOLEIL.
*
* %Description
* MARS beamline is aiming to extend the research capabilities on radioactive
* matter towards the use of synchrotron radiation in multidisciplinary fields
* biology, chemistry, physics) with respect to national and European safety law*.
*
* The design of MARS beamline (infrastructure and optics) is also optimized to
* alternatively run two experimental stations in orlder to perform
* characterizations with transmission and high resolution X-ray powder-diffraction
* (XRD), Wide Angle X-ray Scattering (WAXS), Small Angle X-ray scattering (SAXS),
* standard and high resolution X-ray absorption spectroscopy (XANES, EXAFS and
* HERFD-XANES) and microbeam techniques (microXRF, XAS, XRD).
*
* This model implements the XRD station for powders.
*
* %Example: E0=16.99 Detector: detector_diffraction_I=2.56e+09
*
* %Parameters
* E0: [keV]     Central energy to be emitted by the source
* dEr: [1]    Relative half width to emitted by the source, e.g. 1e-4
* alpha: [deg]  Asymmetry angle for the crystals.
* reflections: [str] Sample structure file, LAU/CIF format.
* reflec_material_M12: [str] reflecting coating on curved mirrors, e.g. Pt
*
* %Link
* https://www.synchrotron-soleil.fr/en/beamlines/mars
* 
* %End
*******************************************************************************/
DEFINE INSTRUMENT SOLEIL_MARS(E0=16.99,
  string reflec_material_M12="Pt.dat",
  string reflections="LaB6_660b_AVID2.hkl", 
  dEr=1e-4,alpha=0)

DECLARE
%{
	  //Slit 1
	double DistanceToPrimarySlit1 = 11.340;
	double DistanceToPrimarySlit2 = 11.440;
	double PrimarySlit1Width  = 0.02;
	double PrimarySlit1Height = 0.002;
	double PrimarySlit2Width  = 0.02;
	double PrimarySlit2Height = 0.002;

	//Mirror M1
	double DistanceSourceToM1 = 12.784;
	double M12_depth = 0.06;
	double M12_length = 2.1;
	double AngleM1 = 0.0031*RAD2DEG;

	//DCM
	double DistanceSourceToDCM = 14.395;
	double DcmGap = 0.101268;
	double AngleDCM = 10.59;
	double alpha = 0;
	double DcmHoriGap = 0.09863;
	double Ts=0.04506/(2*0.1832);
	double Tz=0.04506/(2*0.9830);
	//double DiagonaleDcmGap = sqrt(Ts*Ts+Tz*Tz);

	//BeamMonitor1
	double DistanceToPrimaryBeamMonitor = 15.678;
	double PrimaryBeamMonitorWidth = 0.05;
	double PrimaryBeamMonitorHeight = 0.05;

	//Mirror M2
	double DistanceSourceToM2 = 16.826;
	double AngleM2 = 0.0031*RAD2DEG;
	double RadiusM1 = 8248;
  double RadiusM2 = 6600;

	//Slit 2
	double DistanceToSecondarySlit1 = 18.231;
	double DistanceToSecondarySlit2 = 18.315;
	double SecondarySlit1Width  = 0.03; // 3x5
	double SecondarySlit1Height = 0.05;
	double SecondarySlit2Width  = 0.005;
	double SecondarySlit2Height = 0.03;

	//BeamMonitor2
	double DistanceToSecondaryBeamMonitor = 18.588;
	double SecondaryBeamMonitorWidth = 0.5;
	double SecondaryBeamMonitorHeight = 0.5;
	
	//Sample

	double DistanceToSample = 23.06;


	//cristal analyzor
	double DistanceCentreToCristal = 0.446;
	double AngleCa = 6.2267;
	
	//slit A1
	double distanceCristalslitA1 = 0.194;



	//slit A2
	double distanceCristalslitA2 = 0.224;


	//detector
	double distanceCristaldetector = 0.224;


	/* Declarations */
	
	double M12_width=0.05;
  double calculated_angle;
%}

INITIALIZE
%{
    calculated_angle=RAD2DEG*asin(12398.42*sqrt(8)/(2*5.4309*(E0*1e3)));
    fprintf(stdout,"%s: Energy %g [keV] Mono Angle %g [deg]\n", NAME_INSTRUMENT, E0, calculated_angle);
    
%}

TRACE

COMPONENT origin = Progress_bar()
AT (0, 0, 0) RELATIVE ABSOLUTE

COMPONENT Source = Bending_magnet(
    focus_xw=PrimarySlit1Width,
    focus_yh=PrimarySlit1Height,
    E0=E0, dE = dEr*E0,
    Ee = 2.75, Ie = 0.5, B = 1.71, sigex=79.6e-6, sigey=25.3e-6,
    dist=DistanceToPrimarySlit1
    )
AT (0, 0, 0) RELATIVE origin

/*Wavelength*/
COMPONENT displaySourceLength = Monitor_nD(
  xwidth=0.2, yheight=0.2, options="energy",
  bins=512, min=E0*(1-dEr), max=E0*(1+dEr)
)
AT(0,0,2) RELATIVE Source

/*Visualise*/
COMPONENT displaySource = PSD_monitor(
	filename="emon_psd1"
)
AT(0,0,10) RELATIVE Source

/* ------------------------------------- Vertical slit 1 */
COMPONENT slit1 = Slit(
    xwidth=PrimarySlit1Width, 
    yheight=PrimarySlit1Height)
AT (0, 0, DistanceToPrimarySlit1) RELATIVE Source

/* -------------------------------------- Horizontal slit 1 */
COMPONENT slit2 = Slit(
    xwidth=PrimarySlit2Width, 
    yheight=PrimarySlit2Height)
AT (0, 0, DistanceToPrimarySlit2) RELATIVE Source

/* -------------------------------------- Mirror M1 */  

COMPONENT M1_arm_translation = Arm()
AT(0,0,DistanceSourceToM1) RELATIVE Source


COMPONENT M1_arm_rotation_1 = Arm()
AT(0,0,0) RELATIVE PREVIOUS
ROTATED (0,0, -90) RELATIVE PREVIOUS

COMPONENT mirror_M1 = Mirror_curved(
    length = M12_length,
    width = M12_width,
    radius = RadiusM1,
    coating=reflec_material_M12)    
AT (0, 0, 0) RELATIVE PREVIOUS
ROTATED (0,AngleM1, 0) RELATIVE PREVIOUS

COMPONENT M1_arm_rotation_2 = Arm()
AT(0,0,0) RELATIVE PREVIOUS
ROTATED (0,AngleM1, 0) RELATIVE PREVIOUS

COMPONENT M1_arm_rotation_2_undo = Arm()
AT(0,0,0) RELATIVE PREVIOUS
ROTATED (0,0, 90) RELATIVE PREVIOUS


COMPONENT beam_arm_before_crystal = Arm()
AT(0,0,DistanceSourceToDCM-DistanceSourceToM1) RELATIVE PREVIOUS

/*----------------------------------------Monochromator (fixed offset)*/
COMPONENT dcm_xtal0 = Bragg_crystal(
    length=0.04, width=0.05,
    alpha=alpha, h=2, k=2, l=0, material="Si.txt",crystal_type=2)    
AT(0,0,0) RELATIVE PREVIOUS
ROTATED (-calculated_angle,0,0) RELATIVE PREVIOUS

COMPONENT dcm0 = Arm()
AT(0,0,0) RELATIVE dcm_xtal0
ROTATED (-calculated_angle,0,0) RELATIVE PREVIOUS

//this dcm is a fixed offset dcm, the second crystal translates itself
//The  double  crystal  monochromator  (DCM),  manufactured  by  FMB  Oxford,  is  equipped  with  14 independent motorized stages in order to optimize its alignment and then to assure a fixed exit beam over the entire energy range with a constant upward offset of 20 mm with respect to the primary beam. https://iopscience.iop.org/article/10.1088/1742-6596/190/1/012042/pdf
COMPONENT dcm_xtal1 = COPY(dcm_xtal0)(length=0.02)
AT(0,20e-3, calculated_angle ? 20e-3/tan(calculated_angle*DEG2RAD) : 0) RELATIVE dcm_xtal0
ROTATED (calculated_angle,0,0) RELATIVE dcm0

COMPONENT dcm1 =Arm()
AT(0,0,0) RELATIVE dcm_xtal1
ROTATED (calculated_angle,0,0) RELATIVE dcm_xtal1

/*---------------------------------------- BeamMonitor1 */
COMPONENT emon_dcm0 = E_monitor(
	xwidth=PrimaryBeamMonitorWidth, 
	yheight=PrimaryBeamMonitorHeight, 
	filename="emon_dcm0", 
	Emin=E0-dEr*E0, 
	Emax=E0+dEr*E0, 
	nE=101)
AT(0,0,DistanceToPrimaryBeamMonitor-DistanceSourceToDCM) RELATIVE dcm1


/*Visualise*/
COMPONENT displayMono = PSD_monitor(
	filename="emon_psd"
)
AT(0,0,0) RELATIVE PREVIOUS

/*Wavelength*/
COMPONENT displayMonoLength = E_monitor(
  xwidth=0.2, yheight=0.2,
  nE=512, filename="Output.E", Emin=E0*(1-dEr), Emax=E0*(1+dEr)
)
AT(0,0,0) RELATIVE PREVIOUS

/* -------------------------------------- Toroidal mirror M2 */   
COMPONENT M2_arm_translation = Arm()
AT(0,0,DistanceSourceToM2-DistanceToPrimaryBeamMonitor) RELATIVE PREVIOUS

COMPONENT M2_arm_rotation_1 = Arm()
AT(0,0,0) RELATIVE PREVIOUS
ROTATED (0,0, 90) RELATIVE PREVIOUS

COMPONENT mirror_M2 = Mirror_curved(
    length = M12_length,
    width = M12_width,
    radius = RadiusM2,
    coating=reflec_material_M12)    
AT (0, 0, 0) RELATIVE PREVIOUS   
ROTATED (0,AngleM2, 0) RELATIVE PREVIOUS


COMPONENT M2_arm_rotation_2 = Arm()
AT(0,0,0) RELATIVE PREVIOUS
ROTATED (0,AngleM2, 0) RELATIVE PREVIOUS

COMPONENT M2_arm_rotation_2_undo = Arm()
AT(0,0,0) RELATIVE PREVIOUS
ROTATED (0,0,-90) RELATIVE PREVIOUS


/* ------------------------------------- Vertical slit 2 */
COMPONENT slitSecon1 = Slit(
    xwidth=SecondarySlit1Width, 
    yheight=SecondarySlit1Height)
AT (0, 0, DistanceToSecondarySlit1-DistanceSourceToM2) RELATIVE PREVIOUS

/* -------------------------------------- Horizontal slit 2 */
COMPONENT slitSecon2 = Slit(
    xwidth=SecondarySlit2Width, 
    yheight=SecondarySlit2Height)
AT (0, 0, DistanceToSecondarySlit2-DistanceToSecondarySlit1) RELATIVE PREVIOUS

/*---------------------------------------- BeamMonitor2 */
COMPONENT emon_dcm1 = E_monitor(
	xwidth=SecondaryBeamMonitorWidth, 
	yheight=SecondaryBeamMonitorHeight, 
	filename="BeamMonitor2", 
	Emin=E0-dEr*E0, 
	Emax=E0+dEr*E0, 
	nE=101)
AT(0,0,DistanceToSecondaryBeamMonitor-DistanceToSecondarySlit2) RELATIVE PREVIOUS

/*Visualise*/
COMPONENT displaySlit2 = PSD_monitor(
	filename="emon_psd3"
)
AT(0,0,0) RELATIVE PREVIOUS


/*------------------------------------ Sample */
SPLIT 10 COMPONENT Sample = PowderN(
  reflections = reflections,
  xwidth = 0.005,
  yheight = 0.05,
  zdepth = 0.0001,
  d_phi=asin(0.02/0.670)*RAD2DEG,
  p_interact=0.5
)
AT (0, 0, DistanceToSample-DistanceToSecondaryBeamMonitor) RELATIVE PREVIOUS
GROUP samples

// The Rayleigh scattering at E0 is large, and creates massive background.
// We ignore it here.
COMPONENT SampleF = Fluorescence(
  material=reflections,
  xwidth = 0.005,
  yheight = 0.05,
  zdepth = 0.0001,
  focus_ah=asin(0.02/0.670)*RAD2DEG,
  focus_aw=180, target_z=1, flag_rayleigh=0,
  p_interact=0.99)
AT (0, 0, 0) RELATIVE PREVIOUS
GROUP samples



/*------------------------------------- detector */
COMPONENT detector_diffraction = Monitor_nD(
  bins=90000, options="abs theta",
  min=5,max=90, radius= 0.670, yheight = 0.02, restore_xray=1
)
WHEN (0.75 * E0 < K2E*sqrt(kx*kx+ky*ky+kz*kz)) // model detector energy discrimination
AT(0,0,0) RELATIVE Sample

COMPONENT detector_fluo = Monitor_nD(
  bins=1024, options="energy", min=0, max=E0*1.2,
  radius= 0.670, yheight = 0.02
)
WHEN (K2E*sqrt(kx*kx+ky*ky+kz*kz) < 0.95*E0)
AT(0,0,0) RELATIVE Sample


END