Changeset b7529e2 in sasmodels


Ignore:
Timestamp:
Feb 24, 2016 9:43:51 AM (9 years ago)
Author:
piotr
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
103ea45
Parents:
8b9adb5
Message:

Code review from PK

Location:
sasmodels/models
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/multi_shell.c

    rc9f885e rb7529e2  
    1 double form_volume(void); 
    2  
    31double Iq(double q, 
    42          double core_radius, 
     
    1816 
    1917static 
    20 double F_func(double qr) { 
    21         double sc; 
    22  
    23     if (qr > 0.1){ 
    24         double sn, cn; 
    25         SINCOS(qr, sn, cn); 
    26         sc = (3.0*(sn - qr*cn)/(qr*qr*qr)); 
    27     } else{ 
    28         // herbie.uwplse.org/demo low-q solution for the above. 
    29         sc = 1.0 + 0.0035714285714285718*(qr*qr*qr*qr) - 0.1*qr*qr; 
    30     } 
    31  
    32         return sc; 
    33 } 
    34 static 
    3518double multi_shell_kernel(double q, 
    3619          double core_radius, 
     
    4225{ 
    4326        //calculate with a loop, two shells at a time 
    44         int ii=0; 
    45         double fval=0.0; 
    46         double voli = 0.0; 
     27    int ii=0; 
     28    double fval=0.0; 
     29    double voli = 0.0; 
    4730    const double sldi = core_sld-shell_sld; 
    4831 
    49         do { 
    50                 double ri = core_radius + (double)ii*(s_thickness + w_thickness); 
     32    do { 
     33        double ri = core_radius + (double)ii*(s_thickness + w_thickness); 
    5134 
    5235        // layer 1 
    53                 voli = 4.0*M_PI/3.0*ri*ri*ri; 
    54                 fval += voli*sldi*F_func(ri*q); 
     36        voli = 4.0*M_PI/3.0*ri*ri*ri; 
     37        fval += voli*sldi*sph_j1c(ri*q); 
    5538 
    56                 ri += s_thickness; 
     39        ri += s_thickness; 
    5740 
    5841        // layer 2 
    59                 voli = 4.0*M_PI/3.0*ri*ri*ri; 
    60                 fval -= voli*sldi*F_func(ri*q); 
     42        voli = 4.0*M_PI/3.0*ri*ri*ri; 
     43        fval -= voli*sldi*sph_j1c(ri*q); 
    6144 
    6245        //do 2 layers at a time 
    63                 ii+=1; 
     46        ii+=1; 
    6447 
    6548        } while(ii<=n_pairs-1);  //change to make 0 < n_pairs < 2 correspond to 
     
    6851    fval *= 1.0e-4*fval/voli; 
    6952 
    70         return(fval); 
    71 } 
    72  
    73 double form_volume(void){ 
    74     return NAN; 
     53    return(fval); 
    7554} 
    7655 
  • sasmodels/models/multi_shell.py

    rc9f885e rb7529e2  
    6767# pylint: enable=bad-whitespace, line-too-long 
    6868 
    69 source = ["multi_shell.c"] 
     69source = ["lib/sph_j1c.c", "multi_shell.c"] 
     70 
     71polydispersity = ["core_radius", "n_pairs"] 
    7072 
    7173demo = dict(scale=1, background=0, 
Note: See TracChangeset for help on using the changeset viewer.