Changeset 71b751d in sasmodels for sasmodels/models/parallelepiped.c


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/parallelepiped.c

    rdbf1a60 r71b751d  
    66 
    77 
    8 static double 
    9 Iq(double q, 
     8static void 
     9Fq(double q, 
     10    double *F1, 
     11    double *F2, 
    1012    double sld, 
    1113    double solvent_sld, 
     
    2123 
    2224    // outer integral (with gauss points), integration limits = 0, 1 
    23     double outer_total = 0; //initialize integral 
    24  
     25    double outer_total_F1 = 0.0; //initialize integral 
     26    double outer_total_F2 = 0.0; //initialize integral 
    2527    for( int i=0; i<GAUSS_N; i++) { 
    2628        const double sigma = 0.5 * ( GAUSS_Z[i] + 1.0 ); 
     
    2931        // inner integral (with gauss points), integration limits = 0, 1 
    3032        // corresponding to angles from 0 to pi/2. 
    31         double inner_total = 0.0; 
     33        double inner_total_F1 = 0.0; 
     34        double inner_total_F2 = 0.0; 
    3235        for(int j=0; j<GAUSS_N; j++) { 
    3336            const double uu = 0.5 * ( GAUSS_Z[j] + 1.0 ); 
     
    3639            const double si1 = sas_sinx_x(mu_proj * sin_uu * a_scaled); 
    3740            const double si2 = sas_sinx_x(mu_proj * cos_uu); 
    38             inner_total += GAUSS_W[j] * square(si1 * si2); 
     41            const double fq = si1 * si2; 
     42            inner_total_F1 += GAUSS_W[j] * fq; 
     43            inner_total_F2 += GAUSS_W[j] * fq * fq; 
    3944        } 
    4045        // now complete change of inner integration variable (1-0)/(1-(-1))= 0.5 
    41         inner_total *= 0.5; 
     46        inner_total_F1 *= 0.5; 
     47        inner_total_F2 *= 0.5; 
    4248 
    4349        const double si = sas_sinx_x(mu * c_scaled * sigma); 
    44         outer_total += GAUSS_W[i] * inner_total * si * si; 
     50        outer_total_F1 += GAUSS_W[i] * inner_total_F1 * si; 
     51        outer_total_F2 += GAUSS_W[i] * inner_total_F2 * si * si; 
    4552    } 
    4653    // now complete change of outer integration variable (1-0)/(1-(-1))= 0.5 
    47     outer_total *= 0.5; 
     54    outer_total_F1 *= 0.5; 
     55    outer_total_F2 *= 0.5; 
    4856 
    4957    // Multiply by contrast^2 and convert from [1e-12 A-1] to [cm-1] 
    5058    const double V = form_volume(length_a, length_b, length_c); 
    51     const double drho = (sld-solvent_sld); 
    52     return 1.0e-4 * square(drho * V) * outer_total; 
     59    const double contrast = (sld-solvent_sld); 
     60    const double s = contrast * V; 
     61    *F1 = 1.0e-2 * s * outer_total_F1; 
     62    *F2 = 1.0e-4 * s * s * outer_total_F2; 
    5363} 
    54  
    5564 
    5665static double 
Note: See TracChangeset for help on using the changeset viewer.