Changes in / [19bf626:9c490bc] in sasmodels


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/kernel_iq.c

    r208f0a4 r9c490bc  
    4040           double sld_solvent 
    4141 
    42    CALL_IQ(q, nq, i, pars) is the declaration of a call to the kernel. 
     42   PARAMETER_CALL(var) is the declaration of a call to the kernel. 
    4343 
    4444       Cylinder: 
    4545 
    46            #define CALL_IQ(q, nq, i, var) \ 
    47            Iq(q[i], \ 
     46           #define PARAMETER_CALL(var) \ 
    4847           var.length, \ 
    4948           var.radius, \ 
    5049           var.sld, \ 
    51            var.sld_solvent) 
     50           var.sld_solvent 
    5251 
    5352       Multi-shell cylinder: 
    54            #define CALL_IQ(q, nq, i, var) \ 
    55            Iq(q[i], \ 
     53           #define PARAMETER_CALL(var) \ 
    5654           var.num_shells, \ 
    5755           var.length, \ 
    5856           var.radius, \ 
    5957           var.sld, \ 
    60            var.sld_solvent) 
    61  
    62    CALL_VOLUME(var) is similar, but for calling the form volume. 
     58           var.sld_solvent 
    6359 
    6460   INVALID is a test for model parameters in the correct range 
     
    108104        par_offset = {2, 3, 303, 313}  // parameter offsets 
    109105        par_coord = {0, 3, 2, 1} // bitmap of parameter dependencies 
    110         fast_coord_index = {5, 3, x, x} 
    111106        fast_coord_count = 2  // two parameters vary with *length* distribution 
    112         theta_var = -1   // no spherical correction 
    113         fast_theta = 0   // spherical correction angle is not pd 1 
     107        fast_coord_index = {5, 3, x, x, x, x} 
    114108    } 
    115109 
     
    203197Scale and background cannot be coordinated with other polydisperse parameters 
    204198 
    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 
     199Cutoff paramater is basically used to restrict the region where integration 
     200is peformed i.e. polydispersity hypercude is limitted spheres. 
     201 
    209202*/ 
    210203 
     
    220213    int par_offset[NPARS];  // offset of par values in the par & weight vector 
    221214    int par_coord[NPARS];   // polydispersity coordination bitvector 
     215    int fast_coord_count;   // number of parameters coordinated with pd 1 
    222216    int fast_coord_index[NPARS]; // index of the fast coordination parameters 
    223     int fast_coord_count;   // number of parameters coordinated with pd 1 
    224     int theta_var;          // id of spherical correction variable 
    225     int fast_theta;         // true if spherical correction depends on pd 1 
    226217} ProblemDetails; 
    227218 
     
    326317  double weight = 1.0;        // set to 1 in case there are no weights 
    327318  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 
    329319 
    330320  // Loop over the weights then loop over q, accumulating values 
     
    332322    // check if indices need to be updated 
    333323    if (pd_index[0] >= pd_length[0]) { 
    334  
    335       // RESET INDICES 
    336324      pd_index[0] = loop_index%pd_length[0]; 
    337325      partial_weight = 1.0; 
     
    343331        if (pd_isvol[k]) partial_volweight *= wi; 
    344332      } 
     333      weight = partial_weight * weights[pd_offset[0]+pd_index[0]] 
    345334      for (int k=0; k < NPARS; k++) { 
    346335        int coord = par_coord[k]; 
     
    357346        parvec[k] = pars[this_offset]; 
    358347      } 
    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  
    365348    } else { 
    366  
    367       // INCREMENT INDICES 
    368349      pd_index[0] += 1; 
    369350      const double wi = weights[pd_offset[0]+pd_index[0]]; 
     
    374355            = pars[offset[fast_coord_index[k]] + pd_index[0]]; 
    375356      } 
    376       if (fast_theta) weight *= fabs(cos(M_PI_180*parvec[theta_var])); 
    377  
    378     } 
    379  
     357    } 
    380358    #ifdef INVALID 
    381359    if (INVALID(local_pars)) continue; 
    382360    #endif 
    383  
    384361    if (weight > cutoff) { 
    385362      norm += weight; 
    386       vol += vol_weight * CALL_VOLUME(local_pars); 
     363      vol += vol_weight * form_volume(VOLUME_PARAMETERS); 
    387364      norm_vol += vol_weight; 
    388365 
     
    392369      for (int i=0; i < nq; i++) { 
    393370      { 
    394         const double scattering = CALL_IQ(q, nq, i, local_pars); 
     371        const double scattering = IQ_FUNC(IQ_PARS, IQ_PARAMETERS); 
    395372        //const double scattering = Iq(q[i], IQ_PARAMETERS); 
    396373        result[i] += weight*scattering; 
Note: See TracChangeset for help on using the changeset viewer.