Changeset d277229 in sasmodels for sasmodels/models/hollow_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/hollow_cylinder.c

    r71b751d rd277229  
    2222} 
    2323 
     24static double 
     25radius_from_volume(double radius, double thickness, double length) 
     26{ 
     27    const double volume_outer_cyl = M_PI*square(radius + thickness)*length; 
     28    return cbrt(0.75*volume_outer_cyl/M_PI); 
     29} 
     30 
     31static double 
     32radius_from_diagonal(double radius, double thickness, double length) 
     33{ 
     34    return sqrt(square(radius + thickness) + 0.25*square(length)); 
     35} 
     36 
     37static double 
     38effective_radius(int mode, double radius, double thickness, double length) 
     39{ 
     40    if (mode == 1) { 
     41        return radius_from_volume(radius, thickness, length); 
     42    } else if (mode == 2) { 
     43        return radius + thickness; 
     44    } else if (mode == 3) { 
     45        return 0.5*length; 
     46    } else if (mode == 4) { 
     47        return (radius + thickness < 0.5*length ? radius + thickness : 0.5*length); 
     48    } else if (mode == 5) { 
     49        return (radius + thickness > 0.5*length ? radius + thickness : 0.5*length); 
     50    } else { 
     51        return radius_from_diagonal(radius,thickness,length); 
     52    } 
     53} 
    2454 
    2555static void 
Note: See TracChangeset for help on using the changeset viewer.