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


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_cylinder.c

    r108e70e r71b751d  
    11//#define INVALID(v) (v.radius_core >= v.radius) 
    2  
    3 // From Igor library 
    4 static double 
    5 _hollow_cylinder_scaling(double integrand, double delrho, double volume) 
    6 { 
    7     return 1.0e-4 * square(volume * delrho) * integrand; 
    8 } 
    92 
    103static double 
     
    3023 
    3124 
    32 static double 
    33 Iq(double q, double radius, double thickness, double length, 
     25static void 
     26Fq(double q, double *F1, double *F2, double radius, double thickness, double length, 
    3427    double sld, double solvent_sld) 
    3528{ 
     
    3730    const double upper = 1.0;        //limits of numerical integral 
    3831 
    39     double summ = 0.0;            //initialize intergral 
     32    double total_F1 = 0.0;            //initialize intergral 
     33    double total_F2 = 0.0; 
    4034    for (int i=0;i<GAUSS_N;i++) { 
    4135        const double cos_theta = 0.5*( GAUSS_Z[i] * (upper-lower) + lower + upper ); 
     
    4337        const double form = _fq(q*sin_theta, q*cos_theta, 
    4438                                radius, thickness, length); 
    45         summ += GAUSS_W[i] * form * form; 
     39        total_F1 += GAUSS_W[i] * form; 
     40        total_F2 += GAUSS_W[i] * form * form; 
    4641    } 
     42    total_F1 *= 0.5*(upper-lower); 
     43    total_F2 *= 0.5*(upper-lower); 
     44    const double s = (sld - solvent_sld) * form_volume(radius, thickness, length); 
     45    *F1 = 1e-2 * s * total_F1; 
     46    *F2 = 1e-4 * s*s * total_F2; 
     47} 
    4748 
    48     const double Aq = 0.5*summ*(upper-lower); 
    49     const double volume = form_volume(radius, thickness, length); 
    50     return _hollow_cylinder_scaling(Aq, solvent_sld - sld, volume); 
    51 } 
    5249 
    5350static double 
     
    5754{ 
    5855    const double form = _fq(qab, qc, radius, thickness, length); 
    59  
    60     const double vol = form_volume(radius, thickness, length); 
    61     return _hollow_cylinder_scaling(form*form, solvent_sld-sld, vol); 
     56    const double s = (sld - solvent_sld) * form_volume(radius, thickness, length); 
     57    return 1.0e-4*square(s * form); 
    6258} 
Note: See TracChangeset for help on using the changeset viewer.