File: templateSANS2.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 (113 lines) | stat: -rw-r--r-- 3,661 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*******************************************************************************
*
* McStas, neutron ray-tracing package
*         Copyright (C) 1997-2008, All rights reserved
*         Risoe National Laboratory, Roskilde, Denmark
*         Institut Laue Langevin, Grenoble, France
*
* Instrument: templateSANS
*
* %Identification
* Written by: Peter Willendrup, Wim G. Bouwman
* Date: Dec 20190
* Origin: <a href="http://www.fysik.dtu.dk">DTU</a>
* %INSTRUMENT_SITE: Templates
*
* Test instrument for the SANS_spheres2 component. No guide / velocity selector.
*
* %Description
* Very simple test instrument for the SANS_spheres2 component, derived / simplified from 
* H. Frielinghaus SANS_benchmark2
*
* %Example: lambda=6 Detector: detectorSANS_I=0.201795
* %Example: lambda=6 frac_dir=1 Detector: detectorDB_I=66.6933
*
* %Parameters
* lambda:       [AA]  Mean wavelength of neutrons
* dlambda:      [AA]  Wavelength spread of neutrons
* r:            [AA]  Radius of scattering hard spheres
* PHI:           [1]  Particle volume fraction
* Delta_Rho: [cm^-2]  Scattering length density
* frac_dir:      [1]  Fraction of statistics for direct beam
* frac_inc:      [1]  Fraction of statistics for incoherent scattering in scattered beam
*
* %Link
*
* %End
*******************************************************************************/
DEFINE INSTRUMENT templateSANS2(lambda=6, dlambda=0.05, r=150, PHI=1e-3, Delta_Rho=6e10, frac_dir=0.03, frac_inc=0.01)

USERVARS %{
  int was_scattered;
%}
  
TRACE

COMPONENT a1 = Progress_bar()
  AT (0,0,0) ABSOLUTE

COMPONENT arm = Arm()
  AT (0, 0, 0) ABSOLUTE

COMPONENT source = Source_simple(
    radius = 0.02, dist = 6, focus_xw = 0.01, focus_yh = 0.01,
    lambda0 = lambda, dlambda = dlambda, flux = 1e8)
  AT (0, 0, 0) RELATIVE arm

COMPONENT coll1 = Slit(
    radius = 0.005)
  AT (0, 0, 3) RELATIVE arm

COMPONENT coll2 = Slit(
    radius = 0.005)
  AT (0, 0, 6) RELATIVE arm

COMPONENT sample_position = Arm()
AT (0,0,0.2) RELATIVE coll2

COMPONENT Sample_in = PSD_monitor(xwidth=0.02,yheight=0.02, filename="SamplePos",restore_neutron=1)
  AT(0,0,0) RELATIVE PREVIOUS  

SPLIT COMPONENT sample_conventional = SANS_spheres2(xwidth=0.02, yheight=0.02, zthick=0.001, sc_aim=(1-frac_dir), sans_aim=(1-frac_inc), R=r)
   AT (0,0,0.2) RELATIVE coll2
EXTEND %{
  was_scattered=SCATTERED;
%}

/* PSD, scattered and direct beam */
COMPONENT detector = PSD_monitor(
    nx = 128, ny = 128, filename = "PSD.dat", xmin = -0.3,
    xmax = 0.3, ymin = -0.3, ymax = 0.3)
  AT (0, 0, 3) RELATIVE sample_position

/* PSD, scattered beam only */
COMPONENT detectorSANS = PSD_monitor(
    nx = 128, ny = 128, filename = "SANS.dat", xmin = -0.3,
    xmax = 0.3, ymin = -0.3, ymax = 0.3)
  WHEN (was_scattered)  AT (0, 0, 3) RELATIVE sample_position
  
/* PSD, direct beam only */
COMPONENT detectorDB = PSD_monitor(
    nx = 128, ny = 128, filename = "Direct.dat", xmin = -0.3,
    xmax = 0.3, ymin = -0.3, ymax = 0.3)
  WHEN (!was_scattered)  AT (0, 0, 3) RELATIVE sample_position

/* WL monitor */
COMPONENT Ldetector = L_monitor(
    nL = 1000, filename = "Edet.dat", xmin = -0.3,
    xmax = 0.3, ymin = -0.3, ymax = 0.3, Lmin = 5.5,
    Lmax = 6.5)
  AT (0, 0, 3.01) RELATIVE sample_position

/* Radial average, scattered beam only */
COMPONENT PSDrad = PSD_monitor_rad(
    filename = "psd2.dat", filename_av = "psd2_av.dat", rmax = 0.3)
  WHEN(was_scattered)  AT (0, 0, 3.02) RELATIVE sample_position

/* Radial average, scattered and direct beam */
COMPONENT PSDrad_full = PSD_monitor_rad(
    filename = "psd2_full.dat", filename_av = "psd2_av_full.dat", rmax = 0.3)
  AT (0, 0, 3.02) RELATIVE sample_position


END