Changeset d2deac2 in sasmodels


Ignore:
Timestamp:
Dec 20, 2016 4:40:52 PM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
e9b0ef3
Parents:
21fbab1
Message:

use integer number of pearls when computing effective radius

Location:
sasmodels/models
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/pearl_necklace.c

    r2126131 rd2deac2  
    11double form_volume(double radius, double edge_sep, 
    2     double thick_string, double num_pearls); 
     2    double thick_string, double fp_num_pearls); 
    33double Iq(double q, double radius, double edge_sep, 
    4     double thick_string, double num_pearls, double sld,  
     4    double thick_string, double fp_num_pearls, double sld, 
    55    double string_sld, double solvent_sld); 
    66 
     
    99// From Igor library 
    1010static double 
    11 _pearl_necklace_kernel(double q, double radius, double edge_sep, double thick_string, 
    12     double num_pearls, double sld_pearl, double sld_string, double sld_solv) 
     11pearl_necklace_kernel(double q, double radius, double edge_sep, double thick_string, 
     12    int num_pearls, double sld_pearl, double sld_string, double sld_solv) 
    1313{ 
    1414    // number of string segments 
     
    6969 
    7070double form_volume(double radius, double edge_sep, 
    71     double thick_string, double num_pearls) 
     71    double thick_string, double fp_num_pearls) 
    7272{ 
    73     num_pearls = floor(num_pearls + 0.5); //Force integer number of pearls 
    74  
    75     const double num_strings = num_pearls - 1.0; 
     73    const int num_pearls = (int)(fp_num_pearls + 0.5); //Force integer number of pearls 
     74    const int num_strings = num_pearls - 1; 
    7675    const double string_vol = edge_sep * M_PI_4 * thick_string * thick_string; 
    7776    const double pearl_vol = M_4PI_3 * radius * radius * radius; 
     
    8281 
    8382double Iq(double q, double radius, double edge_sep, 
    84     double thick_string, double num_pearls, double sld,  
     83    double thick_string, double fp_num_pearls, double sld, 
    8584    double string_sld, double solvent_sld) 
    8685{ 
    87     const double form = _pearl_necklace_kernel(q, radius, edge_sep, 
     86    const int num_pearls = (int)(fp_num_pearls + 0.5); //Force integer number of pearls 
     87    const double form = pearl_necklace_kernel(q, radius, edge_sep, 
    8888        thick_string, num_pearls, sld, string_sld, solvent_sld); 
    8989 
  • sasmodels/models/pearl_necklace.py

    r2126131 rd2deac2  
    100100    Redundant with form_volume. 
    101101    """ 
     102    num_pearls = int(num_pearls + 0.5) 
    102103    number_of_strings = num_pearls - 1.0 
    103104    string_vol = edge_sep * pi * pow((thick_string / 2.0), 2.0) 
     
    111112    Calculation for effective radius. 
    112113    """ 
     114    num_pearls = int(num_pearls + 0.5) 
    113115    tot_vol = volume(radius, edge_sep, thick_string, num_pearls) 
    114116    rad_out = (tot_vol/(4.0/3.0*pi)) ** (1./3.) 
Note: See TracChangeset for help on using the changeset viewer.