File: Template_SasView.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 (133 lines) | stat: -rw-r--r-- 4,044 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*******************************************************************************
*
* McXtrace, xray-tracing package
*         Copyright (C) 1997-2008, All rights reserved
*         Risoe National Laboratory, Roskilde, Denmark
*         Institut Laue Langevin, Grenoble, France
*
* Instrument: Template_SasView
*
* %Identification
* Written by: Torben Nielsen 
* Modified by: Erik b knudsen
* Date: Jan 2017.
* Origin: DTU Physics / ESS DMSC
* Release: 1.5
* 
* %INSTRUMENT_SITE: Tests_samples
*
* Test instrument for the SasView_model component. No optics.
* etc. 
*
*
* %Description
*
* Very simple test instrument for 3 examples from the suite of SasView_ components
*
* %Example: model_index=1 Ncount=1e5 par1=4 par2=1 par3=40 par4=20 par5=400 Detector: detector_I=605
* %Example: model_index=3 Ncount=1e5 par1=220 par2=0.06 par3=40 par4=4 par5=1 Detector: detector_I=4.2
* %Example: model_index=47 Ncount=1e5 par1=4 par2=2 par3=35 par4=75 par5=400 Detector: detector_I=297
*
* %Parameters
* lambda: [AA]   Mean wavelength of X-rays
* dlambda: [AA]  Wavelength spread of X-rays
* model_index: [ ] SASmodels model index (see SasView_model.comp mcdoc page)
* par1: [ ] Slot 1 in SASmodel parameter vector
* par2: [ ] Slot 2 in SASmodel parameter vector
* par3: [ ] Slot 3 in SASmodel parameter vector
* par4: [ ] Slot 4 in SASmodel parameter vector
* par5: [ ] Slot 5 in SASmodel parameter vector
* par6: [ ] Slot 6 in SASmodel parameter vector
* par7: [ ] Slot 7 in SASmodel parameter vector
* par8: [ ] Slot 8 in SASmodel parameter vector
* Ncount:[1] Override the number of rays to simulate.
*
* %Link
* %End
*******************************************************************************/
DEFINE INSTRUMENT Template_SasView(lambda=1.54, dlambda=0.05, model_index=10, par1=0, par2=0, par3=0, par4=0, par5=0, par6=0, par7=0, par8=0, Ncount=0)

DECLARE %{
  double modelpars[8];
%}

INITIALIZE %{
  modelpars[0]=par1;
  modelpars[1]=par2;
  modelpars[2]=par3;
  modelpars[3]=par4;
  modelpars[4]=par5;
  modelpars[5]=par6;
  modelpars[6]=par7;
  modelpars[7]=par8;

  if (Ncount>0)
    mcset_ncount(Ncount);

%}

TRACE

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

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

COMPONENT source = Source_flat (
    radius = 0.0005, dist = 3, focus_xw = .5e-3, focus_yh = .5e-3,
    lambda0 = lambda, dlambda = dlambda, flux = 1e8)
  AT (0, 0, 0) RELATIVE arm

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

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

// Example sphere
SPLIT COMPONENT sample = Arm()
  AT (0, 0, 0) RELATIVE coll2

COMPONENT sample1= SasView_barbell(model_scale=1,model_abs=0.0,
				   sld=par1,sld_solvent=par2,radius_bell=par3,radius=par4,length=par5,
				      xwidth=0.01, yheight=0.01, zdepth=0.005,focus_xw=0.6, focus_yh=0.6, target_index=1)
WHEN (model_index==1) AT (0,0,0.2) RELATIVE coll2
EXTEND %{
  if (!SCATTERED) ABSORB;
%}

COMPONENT sample3= SasView_bcc_paracrystal(model_scale=1,model_abs=0.0,
					   dnn=par1, d_factor=par2, radius=par3, sld=par4, sld_solvent=par5,
				      xwidth=0.01, yheight=0.01, zdepth=0.005,focus_xw=0.6, focus_yh=0.6, target_index=1)
WHEN (model_index==3) AT (0,0,0.2) RELATIVE coll2
EXTEND %{
  if (!SCATTERED) ABSORB;
%}

COMPONENT sample47= SasView_parallelepiped(model_scale=1,model_abs=0.0,
				      sld=par1,sld_solvent=par2,length_a=par3,length_b=par4,length_c=par5,
				      xwidth=0.01, yheight=0.01, zdepth=0.005,focus_xw=0.6, focus_yh=0.6, target_index=1)
WHEN (model_index==47) AT (0,0,0.2) RELATIVE coll2
EXTEND %{
  if (!SCATTERED) ABSORB;
%}

COMPONENT detector = PSD_monitor(
    nx = 128, ny = 128, filename = "PSD.dat", xwidth = 0.6, yheight=0.6)
  AT (0, 0, 3) RELATIVE sample

COMPONENT Ldetector = L_monitor(
    nL = 1000, filename = "Edet.dat", xwidth = 0.6, yheight=0.6, Lmin = 0.5,
    Lmax = 2.5)
  AT (0, 0, 3.01) RELATIVE sample

COMPONENT PSDrad = PSD_monitor(
        filename = "psd2.dat",  radius = 0.3)
  AT (0, 0, 3.02) RELATIVE sample

END