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/core_shell_ellipsoid.c

    r71b751d rd277229  
    3636    double vol = M_4PI_3*equat_shell*equat_shell*polar_shell; 
    3737    return vol; 
     38} 
     39 
     40static double 
     41radius_from_volume(double radius_equat_core, double x_core, double thick_shell, double x_polar_shell) 
     42{ 
     43    const double volume_ellipsoid = form_volume(radius_equat_core, x_core, thick_shell, x_polar_shell); 
     44    return cbrt(0.75*volume_ellipsoid/M_PI); 
     45} 
     46 
     47static double 
     48radius_from_curvature(double radius_equat_core, double x_core, double thick_shell, double x_polar_shell) 
     49{ 
     50    // Trivial cases 
     51    if (x_core == x_polar_shell == 1.0) return radius_equat_core + thick_shell; 
     52    if ((radius_equat_core + thick_shell)*(radius_equat_core*x_core + thick_shell*x_polar_shell) == 0.)  return 0.; 
     53 
     54    // see equation (26) in A.Isihara, J.Chem.Phys. 18(1950)1446-1449 
     55    const double radius_equat_tot = radius_equat_core + thick_shell; 
     56    const double radius_polar_tot = radius_equat_core*x_core + thick_shell*x_polar_shell; 
     57    const double ratio = (radius_polar_tot < radius_equat_tot 
     58                          ? radius_polar_tot / radius_equat_tot 
     59                          : radius_equat_tot / radius_polar_tot); 
     60    const double e1 = sqrt(1.0 - ratio*ratio); 
     61    const double b1 = 1.0 + asin(e1) / (e1 * ratio); 
     62    const double bL = (1.0 + e1) / (1.0 - e1); 
     63    const double b2 = 1.0 + 0.5 * ratio * ratio / e1 * log(bL); 
     64    const double delta = 0.75 * b1 * b2; 
     65    const double ddd = 2.0 * (delta + 1.0) * radius_polar_tot * radius_equat_tot * radius_equat_tot; 
     66    return 0.5 * cbrt(ddd); 
     67} 
     68 
     69static double 
     70effective_radius(int mode, double radius_equat_core, double x_core, double thick_shell, double x_polar_shell) 
     71{ 
     72    if (mode == 1) { 
     73        return radius_from_volume(radius_equat_core, x_core, thick_shell, x_polar_shell); 
     74    } else if (mode == 2) { 
     75        return radius_from_curvature(radius_equat_core, x_core, thick_shell, x_polar_shell); 
     76    } else if (mode == 3) { 
     77        const double radius_equat_tot = radius_equat_core + thick_shell; 
     78        const double radius_polar_tot = radius_equat_core*x_core + thick_shell*x_polar_shell; 
     79        return (radius_polar_tot < radius_equat_tot ? radius_polar_tot : radius_equat_tot); 
     80    } else { 
     81        const double radius_equat_tot = radius_equat_core + thick_shell; 
     82        const double radius_polar_tot = radius_equat_core*x_core + thick_shell*x_polar_shell; 
     83        return (radius_polar_tot > radius_equat_tot ? radius_polar_tot : radius_equat_tot); 
     84    } 
    3885} 
    3986 
Note: See TracChangeset for help on using the changeset viewer.