Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/ellipsoid.c

    r130d4c7 r925ad6e  
    44    double radius_polar, double radius_equatorial, double theta, double phi); 
    55 
    6 static double 
    7 _ellipsoid_kernel(double q, double radius_polar, double radius_equatorial, double cos_alpha) 
     6double _ellipsoid_kernel(double q, double radius_polar, double radius_equatorial, double sin_alpha); 
     7double _ellipsoid_kernel(double q, double radius_polar, double radius_equatorial, double sin_alpha) 
    88{ 
    99    double ratio = radius_polar/radius_equatorial; 
    10     // Using ratio v = Rp/Re, we can expand the following to match the 
    11     // form given in Guinier (1955) 
    12     //     r = Re * sqrt(1 + cos^2(T) (v^2 - 1)) 
    13     //       = Re * sqrt( (1 - cos^2(T)) + v^2 cos^2(T) ) 
    14     //       = Re * sqrt( sin^2(T) + v^2 cos^2(T) ) 
    15     //       = sqrt( Re^2 sin^2(T) + Rp^2 cos^2(T) ) 
    16     // 
     10    // Given the following under the radical: 
     11    //     1 + sin^2(T) (v^2 - 1) 
     12    // we can expand to match the form given in Guinier (1955) 
     13    //     = (1 - sin^2(T)) + v^2 sin^2(T) = cos^2(T) + sin^2(T) 
    1714    // Instead of using pythagoras we could pass in sin and cos; this may be 
    1815    // slightly better for 2D which has already computed it, but it introduces 
     
    2017    // leave it as is. 
    2118    const double r = radius_equatorial 
    22                      * sqrt(1.0 + cos_alpha*cos_alpha*(ratio*ratio - 1.0)); 
     19                     * sqrt(1.0 + sin_alpha*sin_alpha*(ratio*ratio - 1.0)); 
    2320    const double f = sas_3j1x_x(q*r); 
    2421 
     
    4239    double total = 0.0; 
    4340    for (int i=0;i<76;i++) { 
    44         //const double cos_alpha = (Gauss76Z[i]*(upper-lower) + upper + lower)/2; 
    45         const double cos_alpha = Gauss76Z[i]*zm + zb; 
    46         total += Gauss76Wt[i] * _ellipsoid_kernel(q, radius_polar, radius_equatorial, cos_alpha); 
     41        //const double sin_alpha = (Gauss76Z[i]*(upper-lower) + upper + lower)/2; 
     42        const double sin_alpha = Gauss76Z[i]*zm + zb; 
     43        total += Gauss76Wt[i] * _ellipsoid_kernel(q, radius_polar, radius_equatorial, sin_alpha); 
    4744    } 
    4845    // translate dx in [-1,1] to dx in [lower,upper] 
     
    6259    double q, sin_alpha, cos_alpha; 
    6360    ORIENT_SYMMETRIC(qx, qy, theta, phi, q, sin_alpha, cos_alpha); 
    64     const double form = _ellipsoid_kernel(q, radius_polar, radius_equatorial, cos_alpha); 
     61    const double form = _ellipsoid_kernel(q, radius_polar, radius_equatorial, sin_alpha); 
    6562    const double s = (sld - sld_solvent) * form_volume(radius_polar, radius_equatorial); 
    6663 
Note: See TracChangeset for help on using the changeset viewer.