Ignore:
Timestamp:
Aug 14, 2018 12:09:34 PM (6 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
86aa992
Parents:
2f8cbb9
Message:

update remaining form factors to use Fq interface

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/hollow_rectangular_prism_thin_walls.c

    rd86f0fc r71b751d  
    88} 
    99 
    10 static double 
    11 Iq(double q, 
     10static void 
     11Fq(double q, 
     12    double *F1, 
     13    double *F2, 
    1214    double sld, 
    1315    double solvent_sld, 
     
    2830    const double v2b = M_PI_2;  //phi integration limits 
    2931 
    30     double outer_sum = 0.0; 
     32    double outer_sum_F1 = 0.0; 
     33    double outer_sum_F2 = 0.0; 
    3134    for(int i=0; i<GAUSS_N; i++) { 
    3235        const double theta = 0.5 * ( GAUSS_Z[i]*(v1b-v1a) + v1a + v1b ); 
     
    4144        const double termAT_theta = 8.0 * sin_c / (q*q*sin_theta*cos_theta); 
    4245 
    43         double inner_sum = 0.0; 
     46        double inner_sum_F1 = 0.0; 
     47        double inner_sum_F2 = 0.0; 
    4448        for(int j=0; j<GAUSS_N; j++) { 
    4549            const double phi = 0.5 * ( GAUSS_Z[j]*(v2b-v2a) + v2a + v2b ); 
     
    6064                * ( cos_a*sin_b/cos_phi + cos_b*sin_a/sin_phi ); 
    6165 
    62             inner_sum += GAUSS_W[j] * square(AL+AT); 
     66            inner_sum_F1 += GAUSS_W[j] * (AL+AT); 
     67            inner_sum_F2 += GAUSS_W[j] * square(AL+AT); 
    6368        } 
    6469 
    65         inner_sum *= 0.5 * (v2b-v2a); 
    66         outer_sum += GAUSS_W[i] * inner_sum * sin_theta; 
     70        inner_sum_F1 *= 0.5 * (v2b-v2a); 
     71        inner_sum_F2 *= 0.5 * (v2b-v2a); 
     72        outer_sum_F1 += GAUSS_W[i] * inner_sum_F1 * sin_theta; 
     73        outer_sum_F2 += GAUSS_W[i] * inner_sum_F2 * sin_theta; 
    6774    } 
    6875 
    69     outer_sum *= 0.5*(v1b-v1a); 
     76    outer_sum_F1 *= 0.5*(v1b-v1a); 
     77    outer_sum_F2 *= 0.5*(v1b-v1a); 
    7078 
    7179    // Normalize as in Eqn. (15) without the volume factor (as cancels with (V*DelRho)^2 normalization) 
    7280    // The factor 2 is due to the different theta integration limit (pi/2 instead of pi) 
    73     double answer = outer_sum/M_PI_2; 
     81    const double form_avg = outer_sum_F1/M_PI_2; 
     82    const double form_squared_avg = outer_sum_F2/M_PI_2; 
    7483 
    7584    // Multiply by contrast^2. Factor corresponding to volume^2 cancels with previous normalization. 
    76     answer *= square(sld-solvent_sld); 
     85    const double contrast = sld - solvent_sld; 
    7786 
    7887    // Convert from [1e-12 A-1] to [cm-1] 
    79     answer *= 1.0e-4; 
    80  
    81     return answer; 
     88    *F1 = 1e-2 * contrast * form_avg; 
     89    *F2 = 1e-4 * contrast * contrast * form_squared_avg; 
    8290} 
Note: See TracChangeset for help on using the changeset viewer.