Changeset 71b751d in sasmodels for sasmodels/models/cylinder.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/cylinder.c

    r108e70e r71b751d  
    88 
    99static double 
    10 fq(double qab, double qc, double radius, double length) 
     10_fq(double qab, double qc, double radius, double length) 
    1111{ 
    1212    return sas_2J1x_x(qab*radius) * sas_sinx_x(qc*0.5*length); 
    1313} 
    1414 
    15 static double 
    16 orient_avg_1D(double q, double radius, double length) 
     15static void 
     16Fq(double q, 
     17    double *F1, 
     18    double *F2, 
     19    double sld, 
     20    double solvent_sld, 
     21    double radius, 
     22    double length) 
    1723{ 
    1824    // translate a point in [-1,1] to a point in [0, pi/2] 
     
    2026    const double zb = M_PI_4; 
    2127 
    22     double total = 0.0; 
     28    double total_F1 = 0.0; 
     29    double total_F2 = 0.0; 
    2330    for (int i=0; i<GAUSS_N ;i++) { 
    2431        const double theta = GAUSS_Z[i]*zm + zb; 
     
    2633        // theta (theta,phi) the projection of the cylinder on the detector plane 
    2734        SINCOS(theta , sin_theta, cos_theta); 
    28         const double form = fq(q*sin_theta, q*cos_theta, radius, length); 
    29         total += GAUSS_W[i] * form * form * sin_theta; 
     35        const double form = _fq(q*sin_theta, q*cos_theta, radius, length); 
     36        total_F1 += GAUSS_W[i] * form * sin_theta; 
     37        total_F2 += GAUSS_W[i] * form * form * sin_theta; 
    3038    } 
    3139    // translate dx in [-1,1] to dx in [lower,upper] 
    32     return total*zm; 
     40    total_F1 *= zm; 
     41    total_F2 *= zm; 
     42    const double s = (sld - solvent_sld) * form_volume(radius, length); 
     43    *F1 = 1e-2 * s * total_F1; 
     44    *F2 = 1e-4 * s * s * total_F2; 
    3345} 
    3446 
    35 static double 
    36 Iq(double q, 
    37     double sld, 
    38     double solvent_sld, 
    39     double radius, 
    40     double length) 
    41 { 
    42     const double s = (sld - solvent_sld) * form_volume(radius, length); 
    43     return 1.0e-4 * s * s * orient_avg_1D(q, radius, length); 
    44 } 
     47 
    4548 
    4649static double 
     
    5154    double length) 
    5255{ 
     56    const double form = _fq(qab, qc, radius, length); 
    5357    const double s = (sld-solvent_sld) * form_volume(radius, length); 
    54     const double form = fq(qab, qc, radius, length); 
    5558    return 1.0e-4 * square(s * form); 
    5659} 
     60 
Note: See TracChangeset for help on using the changeset viewer.