Changeset 19bf626 in sasmodels
- Timestamp:
- Mar 20, 2016 4:20:44 PM (9 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 119bd3d
- Parents:
- 9c490bc (diff), 208f0a4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- sasmodels
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/kernel_iq.c
r9c490bc r19bf626 40 40 double sld_solvent 41 41 42 PARAMETER_CALL(var) is the declaration of a call to the kernel.42 CALL_IQ(q, nq, i, pars) is the declaration of a call to the kernel. 43 43 44 44 Cylinder: 45 45 46 #define PARAMETER_CALL(var) \ 46 #define CALL_IQ(q, nq, i, var) \ 47 Iq(q[i], \ 47 48 var.length, \ 48 49 var.radius, \ 49 50 var.sld, \ 50 var.sld_solvent 51 var.sld_solvent) 51 52 52 53 Multi-shell cylinder: 53 #define PARAMETER_CALL(var) \ 54 #define CALL_IQ(q, nq, i, var) \ 55 Iq(q[i], \ 54 56 var.num_shells, \ 55 57 var.length, \ 56 58 var.radius, \ 57 59 var.sld, \ 58 var.sld_solvent 60 var.sld_solvent) 61 62 CALL_VOLUME(var) is similar, but for calling the form volume. 59 63 60 64 INVALID is a test for model parameters in the correct range … … 104 108 par_offset = {2, 3, 303, 313} // parameter offsets 105 109 par_coord = {0, 3, 2, 1} // bitmap of parameter dependencies 110 fast_coord_index = {5, 3, x, x} 106 111 fast_coord_count = 2 // two parameters vary with *length* distribution 107 fast_coord_index = {5, 3, x, x, x, x} 112 theta_var = -1 // no spherical correction 113 fast_theta = 0 // spherical correction angle is not pd 1 108 114 } 109 115 … … 197 203 Scale and background cannot be coordinated with other polydisperse parameters 198 204 199 Cutoff paramater is basically used to restrict the region where integration 200 is peformed i.e. polydispersity hypercude is limitted spheres. 201 205 Oriented objects in 2-D need a spherical correction on the angular variation 206 in order to preserve the 'surface area' of the weight distribution. 207 208 TODO: cutoff 202 209 */ 203 210 … … 213 220 int par_offset[NPARS]; // offset of par values in the par & weight vector 214 221 int par_coord[NPARS]; // polydispersity coordination bitvector 222 int fast_coord_index[NPARS]; // index of the fast coordination parameters 215 223 int fast_coord_count; // number of parameters coordinated with pd 1 216 int fast_coord_index[NPARS]; // index of the fast coordination parameters 224 int theta_var; // id of spherical correction variable 225 int fast_theta; // true if spherical correction depends on pd 1 217 226 } ProblemDetails; 218 227 … … 317 326 double weight = 1.0; // set to 1 in case there are no weights 318 327 double vol_weight = 1.0; // set to 1 in case there are no vol weights 328 double spherical_correction = 1.0; // correction for latitude variation 319 329 320 330 // Loop over the weights then loop over q, accumulating values … … 322 332 // check if indices need to be updated 323 333 if (pd_index[0] >= pd_length[0]) { 334 335 // RESET INDICES 324 336 pd_index[0] = loop_index%pd_length[0]; 325 337 partial_weight = 1.0; … … 331 343 if (pd_isvol[k]) partial_volweight *= wi; 332 344 } 333 weight = partial_weight * weights[pd_offset[0]+pd_index[0]]334 345 for (int k=0; k < NPARS; k++) { 335 346 int coord = par_coord[k]; … … 346 357 parvec[k] = pars[this_offset]; 347 358 } 359 weight = partial_weight * weights[pd_offset[0]+pd_index[0]] 360 if (theta_var >= 0) { 361 spherical_correction = fabs(cos(M_PI_180*parvec[theta_var])); 362 } 363 if (!fast_theta) weight *= spherical_correction; 364 348 365 } else { 366 367 // INCREMENT INDICES 349 368 pd_index[0] += 1; 350 369 const double wi = weights[pd_offset[0]+pd_index[0]]; … … 355 374 = pars[offset[fast_coord_index[k]] + pd_index[0]]; 356 375 } 357 } 376 if (fast_theta) weight *= fabs(cos(M_PI_180*parvec[theta_var])); 377 378 } 379 358 380 #ifdef INVALID 359 381 if (INVALID(local_pars)) continue; 360 382 #endif 383 361 384 if (weight > cutoff) { 362 385 norm += weight; 363 vol += vol_weight * form_volume(VOLUME_PARAMETERS);386 vol += vol_weight * CALL_VOLUME(local_pars); 364 387 norm_vol += vol_weight; 365 388 … … 369 392 for (int i=0; i < nq; i++) { 370 393 { 371 const double scattering = IQ_FUNC(IQ_PARS, IQ_PARAMETERS);394 const double scattering = CALL_IQ(q, nq, i, local_pars); 372 395 //const double scattering = Iq(q[i], IQ_PARAMETERS); 373 396 result[i] += weight*scattering;
Note: See TracChangeset
for help on using the changeset viewer.