Changeset 7e0b281 in sasmodels for explore/sc.c


Ignore:
Timestamp:
Apr 17, 2017 6:34:52 PM (8 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:
64ca163
Parents:
cb038a2
Message:

adjust paracrystal equations to better match terminology in Matsuoka paper

File:
1 edited

Legend:

Unmodified
Added
Removed
  • explore/sc.c

    rfdd56a1 r7e0b281  
    11static double 
    2 _sq_sc(double qa, double qb, double qc, double dnn, double d_factor) 
     2sc_Zq(double qa, double qb, double qc, double dnn, double d_factor) 
    33{ 
    44    // Rewriting equations for efficiency, accuracy and readability, and so 
     
    88    const double a3 = qc; 
    99 
    10     const double arg = 0.5*square(dnn*d_factor)*(a1*a1 + a2*a2 + a3*a3); 
     10    const double arg = -0.5*square(dnn*d_factor)*(a1*a1 + a2*a2 + a3*a3); 
    1111 
    1212    // Numerator: (1 - exp(a)^2)^3 
     
    1616    //         => exp(a)^2 - 2 cos(xk) exp(a) + 1 
    1717    //         => (exp(a) - 2 cos(xk)) * exp(a) + 1 
    18     const double exp_arg = exp(-arg); 
    19     const double Sq = -cube(expm1(-2.0*arg)) 
     18    const double exp_arg = exp(arg); 
     19    const double Zq = -cube(expm1(2.0*arg)) 
    2020        / ( ((exp_arg - 2.0*cos(dnn*a1))*exp_arg + 1.0) 
    2121          * ((exp_arg - 2.0*cos(dnn*a2))*exp_arg + 1.0) 
    2222          * ((exp_arg - 2.0*cos(dnn*a3))*exp_arg + 1.0)); 
    2323 
    24     return Sq; 
     24    return Zq; 
    2525} 
    2626 
    2727// occupied volume fraction calculated from lattice symmetry and sphere radius 
    2828static double 
    29 _sc_volume_fraction(double radius, double dnn) 
     29sc_volume_fraction(double radius, double dnn) 
    3030{ 
    3131    return sphere_volume(radius/dnn); 
     
    9898            const double qa = qab*cos_phi; 
    9999            const double qb = qab*sin_phi; 
    100             const double fq = _sq_sc(qa, qb, qc, dnn, d_factor); 
    101             inner_sum += fq; 
     100            const double form = sc_Zq(qa, qb, qc, dnn, d_factor); 
     101            inner_sum += form; 
    102102        } 
    103103        inner_sum *= phi_m;  // sum(f(x)dx) = sum(f(x)) dx 
     
    106106    outer_sum *= theta_m/(n*n); 
    107107#endif 
    108 double Sq; 
     108double Zq; 
    109109if (sym > 0.) { 
    110     Sq = outer_sum/M_PI_2; 
     110    Zq = outer_sum/M_PI_2; 
    111111} else { 
    112     Sq = outer_sum/(4.0*M_PI); 
     112    Zq = outer_sum/(4.0*M_PI); 
    113113} 
    114114 
     115    return Zq; 
    115116    const double Pq = sphere_form(q, radius, sld, solvent_sld); 
    116  
    117     return _sc_volume_fraction(radius, dnn) * Pq * Sq; 
     117    return sc_volume_fraction(radius, dnn) * Pq * Zq; 
    118118} 
    119119 
     
    133133    q = sqrt(qa*qa + qb*qb + qc*qc); 
    134134    const double Pq = sphere_form(q, radius, sld, solvent_sld); 
    135     const double Sq = _sq_sc(qa, qb, qc, dnn, d_factor); 
    136     return _sc_volume_fraction(radius, dnn) * Pq * Sq; 
     135    const double Zq = sc_Zq(qa, qb, qc, dnn, d_factor); 
     136    return sc_volume_fraction(radius, dnn) * Pq * Zq; 
    137137} 
Note: See TracChangeset for help on using the changeset viewer.