Ignore:
Timestamp:
Aug 14, 2018 10:09:34 AM (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.c

    rd86f0fc r71b751d  
    1313} 
    1414 
    15 static double 
    16 Iq(double q, 
     15static void 
     16Fq(double q, 
     17    double *F1, 
     18    double *F2, 
    1719    double sld, 
    1820    double solvent_sld, 
     
    3638    const double v2b = M_PI_2;  //phi integration limits 
    3739 
    38     double outer_sum = 0.0; 
     40    double outer_sum_F1 = 0.0; 
     41    double outer_sum_F2 = 0.0; 
    3942    for(int i=0; i<GAUSS_N; i++) { 
    4043 
     
    4649        const double termC2 = sas_sinx_x(q * (c_half-thickness)*cos(theta)); 
    4750 
    48         double inner_sum = 0.0; 
     51        double inner_sum_F1 = 0.0; 
     52        double inner_sum_F2 = 0.0; 
    4953        for(int j=0; j<GAUSS_N; j++) { 
    5054 
     
    6468            const double AP2 = vol_core * termA2 * termB2 * termC2; 
    6569 
    66             inner_sum += GAUSS_W[j] * square(AP1-AP2); 
     70            inner_sum_F1 += GAUSS_W[j] * (AP1-AP2); 
     71            inner_sum_F2 += GAUSS_W[j] * square(AP1-AP2); 
    6772        } 
    68         inner_sum *= 0.5 * (v2b-v2a); 
     73        inner_sum_F1 *= 0.5 * (v2b-v2a); 
     74        inner_sum_F2 *= 0.5 * (v2b-v2a); 
    6975 
    70         outer_sum += GAUSS_W[i] * inner_sum * sin(theta); 
     76        outer_sum_F1 += GAUSS_W[i] * inner_sum_F1 * sin(theta); 
     77        outer_sum_F2 += GAUSS_W[i] * inner_sum_F2 * sin(theta); 
    7178    } 
    72     outer_sum *= 0.5*(v1b-v1a); 
     79    outer_sum_F1 *= 0.5*(v1b-v1a); 
     80    outer_sum_F2 *= 0.5*(v1b-v1a); 
    7381 
    7482    // Normalize as in Eqn. (15) without the volume factor (as cancels with (V*DelRho)^2 normalization) 
    7583    // The factor 2 is due to the different theta integration limit (pi/2 instead of pi) 
    76     const double form = outer_sum/M_PI_2; 
     84    const double form_avg = outer_sum_F1/M_PI_2; 
     85    const double form_squared_avg = outer_sum_F2/M_PI_2; 
    7786 
    7887    // Multiply by contrast^2. Factor corresponding to volume^2 cancels with previous normalization. 
    79     const double delrho = sld - solvent_sld; 
     88    const double contrast = sld - solvent_sld; 
    8089 
    8190    // Convert from [1e-12 A-1] to [cm-1] 
    82     return 1.0e-4 * delrho * delrho * form; 
     91    *F1 = 1.0e-2 * contrast * form_avg; 
     92    *F2 = 1.0e-4 * contrast * contrast * form_squared_avg; 
    8393} 
    8494 
Note: See TracChangeset for help on using the changeset viewer.