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
|
/*******************************************************************************
* McXtrace instrument definition URL=http://www.mcxtrace.org
*
* Instrument: Template_2Slit_Diff
*
* %Identification
* Written by: Erik B Knudsen (erkn@fysik.dtu.dk)
* Date: Jan 2014
* Origin: DTU Physics
* Version: 1.0
* %INSTRUMENT_SITE: Templates
*
* An example instrument showing a Young's double slit experiment
*
* %Description
* A template instrument that shows double slit diffraction.
* Two identical slits are positioned 1m downstream from a point source, The slit
* width and their separation may be varied. The slit height is set to .8e-6 m.
*
* %Example: SLITW=1e-6 SLITSEP=4e-6 Detector: psd0_I=7.1e-14
*
* %Parameters
* SLITW: [m] Width of the slit in question.
* SLITSEP: [m] Double slit separation.
*
* %End
*******************************************************************************/
/* Change name of instrument and input parameters with default values */
DEFINE INSTRUMENT Template_2Slit_Diff(SLITW=1e-6, SLITSEP=4e-6)
/* The DECLARE section allows us to declare variables or small */
/* functions in C syntax. These may be used in the whole instrument. */
DECLARE
%{
double slit_offset;
%}
/* The INITIALIZE section is executed when the simulation starts */
/* (C code). You may use them as component parameter values. */
INITIALIZE
%{
slit_offset=SLITSEP*0.5;
%}
/* 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 an xray source ! */
/* Progress_bar is an Arm displaying simulation progress. */
COMPONENT Origin = Progress_bar()
AT (0,0,0) ABSOLUTE
COMPONENT source=Source_pt(
focus_xw=6e-6, focus_yh=0.8e-6, dist=1, E0=12.398/2.0, dE=0, gauss=1, randomphase=0)
AT(0,0,0) RELATIVE Origin
COMPONENT s1 = Slit(
xwidth=SLITW, yheight=0.8e-6, dist=1,
focus_xw=200e-6,focus_yh=2e-6,
focus_x0=0.0,focus_y0=0.0
)
AT(slit_offset,0,1) RELATIVE source
GROUP slits
COMPONENT s2 = COPY(s1)()
AT(-slit_offset,0,1) RELATIVE source
GROUP slits
COMPONENT psd00 = PSD_monitor_coh(
yheight=2e-6, xwidth=200e-6, nx=501, ny=1, filename="psd00")
AT(0,0,1+1e-6) RELATIVE source
COMPONENT psd0 = PSD_monitor_coh(
yheight=2e-6, xwidth=200e-6, nx=501, ny=1, filename="psd0")
AT(0,0,2) RELATIVE source
/* 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
|