Ignore:
Timestamp:
Sep 10, 2018 2:16:46 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:
d299327
Parents:
3f818b2
Message:

clean up effective radius functions; improve mono_gauss_coil accuracy; start moving VR into C

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/hollow_rectangular_prism.c

    ra94046f ree60aa7  
     1// TODO: interface to form_volume/shell_volume not yet settled 
    12static double 
    2 form_volume(double length_a, double b2a_ratio, double c2a_ratio, double thickness) 
     3shell_volume(double *total, double length_a, double b2a_ratio, double c2a_ratio, double thickness) 
    34{ 
    45    double length_b = length_a * b2a_ratio; 
     
    89    double c_core = length_c - 2.0*thickness; 
    910    double vol_core = a_core * b_core * c_core; 
    10     double vol_total = length_a * length_b * length_c; 
    11     double vol_shell = vol_total - vol_core; 
    12     return vol_shell; 
     11    *total = length_a * length_b * length_c; 
     12    return *total - vol_core; 
     13} 
     14 
     15static double 
     16form_volume(double length_a, double b2a_ratio, double c2a_ratio, double thickness) 
     17{ 
     18    double total; 
     19    return shell_volume(&total, length_a, b2a_ratio, c2a_ratio, thickness); 
    1320} 
    1421 
     
    1926// NOTE length_a is external dimension! 
    2027{ 
    21     if (mode == 1) { 
     28    switch (mode) { 
     29    case 1: // equivalent sphere 
    2230        return cbrt(0.75*cube(length_a)*b2a_ratio*c2a_ratio/M_PI); 
    23     } else if (mode == 2) { 
     31    case 2: // half length_a 
    2432        return 0.5 * length_a; 
    25     } else if (mode == 3) { 
     33    case 3: // half length_b 
    2634        return 0.5 * length_a*b2a_ratio; 
    27     } else if (mode == 4) { 
     35    case 4: // half length_c 
    2836        return 0.5 * length_a*c2a_ratio; 
    29     } else if (mode == 5) { 
     37    case 5: // equivalent outer circular cross-section 
    3038        return length_a*sqrt(b2a_ratio/M_PI); 
    31     } else if (mode == 6) { 
     39    case 6: // half ab diagonal 
    3240        return 0.5*sqrt(square(length_a) * (1.0 + square(b2a_ratio))); 
    33     } else { 
     41    case 7: // half diagonal 
    3442        return 0.5*sqrt(square(length_a) * (1.0 + square(b2a_ratio) + square(c2a_ratio))); 
    3543    } 
Note: See TracChangeset for help on using the changeset viewer.