Changeset 73e08ae in sasmodels


Ignore:
Timestamp:
Oct 17, 2016 11:53:08 AM (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:
0b040de
Parents:
92ce163
Message:

core_shell_ellipsoid, cylinder, ellipsoid: code cleanup

Location:
sasmodels/models
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/core_shell_ellipsoid.py

    ref5a314 r73e08ae  
    125125#             ["name", "units", default, [lower, upper], "type", "description"], 
    126126parameters = [ 
    127     ["radius_equat_core","Ang",     20,   [0, inf],    "volume",      "Equatorial radius of core"], 
     127    ["radius_equat_core","Ang",     20,   [0, inf],   "volume",      "Equatorial radius of core"], 
    128128    ["x_core",        "None",       3,   [0, inf],    "volume",      "axial ratio of core, X = r_polar/r_equatorial"], 
    129129    ["thick_shell",   "Ang",       30,   [0, inf],    "volume",      "thickness of shell at equator"], 
  • sasmodels/models/cylinder.c

    r11ca2ab r73e08ae  
    1818    const double qr = q*radius; 
    1919    const double qh = q*0.5*length;  
    20     return  sas_J1c(qr*sn) * sinc(qh*cn) ; 
     20    return sas_J1c(qr*sn) * sinc(qh*cn); 
    2121} 
    2222 
     
    6060    double q, sin_alpha, cos_alpha; 
    6161    ORIENT_SYMMETRIC(qx, qy, theta, phi, q, sin_alpha, cos_alpha); 
     62    //printf("sn: %g cn: %g\n", sin_alpha, cos_alpha); 
    6263    const double s = (sld-solvent_sld) * form_volume(radius, length); 
    63     return 1.0e-4 * square(s * fq(q, sin_alpha, cos_alpha, radius, length)); 
     64    const double form = fq(q, sin_alpha, cos_alpha, radius, length); 
     65    return 1.0e-4 * square(s * form); 
    6466} 
  • sasmodels/models/ellipsoid.c

    r5bddd89 r73e08ae  
    88{ 
    99    double ratio = radius_polar/radius_equatorial; 
    10     const double u = q*radius_equatorial*sqrt(1.0 
    11                    + sin_alpha*sin_alpha*(ratio*ratio - 1.0)); 
    12     const double f = sph_j1c(u); 
     10    // Given the following under the radical: 
     11    //     1 + sin^2(T) (v^2 - 1) 
     12    // we can expand to match the form given in Guinier (1955) 
     13    //     = (1 - sin^2(T)) + v^2 sin^2(T) = cos^2(T) + sin^2(T) 
     14    // Instead of using pythagoras we could pass in sin and cos; this may be 
     15    // slightly better for 2D which has already computed it, but it introduces 
     16    // an extra sqrt and square for 1-D not required by the current form, so 
     17    // leave it as is. 
     18    const double r = radius_equatorial 
     19                     * sqrt(1.0 + sin_alpha*sin_alpha*(ratio*ratio - 1.0)); 
     20    const double f = sph_j1c(q*r); 
    1321 
    1422    return f*f; 
Note: See TracChangeset for help on using the changeset viewer.