1/******************************************************************************* 2* McStas instrument definition URL=http://www.mcstas.org 3* 4* Instrument: RTP_DIF 5* 6* %Identification 7* Written by: E. Farhi and Megat Harun Al-Rashid 8* Date: June 2014 9* Origin: ILL/RTP 10* %INSTRUMENT_SITE: TRIGA 11* 12* A powder diffractometer at Reactor TRIGA PUSPATI (Malaysia) 13* 14* %Description 15* 16* 17* Example: mcrun RTP_DIF.instr lambda=2.36 Detector: det_I=170 18* 19* %Parameters 20* lambda: [Angs] Monochromator selected wavelength 21* DM: [Angs] d-spacing for the monochromator reflection 22* Mono_tilt: [deg] Tilt angle magnitude for the inner/outer mono slabs 23* powder: [str] Filename of the powder sample 24* det_rotation: [deg] Rotation of the portable detector 25* 26* %Link 27* <a href="http://www.nuclearmalaysia.gov.my/Plant&Facilities/reactor.php">Nuclear Malaysia</a> 28* %Link 29* M. Sufi et al., J. AppL Cryst. (1997). 30, 884-888 [doi:10.1107/S0021889897001738] 30* 31* %End 32*******************************************************************************/ 33DEFINE INSTRUMENT RTP_DIF(lambda=2.36, DM=3.355, Mono_tilt=0, string powder="Na2Ca3Al2F14.laz", det_rotation=45) 34 35/* The DECLARE section allows us to declare variables or small */ 36/* functions in C syntax. These may be used in the whole instrument. */ 37DECLARE 38%{ 39 double mono_index=0; 40%} 41 42/* The INITIALIZE section is executed when the simulation starts */ 43/* (C code). You may use them as component parameter values. */ 44INITIALIZE 45%{ 46 printf("%s: Monochromator take-off angle=%g [deg]\n", 47 NAME_CURRENT_COMP, 2*asin(lambda/2/DM)*RAD2DEG); 48%} 49 50/* Here comes the TRACE section, where the actual */ 51/* instrument is defined as a sequence of components. */ 52TRACE 53 54/* The Arm() class component defines reference points and orientations */ 55/* in 3D space. Every component instance must have a unique name. Here, */ 56/* Origin is used. This Arm() component is set to define the origin of */ 57/* our global coordinate system (AT (0,0,0) ABSOLUTE). It may be used */ 58/* for further RELATIVE reference, Other useful keywords are : ROTATED */ 59/* EXTEND GROUP PREVIOUS. Also think about adding a neutron source ! */ 60/* Progress_bar is an Arm displaying simulation progress. */ 61COMPONENT Origin = Progress_bar() 62 AT (0,0,0) ABSOLUTE 63 64/* the source is focused in wavelength to provide 5 Angs neutrons */ 65/* to study the Be filter, use white beam e.g. dlambda = 4.5 */ 66COMPONENT source = Source_gen( 67 radius = .154/2, 68 dist = 1.16+1.50, focus_xw = .11, focus_yh = .03, lambda0 = lambda, 69 dlambda = .2, I1 = 2.79e12/4/PI, T1 = 300) 70 AT (0, 0, 0) RELATIVE Origin 71 72COMPONENT CoarseCollimator1 = Guide(w1=.154, h1=.154, l=1.16125,m=0) 73 AT (0, 0, .01) RELATIVE PREVIOUS 74 75COMPONENT CoarseCollimator2 = Guide(w1=.11, h1=.11, l=1.5,m=0) 76 AT (0, 0, 1.16125+0.003) RELATIVE PREVIOUS 77 78/* a slit that also detects wavelength */ 79COMPONENT lmon = Monitor_nD( 80 xwidth=.11, options="slit disk, auto wavelength", bins=50) 81 AT (0, 0, 1.5+0.01) RELATIVE PREVIOUS 82 83/* Be filter ---------------------------------------------------------------- */ 84COMPONENT Be_Position = Arm() 85 AT (0, 0, .147+.15/2) RELATIVE PREVIOUS 86 87/* monochromator ------------------------------------------------------------ */ 88SPLIT COMPONENT mono_cradle = Arm() 89 AT (0, 0, .145+.15/2+.176) RELATIVE Be_Position 90 91COMPONENT mono_rotation = Arm() 92 AT (0, 0, 0) RELATIVE mono_cradle 93 ROTATED (0, -asin(lambda/2/DM)*RAD2DEG, 0) RELATIVE mono_cradle 94 EXTEND %{ 95 mono_index=0; 96 %} 97 98COMPONENT mono1 = Monochromator_curved( 99 width=.11, height=.03, NH=1,NV=1, RH=0, RV=0, 100 DM=DM, mosaich=48, mosaicv=48, 101 reflect="HOPG.rfl",transmit="HOPG.trm") 102 AT (-.01, 0, 0) RELATIVE mono_rotation 103 ROTATED (0, Mono_tilt, 0) RELATIVE mono_rotation 104 EXTEND %{ 105 if (SCATTERED) mono_index=1; 106 %} 107 108COMPONENT mono2 = COPY(mono1) 109 AT (0, 0, 0) RELATIVE mono_rotation 110 ROTATED (0, 0, 0) RELATIVE mono_rotation 111 EXTEND %{ 112 if (SCATTERED) mono_index=2; 113 %} 114 115COMPONENT mono3 = COPY(mono1) 116 AT (0.01, 0, 0) RELATIVE mono_rotation 117 ROTATED (0, -Mono_tilt, 0) RELATIVE mono_rotation 118 EXTEND %{ 119 if (SCATTERED) mono_index=3; 120 %} 121 122COMPONENT mono_takeoff = Arm() 123 AT (0, 0, 0) RELATIVE mono_cradle 124 ROTATED (0, -2*asin(lambda/2/DM)*RAD2DEG, 0) RELATIVE mono_cradle 125 126COMPONENT psd_transmit = Monitor_nD(xwidth=.12, yheight=.12, options="x y", bins=50) 127 AT (0, 0, 0.25) RELATIVE mono_cradle 128 GROUP mono_rt 129 130/* primary collimator (flight path) 3.8 m ----------------------------------- */ 131COMPONENT psd_reflect = Monitor_nD(xwidth=.12, yheight=.12, options="x y", bins=50) 132 AT (0, 0, 0.574) RELATIVE mono_takeoff 133 GROUP mono_rt 134 135COMPONENT lmon_reflect = Monitor_nD( 136 xwidth=.02, yheight=.02, user1=mono_index, 137 options="disk slit, auto wavelength, user1 limits=[0 4]", bins=50) 138 AT (0, 0, 0.575) RELATIVE mono_takeoff 139 140COMPONENT sample_psd = Monitor_nD( 141 xwidth=.02, yheight=.02, options="disk slit, x y", bins=50) 142 AT (0, 0, 0.575+.50) RELATIVE mono_takeoff 143 144/* sample ------------------------------------------------------------------- */ 145/* from JAC 1997: flux at sample = 3900 n/s/cm2 */ 146SPLIT 100 COMPONENT sample_position = Arm() 147 AT (0, 0, .575+.5+.01) RELATIVE mono_takeoff 148 149COMPONENT container_in = PowderN( 150 radius=0.01/2, yheight=0.04, thickness=-50e-6, 151 reflections="V.laz", concentric=1, d_phi=50, p_transmit=.95) 152 AT (0, 0, 0) RELATIVE sample_position 153 154COMPONENT sample = PowderN( 155 radius=0.01/2, yheight=0.04, reflections=powder, d_phi=atan2(0.5,1)*RAD2DEG) 156 AT (0, 0, 0) RELATIVE sample_position 157EXTEND %{ 158 if (!SCATTERED) ABSORB; 159%} 160 161COMPONENT container_out = COPY(container_in)(concentric=0) 162 AT (0, 0, 0) RELATIVE sample_position 163 164COMPONENT sample_out = Arm() 165 AT (0,0,0) RELATIVE sample_position 166 ROTATED (0,det_rotation,0) RELATIVE sample_position 167 168COMPONENT det_big = Monitor_nD( options="banana theta limits=[-150 150] bins=300, y bins=64", 169 radius=1, yheight=.5) 170 AT (0, 0, 0) RELATIVE sample_position 171 172/* secondary flight path (detector tube) 4m --------------------------------- */ 173COMPONENT det = Monitor_nD(xwidth=.5, yheight=.0254, bins=25, options="x") 174 AT (0, 0, 1) RELATIVE sample_out 175 176 177COMPONENT reactor = Shape(radius=.7/2, yheight=.4) 178 AT (0,0,-.35) RELATIVE Origin 179 180/* This section is executed when the simulation ends (C code). Other */ 181/* optional sections are : SAVE */ 182FINALLY 183%{ 184%} 185/* The END token marks the instrument definition end */ 186END 187 188 189