Skip to content

Commit 3e8d3d2

Browse files
authored
Merge pull request #2083 from mccode-dev/SANS_spheres_validation_update
Update SANS_Spheres to align with analytical validations.
2 parents 5be8fda + 609be7c commit 3e8d3d2

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

mcstas-comps/examples/Templates/templateSANS/templateSANS.instr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* %Description
2020
* Very simple test instrument for the Sans_spheres component
2121
*
22-
* %Example: lambda=6 Detector: detector_I=5.5587E-17
22+
* %Example: lambda=6 Detector: detector_I=0.0445623
2323
*
2424
* %Parameters
2525
* lambda: [AA] Mean wavelength of neutrons

mcstas-comps/samples/Sans_spheres.comp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,15 @@ if (xwidth && yheight && zdepth) shape=1; /* box */
100100
target_z=1;
101101
}
102102

103-
my_a_v = sigma_abs*2200*100; /* Is not yet divided by v. 100: Convert barns -> fm^2 */
103+
my_a_v = sigma_abs*2200; /* Is not yet divided by v.*/
104104

105105
my_s_pre = Phi * 4*PI*R*R*R/3 * Delta_rho*Delta_rho;
106106

107107
%}
108108
TRACE
109109
%{
110-
double t0, t1, v, l_full, l, l_1, dt, d_phi, theta, my_s;
111-
double aim_x=0, aim_y=0, aim_z=1, axis_x, axis_y, axis_z;
112-
double arg, tmp_vx, tmp_vy, tmp_vz, vout_x, vout_y, vout_z;
110+
double t0, t1, v, l_full, l, l_1, dt, my_s;
111+
double aim_x=0, aim_y=0, aim_z=1;
113112
double f, solid_angle, vx_i, vy_i, vz_i, qx, qy, qz,q;
114113
char intersect=0;
115114

@@ -159,8 +158,7 @@ TRACE
159158

160159
f = 3 * (sin(q*R) - q*R*cos(q*R))/(q*R*q*R*q*R);
161160

162-
l_1 = v*t1;
163-
double pmul=l_full*solid_angle/(4*PI)*my_s_pre*f*f*exp(-my_a_v*(l+l_1)/v);
161+
double pmul=l_full*solid_angle/(4*PI)*my_s_pre*f*f*exp(-(my_a_v/v)*l_full);
164162
p = p * pmul;
165163
SCATTER;
166164
}

0 commit comments

Comments
 (0)