Changeset 6d96b66 in sasmodels for sasmodels/models/fractal_core_shell.c


Ignore:
Timestamp:
Oct 18, 2016 8:32:18 PM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
f0afad2
Parents:
3e8ea5d
Message:

fractal models: handle limits of q=0 and dim=1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/fractal_core_shell.c

    r3a48772 r6d96b66  
    2727 
    2828 
    29    double intensity = core_shell_kernel(q, 
    30                               radius, 
    31                               thickness, 
    32                               core_sld, 
    33                               shell_sld, 
    34                               solvent_sld); 
     29    const double pq = core_shell_kernel(q, radius, thickness, 
     30                                        core_sld, shell_sld, solvent_sld); 
     31 
     32 
    3533    //calculate S(q) 
    36     double frac_1 = fractal_dim-1.0; 
    37     double qr = q*radius; 
     34    double sq; 
     35    if (q > 0. && fractal_dim > 1.) { 
     36        // q>0, D>0 
     37        const double D = fractal_dim; 
     38        const double Dm1 = fractal_dim - 1.0; 
     39        const double t1 = D*sas_gamma(Dm1)*sin((Dm1)*atan(q*cor_length)); 
     40        const double t2 = pow(q*radius, -D); 
     41        const double t3 = pow(1.0 + 1.0/square(q*cor_length), -0.5*Dm1); 
     42        sq = 1.0 + t1 * t2 * t3; 
     43    } else if (q > 0.) { 
     44        // q>0, D=1 
     45        sq = 1.0 + atan(q*cor_length) / (q*radius); 
     46    } else if (fractal_dim > 1.) { 
     47        // q=0, D>1 
     48        const double D = fractal_dim; 
     49        sq = 1.0 + pow(cor_length/radius, D)*sas_gamma(D+1.0); 
     50    } else { 
     51        // q=0, D=1 
     52        sq = 1.0 + cor_length/radius; 
     53    } 
    3854 
    39     double t1 = fractal_dim*sas_gamma(frac_1)*sin(frac_1*atan(q*cor_length)); 
    40     double t2 = (1.0 + 1.0/(q*cor_length)/(q*cor_length)); 
    41     double t3 = pow(qr, fractal_dim) * pow(t2, (frac_1/2.0)); 
    42     double sq = t1/t3; 
    43     sq += 1.0; 
    44  
    45     return sq*intensity*volfraction; 
     55    // Note: core_shell_kernel already performs the 1e-4 unit conversion 
     56    return volfraction * sq * pq; 
    4657} 
    4758 
Note: See TracChangeset for help on using the changeset viewer.