Ignore:
Timestamp:
Oct 19, 2018 3:49:12 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:
31fc4ad
Parents:
e44432d (diff), 353e899 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into beta_approx

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/hollow_rectangular_prism_thin_walls.c

    rd86f0fc re44432d  
     1static double 
     2shell_volume(double length_a, double b2a_ratio, double c2a_ratio) 
     3{ 
     4    const double length_b = length_a * b2a_ratio; 
     5    const double length_c = length_a * c2a_ratio; 
     6    const double shell_volume = 2.0 * (length_a*length_b + length_a*length_c + length_b*length_c); 
     7    return shell_volume; 
     8} 
     9 
    110static double 
    211form_volume(double length_a, double b2a_ratio, double c2a_ratio) 
    312{ 
    4     double length_b = length_a * b2a_ratio; 
    5     double length_c = length_a * c2a_ratio; 
    6     double vol_shell = 2.0 * (length_a*length_b + length_a*length_c + length_b*length_c); 
    7     return vol_shell; 
     13    const double length_b = length_a * b2a_ratio; 
     14    const double length_c = length_a * c2a_ratio; 
     15    const double form_volume = length_a * length_b * length_c; 
     16    return form_volume; 
    817} 
    918 
    1019static double 
    11 Iq(double q, 
     20effective_radius(int mode, double length_a, double b2a_ratio, double c2a_ratio) 
     21{ 
     22    switch (mode) { 
     23    case 1: // equivalent sphere 
     24        return cbrt(0.75*cube(length_a)*b2a_ratio*c2a_ratio/M_PI); 
     25    case 2: // half length_a 
     26        return 0.5 * length_a; 
     27    case 3: // half length_b 
     28        return 0.5 * length_a*b2a_ratio; 
     29    case 4: // half length_c 
     30        return 0.5 * length_a*c2a_ratio; 
     31    case 5: // equivalent outer circular cross-section 
     32        return length_a*sqrt(b2a_ratio/M_PI); 
     33    case 6: // half ab diagonal 
     34        return 0.5*sqrt(square(length_a) * (1.0 + square(b2a_ratio))); 
     35    case 7: // half diagonal 
     36        return 0.5*sqrt(square(length_a) * (1.0 + square(b2a_ratio) + square(c2a_ratio))); 
     37    } 
     38} 
     39 
     40static void 
     41Fq(double q, 
     42    double *F1, 
     43    double *F2, 
    1244    double sld, 
    1345    double solvent_sld, 
     
    2860    const double v2b = M_PI_2;  //phi integration limits 
    2961 
    30     double outer_sum = 0.0; 
     62    double outer_sum_F1 = 0.0; 
     63    double outer_sum_F2 = 0.0; 
    3164    for(int i=0; i<GAUSS_N; i++) { 
    3265        const double theta = 0.5 * ( GAUSS_Z[i]*(v1b-v1a) + v1a + v1b ); 
     
    4174        const double termAT_theta = 8.0 * sin_c / (q*q*sin_theta*cos_theta); 
    4275 
    43         double inner_sum = 0.0; 
     76        double inner_sum_F1 = 0.0; 
     77        double inner_sum_F2 = 0.0; 
    4478        for(int j=0; j<GAUSS_N; j++) { 
    4579            const double phi = 0.5 * ( GAUSS_Z[j]*(v2b-v2a) + v2a + v2b ); 
     
    6094                * ( cos_a*sin_b/cos_phi + cos_b*sin_a/sin_phi ); 
    6195 
    62             inner_sum += GAUSS_W[j] * square(AL+AT); 
     96            inner_sum_F1 += GAUSS_W[j] * (AL+AT); 
     97            inner_sum_F2 += GAUSS_W[j] * square(AL+AT); 
    6398        } 
    6499 
    65         inner_sum *= 0.5 * (v2b-v2a); 
    66         outer_sum += GAUSS_W[i] * inner_sum * sin_theta; 
     100        inner_sum_F1 *= 0.5 * (v2b-v2a); 
     101        inner_sum_F2 *= 0.5 * (v2b-v2a); 
     102        outer_sum_F1 += GAUSS_W[i] * inner_sum_F1 * sin_theta; 
     103        outer_sum_F2 += GAUSS_W[i] * inner_sum_F2 * sin_theta; 
    67104    } 
    68105 
    69     outer_sum *= 0.5*(v1b-v1a); 
     106    outer_sum_F1 *= 0.5*(v1b-v1a); 
     107    outer_sum_F2 *= 0.5*(v1b-v1a); 
    70108 
    71109    // Normalize as in Eqn. (15) without the volume factor (as cancels with (V*DelRho)^2 normalization) 
    72110    // The factor 2 is due to the different theta integration limit (pi/2 instead of pi) 
    73     double answer = outer_sum/M_PI_2; 
     111    const double form_avg = outer_sum_F1/M_PI_2; 
     112    const double form_squared_avg = outer_sum_F2/M_PI_2; 
    74113 
    75114    // Multiply by contrast^2. Factor corresponding to volume^2 cancels with previous normalization. 
    76     answer *= square(sld-solvent_sld); 
     115    const double contrast = sld - solvent_sld; 
    77116 
    78117    // Convert from [1e-12 A-1] to [cm-1] 
    79     answer *= 1.0e-4; 
    80  
    81     return answer; 
     118    *F1 = 1e-2 * contrast * form_avg; 
     119    *F2 = 1e-4 * contrast * contrast * form_squared_avg; 
    82120} 
Note: See TracChangeset for help on using the changeset viewer.