Changeset d4c33d6 in sasmodels for sasmodels/kernel_iq.c
- Timestamp:
- Apr 12, 2017 10:50:29 AM (7 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 597878a
- Parents:
- 535fee6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/kernel_iq.c
rbde38b5 rd4c33d6 25 25 int32_t num_weights; // total length of the weights vector 26 26 int32_t num_active; // number of non-trivial pd loops 27 int32_t theta_par; // id of spherical correction variable 27 int32_t theta_par; // id of spherical correction variable (not used) 28 28 } ProblemDetails; 29 29 … … 173 173 174 174 175 #if MAX_PD>0176 const int theta_par = details->theta_par;177 const int fast_theta = (theta_par == p0);178 const int slow_theta = (theta_par >= 0 && !fast_theta);179 double spherical_correction = 1.0;180 #else181 // Note: if not polydisperse the weights cancel and we don't need the182 // spherical correction.183 const double spherical_correction = 1.0;184 #endif185 186 175 int step = pd_start; 187 176 … … 220 209 #endif 221 210 #if MAX_PD>0 222 if (slow_theta) { // Theta is not in inner loop223 spherical_correction = fmax(fabs(cos(M_PI_180*local_values.vector[theta_par])), 1.e-6);224 }225 211 while(i0 < n0) { 226 212 local_values.vector[p0] = v0[i0]; 227 213 double weight0 = w0[i0] * weight1; 228 214 //printf("step:%d level %d: p:%d i:%d n:%d value:%g weight:%g\n", step, 0, p0, i0, n0, local_values.vector[p0], weight0); 229 if (fast_theta) { // Theta is in inner loop230 spherical_correction = fmax(fabs(cos(M_PI_180*local_values.vector[p0])), 1.e-6);231 }232 215 #else 233 216 const double weight0 = 1.0; … … 244 227 // Note: weight==0 must always be excluded 245 228 if (weight0 > cutoff) { 246 // spherical correction is set at a minimum of 1e-6, otherwise there 247 // would be problems looking at models with theta=90. 248 const double weight = weight0 * spherical_correction; 249 pd_norm += weight * CALL_VOLUME(local_values.table); 229 pd_norm += weight0 * CALL_VOLUME(local_values.table); 250 230 251 231 #ifdef USE_OPENMP … … 304 284 #endif // !MAGNETIC 305 285 //printf("q_index:%d %g %g %g %g\n",q_index, scattering, weight, spherical_correction, weight0); 306 result[q_index] += weight * scattering;286 result[q_index] += weight0 * scattering; 307 287 } 308 288 }
Note: See TracChangeset
for help on using the changeset viewer.