/******************************************************************************* * McStas instrument definition URL=http://www.mcstas.org * * Instrument: SNAP * * %Identification * Written by: Thomas Huegle * Date: 08/2018 * Updated by: Thomas Huegle * Date: * Origin: ORNL * Release: * Version: * %INSTRUMENT_SITE: SNS * * Instrument short description * * %Description * Instrument longer description (type, elements, usage...) * * Example: mcrun test.instr * * %Parameters * Par1: [unit] Parameter1 description * * %Link * * * %End *******************************************************************************/ /* Change name of instrument and input parameters with default values */ DEFINE INSTRUMENT SNAP(lambda = 2.1, IncidentCollRadius = 0.0025, IncidentCollPosition = 14.878, SampleColl_xwidth = 0.0016, SampleColl_yheight = 0.0006, SampleColl_up_pos = 14.98925, SampleColl_dn_pos = 14.98925) /* The DECLARE section allows us to declare variables or small */ /* functions in C syntax. These may be used in the whole instrument. */ DECLARE %{ double dc1_t0; double dc2_t0; double dc3_t0; double t0chop_t0; double lambda; double frequency; double fslit1Width; double fslit1Height; double fslit1pos; double fslit2Width; double fslit2Height; double fslit2pos; double IncidentCollRadius; double IncidentCollPosition; %} /* The INITIALIZE section is executed when the simulation starts */ /* (C code). You may use them as component parameter values. */ INITIALIZE %{ frequency = 60; fslit1Width = 0.02123; fslit1Height = 0.02429; fslit1pos = 12.163; fslit2Width = 0.01196; fslit2Height = 0.01547; fslit2pos = 14.530; IncidentCollPosition = 14.878; //Chopper phases dc1_t0 = 5.84/3960*lambda; t0chop_t0 = 7.62/3960*lambda; dc2_t0 = 8.00/3960*lambda; dc3_t0 = 11.00/3960*lambda; %} /* 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 ///////////////// SOURCE ///////////////// COMPONENT sourceMantid = SNS_source( filename = "a1G0AD-2-f5.dat", xwidth = 0.1, yheight = 0.12, dist = 12.15, focus_xw = 0.035, focus_yh = 0.035, Emin = 0.01, Emax = 10000) AT (0, 0, 0) RELATIVE Origin ROTATED (0, 0, 0) RELATIVE Origin ///////////////// CHOPPERS///////////////// COMPONENT BWchopper1 = DiskChopper( theta_0 = 118, yheight = 0, nu = frequency, nslit = 1, delay = dc1_t0) AT (0, 0, 5.84) RELATIVE Origin COMPONENT T0chopper = DiskChopper( theta_0 = 131.8, radius = .319, yheight = .134, nu = frequency, nslit = 1, delay = t0chop_t0) AT (0, 0, 7.62) RELATIVE Origin COMPONENT BWchopper2 = DiskChopper( theta_0 = 152, yheight = 0, nu = frequency, nslit = 1, delay = dc2_t0) AT (0, 0, 8.00) RELATIVE Origin COMPONENT BWchopper3 = DiskChopper( theta_0 = 199, yheight = 0, nu = frequency, nslit = 1, delay = dc3_t0) AT (0, 0, 11.00) RELATIVE Origin COMPONENT fslit_1 = Slit(xwidth=fslit1Width, yheight=fslit1Height) at (0, 0, fslit1pos) RELATIVE Origin ///////////////// NEW GUIDE///////////////// COMPONENT newguide = Guide_tapering( option="file=SNAPguide_new_final_final", w1=0, h1=0, linw=0, loutw=0, linh=0, louth=0, l=2.355, R0=0.99, Qcx=0.021, Qcy=0.021, alphax=6.07, alphay=6.07, W=0.003, mx=6, my=6) AT (0, 0, 12.1645) RELATIVE Origin //////////////////////////////////////////////////////////////////////////////// COMPONENT fslit_2 = Slit(xwidth=fslit2Width, yheight=fslit2Height) AT (0, 0, fslit2pos) RELATIVE Origin ////////////////////// Incident Collimator ///////////////////////////////////////// COMPONENT IncidentColl = Slit(radius = IncidentCollRadius) AT (0, 0, IncidentCollPosition) RELATIVE Origin ////////////////// NORMALIZING DETECTOR PACK 2 //////////////////////// COMPONENT Norm_Mon_2_Flux = Monitor(xwidth = 0.1, yheight = 0.1, restore_neutron = 1) AT (0.0, 0.0, 14.88) RELATIVE Origin ///////////////// Sample Collimating Aperture /////////////// //// The sample collimating aperture is approximated by two slits separated by SampleColl_up_pos - SampleColl_down_pos. This difference is the collimating aperture thickness. //// COMPONENT SampleColl_up_Flux_Tile = Monitor(xwidth = 0.01, yheight = 0.01, restore_neutron = 1) AT (0.0, 0.0, SampleColl_up_pos) RELATIVE Origin COMPONENT SampleColl_up = Slit(xwidth = SampleColl_xwidth, yheight = SampleColl_yheight) AT (0.0, 0.0, SampleColl_up_pos) RELATIVE Origin COMPONENT SampleColl_dn = Slit(xwidth = SampleColl_xwidth, yheight = SampleColl_yheight) AT (0.0, 0.0, SampleColl_dn_pos) RELATIVE Origin COMPONENT SampleColl_dn_Flux_Ap = Monitor(xwidth = SampleColl_xwidth, yheight = SampleColl_yheight, restore_neutron = 1) AT (0.0, 0.0, SampleColl_dn_pos) RELATIVE Origin ///////////////// SAMPLE POSITION///////////////// COMPONENT sampleMantid = Arm() AT (0, 0, 15) RELATIVE Origin /// Sample_Position detectors/// COMPONENT DetectorPack_Sample_Position = Arm() AT (0.0, 0.0, 0.0) RELATIVE sampleMantid COMPONENT Sample_Position_Flux_Tile = Monitor(xwidth = 0.01, yheight = 0.01, restore_neutron = 1) AT (0.0, 0.0, 0.0) RELATIVE DetectorPack_Sample_Position COMPONENT Sample_Position_Flux_Ap = Monitor(xwidth = 0.0016, yheight = 0.0006, restore_neutron = 1) AT (0.0, 0.0, 0.0) RELATIVE DetectorPack_Sample_Position /* 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