Changeset d277229 in sasmodels for sasmodels/models/cylinder.c


Ignore:
Timestamp:
Sep 7, 2018 5:29:38 AM (6 years ago)
Author:
grethevj
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
3c60146
Parents:
2a12351b
Message:

Models updated to include choices for effective interaction radii

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/cylinder.c

    r71b751d rd277229  
    1111{ 
    1212    return sas_2J1x_x(qab*radius) * sas_sinx_x(qc*0.5*length); 
     13} 
     14 
     15static double 
     16radius_from_volume(double radius, double length) 
     17{ 
     18    return cbrt(0.75*radius*radius*length); 
     19} 
     20 
     21static double 
     22radius_from_diagonal(double radius, double length) 
     23{ 
     24    return sqrt(radius*radius + 0.25*length*length); 
     25} 
     26 
     27static double 
     28effective_radius(int mode, double radius, double length) 
     29{ 
     30    if (mode == 1) { 
     31        return radius_from_volume(radius, length); 
     32    } else if (mode == 2) { 
     33        return radius; 
     34    } else if (mode == 3) { 
     35        return 0.5*length; 
     36    } else if (mode == 4) { 
     37        return (radius < 0.5*length ? radius : 0.5*length); 
     38    } else if (mode == 5) { 
     39        return (radius > 0.5*length ? radius : 0.5*length); 
     40    } else { 
     41        return radius_from_diagonal(radius,length); 
     42    } 
    1343} 
    1444 
Note: See TracChangeset for help on using the changeset viewer.