Skip to content

Commit d521dea

Browse files
committed
Remove debugging statements and add order parameter that changes my_s
1 parent dd753c3 commit d521dea

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

mcstas-comps/samples/PowderN.comp

Lines changed: 10 additions & 6 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) */
@@ -862,8 +863,8 @@ INITIALIZE
862863
}
863864
if (line_info.V_0 > 0) {
864865
/* Is not yet divided by v */
865-
line_info.my_a_v = 0;//pack*line_info.sigma_a/line_info.V_0*2200*100; // Factor 100 to convert from barns to fm^2
866-
line_info.my_inc =0;// pack*line_info.sigma_i/line_info.V_0*100; // Factor 100 to convert from barns to fm^2
866+
line_info.my_a_v = pack*line_info.sigma_a/line_info.V_0*2200*100; // Factor 100 to convert from barns to fm^2
867+
line_info.my_inc = pack*line_info.sigma_i/line_info.V_0*100; // Factor 100 to convert from barns to fm^2
867868
MPI_MASTER(
868869
printf("PowderN: %s: Vc=%g [Angs] sigma_abs=%g [barn] sigma_inc=%g [barn] reflections=%s\n",
869870
NAME_CURRENT_COMP, line_info.V_0, line_info.sigma_a, line_info.sigma_i, reflections && strlen(reflections) ? reflections : "NULL");
@@ -1001,8 +1002,11 @@ TRACE
10011002
} else {
10021003
dt = dt * (t3 - t2) + (t2-t0) ; /* Possibly also 'backside' part */
10031004
}
1004-
1005-
my_s = line_info.my_s_v2_sum/(v*v)+line_info.my_inc;
1005+
if (order==1){
1006+
my_s = line_info.my_s_v2_sum/(v*v)+line_info.my_inc;
1007+
} else {
1008+
my_s = line_info.my_inc;
1009+
}
10061010
/* Total attenuation from scattering */
10071011
lfree=0;
10081012
ntype = rand01();
@@ -1145,7 +1149,7 @@ TRACE
11451149

11461150

11471151
l_1 = v*(t3 - t2 + t1 - t0); /* Length to exit */
1148-
my_s = 0;
1152+
11491153
pmul *= Nq*l_full*my_s_n *exp(-(line_info.my_a_v/v+my_s)*(l+l_1))
11501154
/(1-(p_inc+p_transmit));
11511155

0 commit comments

Comments
 (0)