@@ -366,14 +366,12 @@ DECLARE
366366 double V_my_s;
367367 double V_my_a_v;
368368 double DV;
369- double* vf_list;// List of allowed final velocities. Has length of scan_steps
370- struct neutron_params neutron;
371369 struct phonon_params phonon;
372370
373371%}
374372INITIALIZE
375373%{
376- vf_list = (double *)calloc( e_steps_low*e_steps_high, sizeof(double));
374+
377375 V_rho = 4/(a*a*a);
378376 V_my_s = (V_rho * 100 * sigma_inc);
379377 V_my_a_v = (V_rho * 100 * sigma_abs * 2200);
@@ -403,6 +401,8 @@ INITIALIZE
403401%}
404402TRACE
405403%{
404+ double* vf_list = (double *)calloc( e_steps_low*e_steps_high, sizeof(double)); // List of allowed final velocities. Has length of scan_steps
405+ struct neutron_params neutron;
406406 double t0, t1; /* Entry/exit time for cylinder */
407407 double v_i, v_f; /* Neutron velocities: initial, final */
408408 double vx_i, vy_i, vz_i; /* Neutron initial velocity vector */
@@ -502,16 +502,14 @@ TRACE
502502 p4 = 2*VS2E*v_f/J_factor; /* Jacobian of delta functions in cross section */
503503 p5 = b*b/M; /* Cross section factor 2 */
504504 p *= p1*p2*p3*p4*p5;
505- // Finally, set vf_list to zero again
506- memset(vf_list, 0, nf * sizeof(double));
507505 } /* else transmit: Neutron did not hit the sample */
508-
506+ free(vf_list);
509507
510508%}
511509
512510FINALLY
513511%{
514- free(vf_list);
512+
515513
516514%}
517515
0 commit comments