/******************************************************************************* * McStas instrument definition URL=http://www.mcstas.org * * Instrument: test (rename also the example and DEFINE lines below) * * %Identification * Written by: Linda Udby (udby@fys.ku.dk) * Date: 09.04.10 * Origin: University of Copenhagen * Release: McStas CVS-080208 * Version: 0.2 * %INSTRUMENT_SITE: Institution_name_as_a_single word * * Instrument short description * * %Description * Instrument longer description (type, elements, usage...) * * Example: mcrun test.instr * * %Parameters * Par1: [unit] Parameter1 description * * %Link * A reference/HTML link for more information * * %End *******************************************************************************/ /* Change name of instrument and input parameters with default values */ DEFINE INSTRUMENT MonoCurved(a1=37.07,a2=74.14,LMIN=3.9,LMAX=4.2,MOSH=40,MOSV=40,RV=1) /* The DECLARE section allows us to declare variables or small */ /* functions in C syntax. These may be used in the whole instrument. */ DECLARE %{ double nm=1e-9; double LSPREAD; double LMEAN; %} /* The INITIALIZE section is executed when the simulation starts */ /* (C code). You may use them as component parameter values. */ INITIALIZE %{ LSPREAD = (LMAX - LMIN)/2; LMEAN = LMIN + LSPREAD; %} /* 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 a neutron source ! */ /* Progress_bar is an Arm displaying simulation progress. */ COMPONENT Origin = Progress_bar() AT (0,0,0) ABSOLUTE COMPONENT Source = Source_simple( height = 0.1, width = 0.1, dist = 10, xw = 0.1, yh = 0.1, Lambda0 = LMEAN, dLambda = LSPREAD, flux = 1, gauss = 0) AT (0, 0, 0) RELATIVE Origin COMPONENT Arm1 = Arm( ) AT (0, 0, 10) RELATIVE Source ROTATED (0, a1, 0) RELATIVE Source COMPONENT Arm2 = Arm( ) AT (0, 0, 10) RELATIVE Source ROTATED (0, a2, 0) RELATIVE Source COMPONENT Monochromator = Monochromator_curved( reflect = "HOPG.rfl", transmit = "HOPG.trm", zwidth = 0.1, yheight = 0.02, NH = 1, NV = 5, mosaich = MOSH, mosaicv = MOSV, r0 = 1, t0 = 1, Q = 1.8734, RV = RV, RH = 0, width = 0.1, height = 0.1, verbose = 1) AT (0, 0, 0) RELATIVE Arm1 EXTEND %{ if(!SCATTERED) ABSORB; %} COMPONENT PSDsphere = PSD_monitor_4PI( nx = 1000, ny = 1000, filename = "PSDsphere", restore_neutron = 1, radius = 1-nm) AT (0, 0, 10) RELATIVE Source COMPONENT PSD = PSD_monitor( nx = 1000, ny = 1000, filename = "PSD.dat", restore_neutron = 1, xwidth = 0.1, yheight = 0.1) AT (0, 0, 1) RELATIVE Arm2 COMPONENT DivMon = Divergence_monitor( nh = 200, nv = 200, filename = "DivMon.dat", restore_neutron = 1, xwidth = 0.2, yheight = 0.2, h_maxdiv = 5, v_maxdiv =5) AT (0, 0, 1+nm) RELATIVE Arm2 COMPONENT LambdaMon = L_monitor( nchan = 1000, filename = "LambdaMon", restore_neutron = 1, xwidth = 0.1, yheight = 0.1, Lmin = LMIN-1, Lmax = LMAX+1) AT (0, 0, 1+2*nm) RELATIVE Arm2 COMPONENT PSDsamplesize = PSD_monitor( nx = 100, ny = 100, filename = "PSDsamplesize.dat", restore_neutron = 1, xwidth = 0.01, yheight = 0.03) AT (0, 0, 1+3*nm) RELATIVE Arm2 // COMPONENT HDivLambda = DivLambda_monitor( // nlam = 1000, ndiv = 1000, filename = "HDivLambda.dat", // restore_neutron = 1, xwidth = 0.20, yheight = 0.20, // maxdiv = 2, lambda_0 = LMIN-1, lambda_1 = LMAX+1) // AT (0, 0, 1+3*nm) RELATIVE Arm2 /* 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