Changeset 0f00d95 in sasmodels


Ignore:
Timestamp:
Jul 28, 2016 4:47:07 PM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
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:
4f1f876
Parents:
2547694
Message:

tweak spherical correction implementation

Location:
sasmodels
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/generate.py

    r739aad4 r0f00d95  
    166166import re 
    167167import string 
    168 import warnings 
    169168 
    170169import numpy as np  # type: ignore 
  • sasmodels/kernel_iq.c

    r56547a8 r0f00d95  
    173173 
    174174 
    175   double spherical_correction=1.0; 
     175#if MAX_PD>0 
    176176  const int theta_par = details->theta_par; 
    177 #if MAX_PD>0 
    178177  const int fast_theta = (theta_par == p0); 
    179178  const int slow_theta = (theta_par >= 0 && !fast_theta); 
     179  double spherical_correction = 1.0; 
    180180#else 
    181   const int slow_theta = (theta_par >= 0); 
     181  // Note: if not polydisperse the weights cancel and we don't need the 
     182  // spherical correction. 
     183  const double spherical_correction = 1.0; 
    182184#endif 
    183185 
     
    218220    const double weight1 = 1.0; 
    219221#endif 
    220     if (slow_theta) { // Theta is not in inner loop 
    221       spherical_correction = fmax(fabs(cos(M_PI_180*pvec[theta_par])), 1.e-6); 
    222     } 
    223 #if MAX_PD>0 
     222#if MAX_PD>0 
     223  if (slow_theta) { // Theta is not in inner loop 
     224    spherical_correction = fmax(fabs(cos(M_PI_180*pvec[theta_par])), 1.e-6); 
     225  } 
    224226  while(i0 < n0) { 
    225227    pvec[p0] = v0[i0]; 
  • sasmodels/kernel_iq.cl

    r56547a8 r0f00d95  
    166166 
    167167 
    168   double spherical_correction=1.0; 
     168#if MAX_PD>0 
    169169  const int theta_par = details->theta_par; 
    170 #if MAX_PD>0 
    171   const int fast_theta = (theta_par == p0); 
    172   const int slow_theta = (theta_par >= 0 && !fast_theta); 
     170  const bool fast_theta = (theta_par == p0); 
     171  const bool slow_theta = (theta_par >= 0 && !fast_theta); 
     172  double spherical_correction = 1.0; 
    173173#else 
    174   const int slow_theta = (theta_par >= 0); 
     174  // Note: if not polydisperse the weights cancel and we don't need the 
     175  // spherical correction. 
     176  const double spherical_correction = 1.0; 
    175177#endif 
    176178 
     
    211213    const double weight1 = 1.0; 
    212214#endif 
    213     if (slow_theta) { // Theta is not in inner loop 
    214       spherical_correction = fmax(fabs(cos(M_PI_180*pvec[theta_par])), 1.e-6); 
    215     } 
    216 #if MAX_PD>0 
     215#if MAX_PD>0 
     216  if (slow_theta) { // Theta is not in inner loop 
     217    spherical_correction = fmax(fabs(cos(M_PI_180*pvec[theta_par])), 1.e-6); 
     218  } 
    217219  while(i0 < n0) { 
    218220    pvec[p0] = v0[i0]; 
Note: See TracChangeset for help on using the changeset viewer.