Changeset a94046f in sasmodels


Ignore:
Timestamp:
Sep 8, 2018 8:55:23 AM (12 days ago)
Author:
richardh
Branches:
beta_approx
Children:
fbaef04
Parents:
b763f9d
Message:

some corrections to R_eff options

Location:
sasmodels/models
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/core_multi_shell.c

    rd277229 ra94046f  
    3232static double 
    3333effective_radius(int mode, double core_radius, double fp_n, double thickness[]) 
     34// this seems regardless to always give the result for outer radius for n=1 shells; why?? 
     35// printf shows fp_n is always 1, not 0,1,2 
    3436{ 
    35     if (mode == 1) { 
     37//        printf("fp_n =%g \n",fp_n); 
     38        if (mode == 1) { 
    3639        double r = core_radius; 
    3740        int n = (int)(fp_n+0.5); 
    38         for (int i=0; i < n; i++) { 
    39             r += thickness[i]; 
     41        if ( n > 0) { 
     42            for (int i=0; i < n; i++) { 
     43                r += thickness[i]; 
     44            } 
    4045        } 
    4146        return r; 
  • sasmodels/models/core_shell_cylinder.c

    rd277229 ra94046f  
    2424{ 
    2525    const double radius_outer = radius + thickness; 
    26     const double length_outer = length + thickness; 
     26    const double length_outer = length + 2.0*thickness; 
    2727    return sqrt(radius_outer*radius_outer + 0.25*length_outer*length_outer); 
    2828} 
     
    3030static double 
    3131effective_radius(int mode, double radius, double thickness, double length) 
     32//effective_radius_type = ["equivalent sphere","outer radius","half outer length","half min outer dimension", 
     33//                         "half max outer dimension","half outer diagonal"] 
    3234{ 
    3335    if (mode == 1) { 
  • sasmodels/models/core_shell_parallelepiped.c

    rd277229 ra94046f  
    4545effective_radius(int mode, double length_a, double length_b, double length_c, 
    4646                 double thick_rim_a, double thick_rim_b, double thick_rim_c) 
     47//effective_radius_type = ["equivalent sphere","half outer length_a", "half outer length_b", "half outer length_c", 
     48//                         "equivalent circular cross-section","half outer ab diagonal","half outer diagonal"] 
     49// note the core box is A*B*C with slabs ta, tb & tc on each face but missing the corners, though that fact is ignored here 
     50// in the equvalent sphere option 
    4751{ 
    4852    if (mode == 1) { 
    4953        return radius_from_volume(length_a, length_b, length_c, thick_rim_a, thick_rim_b, thick_rim_c); 
    5054    } else if (mode == 2) { 
    51         return 0.5 * (length_a + thick_rim_a); 
     55        return 0.5 * length_a + thick_rim_a; 
    5256    } else if (mode == 3) { 
    53         return 0.5 * (length_b + thick_rim_b); 
     57        return 0.5 * length_b + thick_rim_b; 
    5458    } else if (mode == 4) { 
    55         return 0.5 * (length_c + thick_rim_c); 
     59        return 0.5 * length_c + thick_rim_c; 
    5660    } else if (mode == 5) { 
    5761        return radius_from_crosssection(length_a, length_b, thick_rim_a, thick_rim_b); 
    5862    } else if (mode == 6) { 
    59         return 0.5*sqrt(square(length_a+thick_rim_a) + square(length_b+thick_rim_b)); 
     63        return 0.5*sqrt(square(length_a+ 2.0*thick_rim_a) + square(length_b+ 2.0*thick_rim_b)); 
    6064    } else { 
    61         return 0.5*sqrt(square(length_a+thick_rim_a) + square(length_b+thick_rim_b) + square(length_c+thick_rim_c)); 
     65        return 0.5*sqrt(square(length_a+ 2.0*thick_rim_a) + square(length_b+ 2.0*thick_rim_b) + square(length_c+ 2.0*thick_rim_c)); 
    6266    } 
    6367} 
  • sasmodels/models/elliptical_cylinder.c

    rd277229 ra94046f  
    1313 
    1414static double 
    15 radius_from_min_dimension(double radius_minor, double r_ratio, double length) 
     15radius_from_min_dimension(double radius_minor, double r_ratio, double hlength) 
    1616{ 
    1717    const double rad_min = (r_ratio > 1.0 ? radius_minor : r_ratio*radius_minor); 
    18     return (rad_min < length ? rad_min : length); 
     18    return (rad_min < length ? rad_min : hlength); 
    1919} 
    2020 
    2121static double 
    22 radius_from_max_dimension(double radius_minor, double r_ratio, double length) 
     22radius_from_max_dimension(double radius_minor, double r_ratio, double hlength) 
    2323{ 
    2424    const double rad_max = (r_ratio < 1.0 ? radius_minor : r_ratio*radius_minor); 
    25     return (rad_max > length ? rad_max : length); 
     25    return (rad_max > length ? rad_max : hlength); 
    2626} 
    2727 
     
    3535static double 
    3636effective_radius(int mode, double radius_minor, double r_ratio, double length) 
     37//effective_radius_type = ["equivalent sphere","average radius","min radius","max radius", 
     38//                         "equivalent circular cross-section","half length","half min dimension","half max dimension","half diagonal"] 
    3739{ 
    3840    if (mode == 1) { 
     
    4951        return 0.5*length; 
    5052    } else if (mode == 7) { 
    51         return radius_from_min_dimension(radius_minor,r_ratio,length); 
     53        return radius_from_min_dimension(radius_minor,r_ratio,0.5*length); 
    5254    } else if (mode == 8) { 
    53         return radius_from_max_dimension(radius_minor,r_ratio,length); 
     55        return radius_from_max_dimension(radius_minor,r_ratio,0.5*length); 
    5456    } else { 
    5557        return radius_from_diagonal(radius_minor,r_ratio,length); 
  • sasmodels/models/hollow_rectangular_prism.c

    rd277229 ra94046f  
    1515static double 
    1616effective_radius(int mode, double length_a, double b2a_ratio, double c2a_ratio, double thickness) 
     17//effective_radius_type = ["equivalent sphere","half length_a", "half length_b", "half length_c", 
     18//                         "equivalent outer circular cross-section","half ab diagonal","half diagonal"] 
     19// NOTE length_a is external dimension! 
    1720{ 
    1821    if (mode == 1) { 
  • sasmodels/models/hollow_rectangular_prism.py

    rd277229 ra94046f  
    126126               "Solvent scattering length density"], 
    127127              ["length_a", "Ang", 35, [0, inf], "volume", 
    128                "Shorter side of the parallelepiped"], 
     128               "Shortest, external, size of the parallelepiped"], 
    129129              ["b2a_ratio", "Ang", 1, [0, inf], "volume", 
    130130               "Ratio sides b/a"], 
Note: See TracChangeset for help on using the changeset viewer.