Changeset c036ddb in sasmodels for sasmodels/models


Ignore:
Timestamp:
Aug 7, 2018 10:45:45 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:
7e923c2
Parents:
7b0abf8
Message:

refactor so Iq is not needed if Fq is defined

Location:
sasmodels/models
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/core_shell_sphere.py

    rdc76240 rc036ddb  
    5858title = "Form factor for a monodisperse spherical particle with particle with a core-shell structure." 
    5959description = """ 
    60     F^2(q) = 3/V_s [V_c (sld_core-sld_shell) (sin(q*radius)-q*radius*cos(q*radius))/(q*radius)^3 
    61                    + V_s (sld_shell-sld_solvent) (sin(q*r_s)-q*r_s*cos(q*r_s))/(q*r_s)^3] 
     60    F(q) = [V_c (sld_core-sld_shell) 3 (sin(q*radius)-q*radius*cos(q*radius))/(q*radius)^3 
     61            + V_s (sld_shell-sld_solvent) 3 (sin(q*r_s)-q*r_s*cos(q*r_s))/(q*r_s)^3] 
    6262 
    6363            V_s: Volume of the sphere shell 
  • sasmodels/models/ellipsoid.c

    r01c8d9e rc036ddb  
    55} 
    66 
     7/* Fq overrides Iq 
    78static  double 
    89Iq(double q, 
     
    2021    //     i(h) = int_0^1 Phi^2(h a sqrt(1 + u^2(v^2-1)) du 
    2122    const double v_square_minus_one = square(radius_polar/radius_equatorial) - 1.0; 
    22    
     23 
    2324    // translate a point in [-1,1] to a point in [0, 1] 
    2425    // const double u = GAUSS_Z[i]*(upper-lower)/2 + (upper+lower)/2; 
     
    3637    const double s = (sld - sld_solvent) * form_volume(radius_polar, radius_equatorial); 
    3738    return 1.0e-4 * s * s * form; 
    38 }  
     39} 
     40*/ 
    3941 
    4042static void 
     
    7274    const double form_avg = total_F1*zm; 
    7375    const double s = (sld - sld_solvent) * form_volume(radius_polar, radius_equatorial); 
     76    *F1 = 1e-2 * s * form_avg; 
    7477    *F2 = 1e-4 * s * s * form_squared_avg; 
    75     *F1 = 1e-2 * s * form_avg; 
    7678} 
    77  
    78  
    79  
    80  
    81  
    8279 
    8380static double 
  • sasmodels/models/ellipsoid.py

    r2d81cfe rc036ddb  
    161161             ] 
    162162 
     163 
    163164source = ["lib/sas_3j1x_x.c", "lib/gauss76.c", "ellipsoid.c"] 
     165 
     166have_Fq = True 
    164167 
    165168def ER(radius_polar, radius_equatorial): 
  • sasmodels/models/sphere.c

    r01c8d9e rc036ddb  
    44} 
    55 
     6// TODO: remove Iq when Iqxy can use Fq directly 
    67static double Iq(double q, double sld, double sld_solvent, double radius) 
    78{ 
     
    1112static void Fq(double q, double *F1,double *F2, double sld, double solvent_sld, double radius) 
    1213{ 
    13     const double fq = sphere_volume(radius) * sas_3j1x_x(q*radius); 
     14    const double fq = sas_3j1x_x(q*radius); 
    1415    const double contrast = (sld - solvent_sld); 
    15     const double form = 1e-2*contrast * fq; 
    16     *F1= form; 
     16    const double form = 1e-2 * contrast * sphere_volume(radius) * fq; 
     17    *F1 = form; 
    1718    *F2 = form*form; 
    1819} 
  • sasmodels/models/sphere.py

    r01c8d9e rc036ddb  
    6767             ] 
    6868 
    69 source = ["lib/sas_3j1x_x.c", "lib/sphere_form.c", "sphere.c"] 
     69source = ["lib/sas_3j1x_x.c", "lib/sphere_form.c"] 
    7070 
     71c_code = """ 
     72static double form_volume(double radius) 
     73{ 
     74    return sphere_volume(radius); 
     75} 
     76 
     77static void Fq(double q, double *F1,double *F2, double sld, double solvent_sld, double radius) 
     78{ 
     79    const double fq = sas_3j1x_x(q*radius); 
     80    const double contrast = (sld - solvent_sld); 
     81    const double form = 1e-2 * contrast * sphere_volume(radius) * fq; 
     82    *F1 = form; 
     83    *F2 = form*form; 
     84} 
     85""" 
     86 
     87# TODO: figure this out by inspection 
     88have_Fq = True 
    7189 
    7290def ER(radius): 
Note: See TracChangeset for help on using the changeset viewer.