File: Test_PowderN.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 (80 lines) | stat: -rw-r--r-- 2,896 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
/*******************************************************************************
*         McStas instrument definition URL=http://www.mcstas.org
*
* Instrument: Test PowderN output
*
* %Identification
* Written by: P. Willendrup
* Date: October 1st 2020
* Origin: DTU
* %INSTRUMENT_SITE: Tests_samples
*
* Test output of PowderN on a spherical monitor.
*
* %Description
* A test instrument for PowderN output on a spherical monitor.
*
* %Example: lambda=1 Detector: Sph_mon_I=1.09119e+09
* %Example: lambda=1 d_phi=10 Detector: Sph_mon_I=8.94853e+07
* %Example: lambda=1 directbeam=1 SPLITS=2 Detector: Sph_mon_I=4.77847e+09
* %Example: lambda=1 directbeam=1 SPLITS=5 Detector: Sph_mon_I=4.77847e+09
* %Example: lambda=1 directbeam=1 SPLITS=10 Detector: Sph_mon_I=4.77847e+09
* %Example: lambda=1 directbeam=1 SPLITS=20 Detector: Sph_mon_I=4.77847e+09
*
* %Parameters
* lambda:     [Angs] Wavelength emitted from source, 1% wl-interval around.
* L1:            [m] Source-sample distance
* directbeam:    [1] Suppress direct beam or not
* reflections: [str] List of powder reflections
* SPLITS:        [1] Number of SPLIT's before sample
* frac_c:        [1] Fraction of stats assigned to coherent scattering 
* frac_i:        [1] Fraction of stats assigned to incoherent scattering
* frac_t:        [1] Fraction of stats assigned to unscattered, "direct beam"
* d_phi:       [deg] d_phi focusing setting in PowderN
*
* %End
*******************************************************************************/
DEFINE INSTRUMENT Test_PowderN(lambda=1, L1=10, int directbeam=0, string reflections="Fe.laz", int SPLITS=1, frac_c=0.8, frac_i=0.1, frac_t=0.1, d_phi=0)

DECLARE %{
%}

/* The INITIALIZE section is executed when the simulation starts     */
/* (C code). You may use them as component parameter values.         */
INITIALIZE
%{
%}

/* Here comes the TRACE section, where the actual      */
/* instrument is defined as a sequence of components.  */
TRACE

REMOVABLE COMPONENT Origin = Progress_bar()
  AT (0,0,0) ABSOLUTE

/* source with constant flux */
REMOVABLE COMPONENT Source = Source_gen(
    radius = 0.11, dist = L1, focus_xw = 0.01, focus_yh = 0.1,
    lambda0 = lambda, dlambda = lambda*0.01,
    T1=229.6,I1=5.32e13,T2=1102, I2=4.37e12, T3=437.1,I3=3.84e13)
  AT (0, 0, 0) RELATIVE Origin

/* TIP: monochromator cradle */ 
COMPONENT sample_cradle = Arm()
  AT (0, 0, L1) RELATIVE PREVIOUS

SPLIT SPLITS COMPONENT Pow = PowderN(radius=0.005, yheight=0.1, reflections=reflections, p_inc=frac_i, p_transmit=frac_t, p_interact=frac_c, d_phi=d_phi)
  AT (0, 0, 0) RELATIVE sample_cradle
EXTEND %{
  if(INSTRUMENT_GETPAR(directbeam) == 0) {
    if (!SCATTERED) {
      ABSORB;
    }
  }
%}

COMPONENT Sph_mon = PSD_monitor_4PI(nx=100,ny=100, radius=1, restore_neutron=1, filename="Sphere")
  AT (0, 0, 0) RELATIVE PREVIOUS

/* The END token marks the instrument definition end */
END