Changeset e44432d in sasmodels for sasmodels/models


Ignore:
Timestamp:
Oct 19, 2018 3:46:26 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:
be43e39
Parents:
2586ab72
Message:

support hollow models in structure factor calculations

Location:
sasmodels/models
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/hollow_cylinder.c

    ree60aa7 re44432d  
    22 
    33static double 
    4 _fq(double qab, double qc, 
    5     double radius, double thickness, double length) 
     4shell_volume(double radius, double thickness, double length) 
    65{ 
    7     const double lam1 = sas_2J1x_x((radius+thickness)*qab); 
    8     const double lam2 = sas_2J1x_x(radius*qab); 
    9     const double gamma_sq = square(radius/(radius+thickness)); 
    10     //Note: lim_{thickness -> 0} psi = sas_J0(radius*qab) 
    11     //Note: lim_{radius -> 0} psi = sas_2J1x_x(thickness*qab) 
    12     const double psi = (lam1 - gamma_sq*lam2)/(1.0 - gamma_sq);    //SRK 10/19/00 
    13     const double t2 = sas_sinx_x(0.5*length*qc); 
    14     return psi*t2; 
    15 } 
    16  
    17 // TODO: interface to form_volume/shell_volume not yet settled 
    18 static double 
    19 shell_volume(double *total, double radius, double thickness, double length) 
    20 { 
    21     *total = M_PI*length*square(radius+thickness); 
    22     return *total - M_PI*length*radius*radius; 
     6    return M_PI*length*(square(radius+thickness) - radius*radius); 
    237} 
    248 
     
    2610form_volume(double radius, double thickness, double length) 
    2711{ 
    28     double total; 
    29     return shell_volume(&total, radius, thickness, length); 
     12    return M_PI*length*square(radius+thickness); 
    3013} 
    3114 
     
    6245} 
    6346 
     47static double 
     48_fq(double qab, double qc, 
     49    double radius, double thickness, double length) 
     50{ 
     51    const double lam1 = sas_2J1x_x((radius+thickness)*qab); 
     52    const double lam2 = sas_2J1x_x(radius*qab); 
     53    const double gamma_sq = square(radius/(radius+thickness)); 
     54    //Note: lim_{thickness -> 0} psi = sas_J0(radius*qab) 
     55    //Note: lim_{radius -> 0} psi = sas_2J1x_x(thickness*qab) 
     56    const double psi = (lam1 - gamma_sq*lam2)/(1.0 - gamma_sq);    //SRK 10/19/00 
     57    const double t2 = sas_sinx_x(0.5*length*qc); 
     58    return psi*t2; 
     59} 
     60 
    6461static void 
    6562Fq(double q, double *F1, double *F2, double radius, double thickness, double length, 
     
    8178    total_F1 *= 0.5*(upper-lower); 
    8279    total_F2 *= 0.5*(upper-lower); 
    83     const double s = (sld - solvent_sld) * form_volume(radius, thickness, length); 
     80    const double s = (sld - solvent_sld) * shell_volume(radius, thickness, length); 
    8481    *F1 = 1e-2 * s * total_F1; 
    8582    *F2 = 1e-4 * s*s * total_F2; 
     
    9390{ 
    9491    const double form = _fq(qab, qc, radius, thickness, length); 
    95     const double s = (sld - solvent_sld) * form_volume(radius, thickness, length); 
     92    const double s = (sld - solvent_sld) * shell_volume(radius, thickness, length); 
    9693    return 1.0e-4*square(s * form); 
    9794} 
  • sasmodels/models/hollow_rectangular_prism.c

    ree60aa7 re44432d  
    1 // TODO: interface to form_volume/shell_volume not yet settled 
    21static double 
    3 shell_volume(double *total, double length_a, double b2a_ratio, double c2a_ratio, double thickness) 
     2shell_volume(double length_a, double b2a_ratio, double c2a_ratio, double thickness) 
    43{ 
    5     double length_b = length_a * b2a_ratio; 
    6     double length_c = length_a * c2a_ratio; 
    7     double a_core = length_a - 2.0*thickness; 
    8     double b_core = length_b - 2.0*thickness; 
    9     double c_core = length_c - 2.0*thickness; 
    10     double vol_core = a_core * b_core * c_core; 
    11     *total = length_a * length_b * length_c; 
    12     return *total - vol_core; 
     4    const double length_b = length_a * b2a_ratio; 
     5    const double length_c = length_a * c2a_ratio; 
     6    const double form_volume = length_a * length_b * length_c; 
     7    const double a_core = length_a - 2.0*thickness; 
     8    const double b_core = length_b - 2.0*thickness; 
     9    const double c_core = length_c - 2.0*thickness; 
     10    const double core_volume = a_core * b_core * c_core; 
     11    return form_volume - core_volume; 
    1312} 
    1413 
     
    1615form_volume(double length_a, double b2a_ratio, double c2a_ratio, double thickness) 
    1716{ 
    18     double total; 
    19     return shell_volume(&total, length_a, b2a_ratio, c2a_ratio, thickness); 
     17    const double length_b = length_a * b2a_ratio; 
     18    const double length_c = length_a * c2a_ratio; 
     19    const double form_volume = length_a * length_b * length_c; 
     20    return form_volume; 
    2021} 
    2122 
    2223static double 
    2324effective_radius(int mode, double length_a, double b2a_ratio, double c2a_ratio, double thickness) 
    24 //effective_radius_type = ["equivalent sphere","half length_a", "half length_b", "half length_c", 
    25 //                         "equivalent outer circular cross-section","half ab diagonal","half diagonal"] 
    2625// NOTE length_a is external dimension! 
    2726{ 
  • sasmodels/models/hollow_rectangular_prism_thin_walls.c

    ree60aa7 re44432d  
    1 // TODO: interface to form_volume/shell_volume not yet settled 
    21static double 
    3 shell_volume(double *total, double length_a, double b2a_ratio, double c2a_ratio) 
     2shell_volume(double length_a, double b2a_ratio, double c2a_ratio) 
    43{ 
    5     double length_b = length_a * b2a_ratio; 
    6     double length_c = length_a * c2a_ratio; 
    7     double vol_shell = 2.0 * (length_a*length_b + length_a*length_c + length_b*length_c); 
    8     *total = length_a * length_b * length_c; 
    9     return vol_shell; 
     4    const double length_b = length_a * b2a_ratio; 
     5    const double length_c = length_a * c2a_ratio; 
     6    const double shell_volume = 2.0 * (length_a*length_b + length_a*length_c + length_b*length_c); 
     7    return shell_volume; 
    108} 
    119 
     
    1311form_volume(double length_a, double b2a_ratio, double c2a_ratio) 
    1412{ 
    15     double total; 
    16     return shell_volume(&total, length_a, b2a_ratio, c2a_ratio); 
     13    const double length_b = length_a * b2a_ratio; 
     14    const double length_c = length_a * c2a_ratio; 
     15    const double form_volume = length_a * length_b * length_c; 
     16    return form_volume; 
    1717} 
    18  
    1918 
    2019static double 
  • sasmodels/models/vesicle.c

    ree60aa7 re44432d  
    1 // TODO: interface to form_volume/shell_volume not yet settled 
    21static double 
    3 shell_volume(double *total, double radius, double thickness) 
     2shell_volume(double radius, double thickness) 
    43{ 
    5     //note that for the vesicle model, the volume is ONLY the shell volume 
    6     *total = M_4PI_3 * cube(radius+thickness); 
    7     return *total - M_4PI_3*cube(radius); 
     4    return M_4PI_3 * (cube(radius+thickness) - cube(radius)); 
    85} 
    96 
     
    118form_volume(double radius, double thickness) 
    129{ 
    13     //note that for the vesicle model, the volume is ONLY the shell volume 
    14     double total; 
    15     return shell_volume(&total, radius, thickness); 
     10    return M_4PI_3 * cube(radius+thickness); 
    1611} 
     12 
    1713 
    1814static double 
Note: See TracChangeset for help on using the changeset viewer.