-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathSamples_SpinWave_BCO.instr
More file actions
248 lines (216 loc) · 5.12 KB
/
Samples_SpinWave_BCO.instr
File metadata and controls
248 lines (216 loc) · 5.12 KB
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
/*****************************************************************************
* McStas instrument definition URL=http://www.mcstas.org
*
* Instrument: Samples_SpinWave_BCO
*
* %Identification
* Written by: <a href="mailto:kim.lefmann@risoe.dk">Kim Lefmann</a>
* Date: Feb 2004
* Origin: <a href="http://www.risoe.dk/">RISOE</a>
* Written by: K. Lefmann <kim.lefmann@risoe.dk> RISOE, Feb 2004
* %INSTRUMENT_SITE: Tests_samples
*
* Simple test instrument for the SpinWave_BCO component
*
*
* %Description
* Simple test instrument for the SpinWave_BCO component.
* Refer to the component documentation for further instructions.
*
* Example: h=1 l=0 -n 1e5 Detector: mon1_I=2.86265e-25
*
* %Parameters
* E: [meV] Mean energy at source
* DE: [meV] Energy spread at source
* HDIV: [deg] Horizontal divergence produced from source
* VDIV: [deg] Vertical divergence produced from source
* TT: [deg] Two-theta detetector-angle
* OM: [deg] Sample rotation angle
* C: [meV/AA^(-1)] Sample velocity of sound
*
* %End
******************************************************************************/
DEFINE INSTRUMENT Samples_SpinWave_BCO(E=1.06,Ef=14.7,Dlambda=0.1, h=1, l=0,B=0,dA3=-90, Temp=2, width = 0.005, E_steps_low = 50, E_steps_high = 50,mode = 2,verbose=0)
DECLARE
%{
double Gqx,Gqy,Gqz;
//double Ef=24.8
double Ei;
//meV
double thetaM;
double twothetaS;
double thetaA;
double A3;
double QM;
double alpha;
double lambda_i;
double SMALL__NUMBER;
double a;
double c;
double jAFM;
double jFM;
double jextra;
double S;
double D;
%}
INITIALIZE
%{
// Set monochromator/analyzer Q-value for PG
QM = 1.8734;
SMALL__NUMBER = 1e-6;
// MnF2 parameters
// Lattice vectors in AA
a = 4.873;
c = 3.130;
jAFM = 2*0.152;
jFM = -2*0.028;
jextra = 2*0.004;
S = 2.5;
D = -0.023;
//MnF2 reciprocal lattice vectors, in 1/AA
double astar = 2*PI/a;
double cstar = 2*PI/c;
//calculate Ei
Ei=Ef+E;
//calculate ki, kf, lambda_i, q
double ki = V2K*SE2V*sqrt(Ei);
double kf = V2K*SE2V*sqrt(Ef);
lambda_i=2*PI/ki;
double q = sqrt(h*h*astar*astar+l*l*cstar*cstar);
//calculate 2thetaM and 2thetaA
thetaM = asin(QM/(2*ki))*RAD2DEG;
thetaA = asin(QM/(2*kf))*RAD2DEG;
//calculate scattering angle and sample rotation
twothetaS = acos((q*q-ki*ki-kf*kf)/(-2*ki*kf))*RAD2DEG;
alpha = acos((kf*kf-ki*ki-q*q)/(-2*ki*q));
A3=(asin(l*cstar/(q+SMALL__NUMBER))-alpha)*RAD2DEG;
%}
TRACE
COMPONENT origin = Progress_bar()
AT (0, 0, 0) RELATIVE ABSOLUTE
COMPONENT source = Source_Maxwell_3(
xwidth=0.01,
yheight=0.01,
Lmin=lambda_i-Dlambda/2,
Lmax=lambda_i+Dlambda/2,
dist=7.5,
focus_yh=width,
focus_xw=width,
T1=300,
T2=300,
T3=300,
I1=1E15,
I2=1E15,
I3=1E15)
AT (0, 0, 0) RELATIVE PREVIOUS
COMPONENT monochromator_flat = Monochromator_flat(
mosaicv=30,
mosaich=30,
zwidth = width,
yheight = width,
Q=QM)
AT (0, 0, 7.5) RELATIVE source
ROTATED (0, thetaM, 0) RELATIVE source
COMPONENT arm1 = Arm()
AT (0, 0, 0) RELATIVE PREVIOUS
ROTATED (0, thetaM, 0) RELATIVE PREVIOUS
COMPONENT collimator_linear1 = Collimator_linear(
xwidth=0.1,
yheight=0.2,
length=0.2,
divergence=40)
AT (0, 0, 0.7) RELATIVE arm1
/*COMPONENT e_monitor_before_sample = E_monitor(
nE=100,
filename="E_before_sample",
Emin=Ei-2,
Emax=Ei+2,
xwidth=width,
yheight=2*width,
restore_neutron=1)
AT (0, 0, 0.99) RELATIVE arm1*/
COMPONENT arm2 = Arm()
AT (0, 0, 1) RELATIVE arm1
ROTATED (0, 0, 0) RELATIVE arm1
SPLIT 1
COMPONENT SAMPLE = SpinWave_BCO(
radius = width/2,
yheight = 2*width,
sigma_abs = 0,
sigma_inc = 0,
T = Temp,
a1 = a,
a2 = a,
a3 = c,
j = jAFM,
jc = jFM,
ja=jextra,
jb=jextra,
S=S,
B=B,
D=D,
FM=0,
mode_input = mode,
e_steps_low = E_steps_low,
e_steps_high = E_steps_high,
target_index=3,
focus_xw=0.005,
focus_yh=0.005,
verbose = verbose)
AT (0, 0, 0) RELATIVE arm2
ROTATED (0, -A3+dA3, 180) RELATIVE arm2
COMPONENT arm3 = Arm()
AT (0, 0, 0) RELATIVE arm2
ROTATED (0, -twothetaS, 0) RELATIVE arm2
COMPONENT collimator_linear2 = Collimator_linear(
xwidth=0.1,
yheight=0.2,
length=0.2,
divergence=40,
xwidth=width,
yheight=width)
AT (0, 0, 0.5) RELATIVE arm3
COMPONENT slit = Slit(
xwidth=0.005,
yheight=0.005)
AT (0, 0, 1) RELATIVE arm3
/*COMPONENT e_monitor_beforeana = E_monitor(
nE=250,
filename="Ebeforeana",
xwidth=width,
yheight=width,
Emin=0,
Emax=25,
restore_neutron=1)
AT (0, 0, 0.001) RELATIVE PREVIOUS*/
COMPONENT analyzer = Monochromator_flat(
zwidth=width,
yheight=width,
mosaicv=30,
mosaich=30,
Q=QM
)
AT (0, 0, 0.1) RELATIVE PREVIOUS
ROTATED (0, thetaA, 0) RELATIVE PREVIOUS
COMPONENT arm4 = Arm()
AT (0, 0, 0) RELATIVE PREVIOUS
ROTATED (0, thetaA, 0) RELATIVE PREVIOUS
COMPONENT collimator_linear3 = Collimator_linear(
xwidth=0.1,
yheight=0.2,
length=0.2,
divergence=40)
AT (0, 0, 0.5) RELATIVE PREVIOUS
COMPONENT Emon = E_monitor(
nE=250,
filename="Emon",
xwidth=width,
yheight=width,
Emin=0,
Emax=75,
restore_neutron=1)
AT (0, 0, 1) RELATIVE arm4
FINALLY
%{
%}
END