Skip to content

Commit dcc1c40

Browse files
authored
Merge pull request #2098 from mccode-dev/PowderN_Validation
Add in order parameter to make it possibly to use no multiple scattering
2 parents 2eb476e + ad17431 commit dcc1c40

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

mcstas-comps/samples/PowderN.comp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@
165165
* density: [g/cm^3] Density of material. rho=density/weight/1e24*N_A.
166166
* nb_atoms: [1] Number of sub-unit per unit cell, that is ratio of sigma for chemical formula to sigma per unit cell
167167
* target_index: [1] Relative index of component to focus incoherent scattering at, e.g. next is +1
168+
* order: [1] Flag that determines whether the intensity should (1) not (0) be dampened by weighting multiple scattering
168169
*
169170
* CALCULATED PARAMETERS:
170171
* line_info: [struct] internal structure containing many members/info
@@ -205,7 +206,7 @@ SETTING PARAMETERS (string reflections="NULL", string geometry="NULL",
205206
radius=0, yheight=0, xwidth=0, zdepth=0, thickness=0,
206207
pack=1, Vc=0, sigma_abs=0, sigma_inc=0, delta_d_d=0, p_inc=0.1, p_transmit=0.1,
207208
DW=0, nb_atoms=1, d_omega=0, d_phi=0, tth_sign=0, p_interact=0.8,
208-
concentric=0, density=0, weight=0, barns=1, Strain=0, focus_flip=0, int target_index=0)
209+
concentric=0, density=0, weight=0, barns=1, Strain=0, focus_flip=0, int target_index=0, int order=1)
209210

210211

211212
/* Neutron parameters: (x,y,z,vx,vy,vz,t,sx,sy,sz,p) */
@@ -992,8 +993,11 @@ TRACE
992993
} else {
993994
dt = dt * (t3 - t2) + (t2-t0) ; /* Possibly also 'backside' part */
994995
}
995-
996-
my_s = line_info.my_s_v2_sum/(v*v)+line_info.my_inc;
996+
if (order){
997+
my_s = line_info.my_s_v2_sum/(v*v)+line_info.my_inc;
998+
} else {
999+
my_s = line_info.my_inc;
1000+
}
9971001
/* Total attenuation from scattering */
9981002
lfree=0;
9991003
ntype = rand01();
@@ -1136,9 +1140,10 @@ TRACE
11361140

11371141

11381142
l_1 = v*(t3 - t2 + t1 - t0); /* Length to exit */
1139-
1140-
pmul *= Nq*l_full*my_s_n*exp(-(line_info.my_a_v/v+my_s)*(l+l_1))
1143+
1144+
pmul *= Nq*l_full*my_s_n *exp(-(line_info.my_a_v/v+my_s)*(l+l_1))
11411145
/(1-(p_inc+p_transmit));
1146+
11421147
/* Correction in case of d_phi focusing - BUT only when d_phi != 0 */
11431148
if (d_phi_thread) {
11441149
pmul *= alpha/PI;

0 commit comments

Comments
 (0)