Changes in / [b91bb7c:150fb81] in sasmodels


Ignore:
Location:
sasmodels
Files:
2 added
2 deleted
65 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/generate.py

    r1e7b0db0 r7fcdc9f  
    139139    square(x) = x*x 
    140140    cube(x) = x*x*x 
    141     sas_sinx_x(x) = sin(x)/x, with sin(0)/0 -> 1 
     141    sinc(x) = sin(x)/x, with sin(0)/0 -> 1 
    142142    all double precision constants must include the decimal point 
    143143    all double declarations may be converted to half, float, or long double 
  • sasmodels/kernel_header.c

    r1e7b0db0 rb7e8b94  
    146146inline double square(double x) { return x*x; } 
    147147inline double cube(double x) { return x*x*x; } 
    148 inline double sas_sinx_x(double x) { return x==0 ? 1.0 : sin(x)/x; } 
     148inline double sinc(double x) { return x==0 ? 1.0 : sin(x)/x; } 
    149149 
    150150#if 1 
  • sasmodels/kernel_template.c

    r1e7b0db0 r0d6e865  
    133133inline double square(double x) { return x*x; } 
    134134inline double cube(double x) { return x*x*x; } 
    135 inline double sas_sinx_x(double x) { return x==0 ? 1.0 : sin(x)/x; } 
     135inline double sinc(double x) { return x==0 ? 1.0 : sin(x)/x; } 
    136136 
    137137 
  • sasmodels/models/barbell.c

    r592343f r3a48772  
    3333        const double t = Gauss76Z[i]*zm + zb; 
    3434        const double radical = 1.0 - t*t; 
    35         const double bj = sas_2J1x_x(qrst*sqrt(radical)); 
     35        const double bj = sas_J1c(qrst*sqrt(radical)); 
    3636        const double Fq = cos(m*t + b) * radical * bj; 
    3737        total += Gauss76Wt[i] * Fq; 
     
    4949{ 
    5050    const double bell_fq = _bell_kernel(q, h, radius_bell, half_length, sin_alpha, cos_alpha); 
    51     const double bj = sas_2J1x_x(q*radius*sin_alpha); 
    52     const double si = sas_sinx_x(q*half_length*cos_alpha); 
     51    const double bj = sas_J1c(q*radius*sin_alpha); 
     52    const double si = sinc(q*half_length*cos_alpha); 
    5353    const double cyl_fq = 2.0*M_PI*radius*radius*half_length*bj*si; 
    5454    const double Aq = bell_fq + cyl_fq; 
  • sasmodels/models/bcc_paracrystal.py

    r925ad6e rb0c4271  
    128128# pylint: enable=bad-whitespace, line-too-long 
    129129 
    130 source = ["lib/sas_3j1x_x.c", "lib/gauss150.c", "lib/sphere_form.c", "bcc_paracrystal.c"] 
     130source = ["lib/sph_j1c.c", "lib/gauss150.c", "lib/sphere_form.c", "bcc_paracrystal.c"] 
    131131 
    132132# parameters for demo 
  • sasmodels/models/binary_hard_sphere.c

    r925ad6e r4f79d94  
    5858    qr2 = r2*q; 
    5959 
    60     sc1 = sas_3j1x_x(qr1); 
    61     sc2 = sas_3j1x_x(qr2); 
     60    sc1 = sph_j1c(qr1); 
     61    sc2 = sph_j1c(qr2); 
    6262    b1 = r1*r1*r1*(rho1-rhos)*M_4PI_3*sc1; 
    6363    b2 = r2*r2*r2*(rho2-rhos)*M_4PI_3*sc2; 
  • sasmodels/models/binary_hard_sphere.py

    r925ad6e rb0c4271  
    108108             ] 
    109109 
    110 source = ["lib/sas_3j1x_x.c", "binary_hard_sphere.c"] 
     110source = ["lib/sph_j1c.c", "binary_hard_sphere.c"] 
    111111 
    112112# parameters for demo and documentation 
  • sasmodels/models/capped_cylinder.c

    r592343f r3a48772  
    3939        const double t = Gauss76Z[i]*zm + zb; 
    4040        const double radical = 1.0 - t*t; 
    41         const double bj = sas_2J1x_x(qrst*sqrt(radical)); 
     41        const double bj = sas_J1c(qrst*sqrt(radical)); 
    4242        const double Fq = cos(m*t + b) * radical * bj; 
    4343        total += Gauss76Wt[i] * Fq; 
     
    5454{ 
    5555    const double cap_Fq = _cap_kernel(q, h, radius_cap, half_length, sin_alpha, cos_alpha); 
    56     const double bj = sas_2J1x_x(q*radius*sin_alpha); 
    57     const double si = sas_sinx_x(q*half_length*cos_alpha); 
     56    const double bj = sas_J1c(q*radius*sin_alpha); 
     57    const double si = sinc(q*half_length*cos_alpha); 
    5858    const double cyl_Fq = 2.0*M_PI*radius*radius*half_length*bj*si; 
    5959    const double Aq = cap_Fq + cyl_Fq; 
  • sasmodels/models/core_multi_shell.c

    r925ad6e rc5ac2b2  
    33f_constant(double q, double r, double sld) 
    44{ 
    5   const double bes = sas_3j1x_x(q * r); 
     5  const double bes = sph_j1c(q * r); 
    66  const double vol = M_4PI_3 * cube(r); 
    77  return sld * vol * bes; 
     
    3333  f = 0.; 
    3434  for (int i=0; i<n; i++) { 
    35     f += M_4PI_3 * cube(r) * (sld[i] - last_sld) * sas_3j1x_x(q*r); 
     35    f += M_4PI_3 * cube(r) * (sld[i] - last_sld) * sph_j1c(q*r); 
    3636    last_sld = sld[i]; 
    3737    r += thickness[i]; 
    3838  } 
    39   f += M_4PI_3 * cube(r) * (solvent_sld - last_sld) * sas_3j1x_x(q*r); 
     39  f += M_4PI_3 * cube(r) * (solvent_sld - last_sld) * sph_j1c(q*r); 
    4040  return f * f * 1.0e-4; 
    4141} 
  • sasmodels/models/core_multi_shell.py

    r925ad6e r2d73a53  
    101101             ] 
    102102 
    103 source = ["lib/sas_3j1x_x.c", "core_multi_shell.c"] 
     103source = ["lib/sph_j1c.c", "core_multi_shell.c"] 
    104104 
    105105def profile(sld_core, radius, sld_solvent, n, sld, thickness): 
  • sasmodels/models/core_shell_bicelle.c

    r592343f r5bddd89  
    5555    double sinarg2 = qq*(length+facthick)*cos_alpha; 
    5656 
    57     be1 = sas_2J1x_x(besarg1); 
    58     be2 = sas_2J1x_x(besarg2); 
    59     si1 = sas_sinx_x(sinarg1); 
    60     si2 = sas_sinx_x(sinarg2); 
     57    be1 = sas_J1c(besarg1); 
     58    be2 = sas_J1c(besarg2); 
     59    si1 = sinc(sinarg1); 
     60    si2 = sinc(sinarg2); 
    6161 
    6262    const double t = vol1*dr1*si1*be1 + 
  • sasmodels/models/core_shell_bicelle.py

    r8afefae rfcb33e4  
    141141# pylint: enable=bad-whitespace, line-too-long 
    142142 
    143 source = ["lib/sas_Si.c", "lib/polevl.c", "lib/sas_J1.c", "lib/gauss76.c", 
     143source = ["lib/Si.c", "lib/polevl.c", "lib/sas_J1.c", "lib/gauss76.c", 
    144144          "core_shell_bicelle.c"] 
    145145 
     
    156156            phi=0) 
    157157 
    158 #qx, qy = 0.4 * cos(pi/2.0), 0.5 * sin(0) 
     158qx, qy = 0.4 * cos(90), 0.5 * sin(0) 
  • sasmodels/models/core_shell_bicelle_elliptical.c

    r592343f rfcb33e4  
    7676        double sinarg1 = qq*halfheight*cos_alpha; 
    7777        double sinarg2 = qq*(halfheight+facthick)*cos_alpha; 
    78         si1 = sas_sinx_x(sinarg1); 
    79         si2 = sas_sinx_x(sinarg2); 
     78        si1 = sinc(sinarg1); 
     79        si2 = sinc(sinarg2); 
    8080        for(int j=0;j<76;j++) { 
    8181            //76 gauss points for the inner integral (WAS 20 points,so this may make unecessarily slow, but playing safe) 
     
    8585            double besarg1 = qq*rr*sin_alpha; 
    8686            double besarg2 = qq*(rr+radthick)*sin_alpha; 
    87             be1 = sas_2J1x_x(besarg1); 
    88             be2 = sas_2J1x_x(besarg2); 
     87            be1 = sas_J1c(besarg1); 
     88            be2 = sas_J1c(besarg2); 
    8989            inner_sum += Gauss76Wt[j] *square(dr1*si1*be1 + 
    9090                                              dr2*si2*be2 + 
     
    129129    // ASSUME the sin_alpha is included in the separate integration over orientation of rod angle 
    130130    const double r = rad*sqrt(square(x_core*cos_nu) + cos_mu*cos_mu); 
    131     const double be1 = sas_2J1x_x( qq*r ); 
    132     const double be2 = sas_2J1x_x( qq*(r + radthick ) ); 
    133     const double si1 = sas_sinx_x( qq*halfheight*cos_val ); 
    134     const double si2 = sas_sinx_x( qq*(halfheight + facthick)*cos_val ); 
     131    const double be1 = sas_J1c(qq*r); 
     132    const double be2 = sas_J1c( qq*(r + radthick ) ); 
     133    const double si1 = sinc( qq*halfheight*cos_val ); 
     134    const double si2 = sinc( qq*(halfheight + facthick)*cos_val ); 
    135135    const double Aq = square( vol1*dr1*si1*be1 + vol2*dr2*si2*be2 +  vol3*dr3*si2*be1); 
    136136    //const double vol = form_volume(radius_minor, r_ratio, length); 
  • sasmodels/models/core_shell_bicelle_elliptical.py

    r8afefae rfcb33e4  
    8383 
    8484    Definition of the angles for the oriented core_shell_bicelle_elliptical model. 
    85     Note that *theta* and *phi* are currently defined differently to those for the core_shell_bicelle model. 
    8685 
    8786 
     
    133132# pylint: enable=bad-whitespace, line-too-long 
    134133 
    135 source = ["lib/sas_Si.c", "lib/polevl.c", "lib/sas_J1.c", "lib/gauss76.c", 
    136           "core_shell_bicelle_elliptical.c"] 
     134source = ["lib/Si.c", "lib/polevl.c", "lib/sas_J1.c", "lib/gauss76.c","core_shell_bicelle_elliptical.c"] 
    137135 
    138136demo = dict(scale=1, background=0, 
     
    150148            psi=0) 
    151149 
    152 #qx, qy = 0.4 * cos(pi/2.0), 0.5 * sin(0) 
     150qx, qy = 0.4 * cos(90), 0.5 * sin(0) 
    153151 
    154152tests = [ 
  • sasmodels/models/core_shell_cylinder.c

    r592343f r9aa4881  
    1111double _cyl(double vd, double besarg, double siarg) 
    1212{ 
    13     return vd * sas_sinx_x(siarg) * sas_2J1x_x(besarg); 
     13    return vd * sinc(siarg) * sas_J1c(besarg); 
    1414} 
    1515 
  • sasmodels/models/core_shell_ellipsoid.py

    r8e68ea0 rb7e8b94  
    137137# pylint: enable=bad-whitespace, line-too-long 
    138138 
    139 source = ["lib/sas_3j1x_x.c", "lib/gfn.c", "lib/gauss76.c", 
     139source = ["lib/sph_j1c.c", "lib/gfn.c", "lib/gauss76.c", 
    140140          "core_shell_ellipsoid.c"] 
    141141 
     
    165165qx = q*cos(pi/6.0) 
    166166qy = q*sin(pi/6.0) 
     167phi = 0.0 
    167168# 11Jan2017 RKH sorted tests after redefinition of angles 
    168169tests = [ 
     
    192193      'scale': 1.0, 
    193194     }, 0.01, 8688.53], 
    194  
    195    # 2D tests 
    196    [{'background': 0.001, 
    197      'theta': 90.0, 
    198      'phi': 0.0, 
    199      }, (0.4, 0.5), 0.00690673], 
     195# why does it need theta setting here, not globally above? 
     196   [{'background': 0.001, 'theta':90.0}, (0.4, 0.5), 0.00690673], 
    200197 
    201198   [{'radius_equat_core': 20.0, 
     
    209206      'scale': 0.01, 
    210207      'theta': 90.0, 
    211       'phi': 0.0, 
    212208     }, (qx, qy), 0.01000025], 
    213209    ] 
  • sasmodels/models/core_shell_parallelepiped.c

    r1e7b0db0 r14838a3  
    8787            double sin_uu, cos_uu; 
    8888            SINCOS(M_PI_2*uu, sin_uu, cos_uu); 
    89             const double si1 = sas_sinx_x(mu_proj * sin_uu * a_scaled); 
    90             const double si2 = sas_sinx_x(mu_proj * cos_uu); 
    91             const double si3 = sas_sinx_x(mu_proj * sin_uu * ta); 
    92             const double si4 = sas_sinx_x(mu_proj * cos_uu * tb); 
     89            const double si1 = sinc(mu_proj * sin_uu * a_scaled); 
     90            const double si2 = sinc(mu_proj * cos_uu); 
     91            const double si3 = sinc(mu_proj * sin_uu * ta); 
     92            const double si4 = sinc(mu_proj * cos_uu * tb); 
    9393 
    9494            // Expression in libCylinder.c (neither drC nor Vot are used) 
     
    109109 
    110110        // now sum up the outer integral 
    111         const double si = sas_sinx_x(mu * c_scaled * sigma); 
     111        const double si = sinc(mu * c_scaled * sigma); 
    112112        outer_total += Gauss76Wt[i] * inner_total * si * si; 
    113113    } 
     
    160160    double tc = length_a + 2.0*thick_rim_c; 
    161161    //handle arg=0 separately, as sin(t)/t -> 1 as t->0 
    162     double siA = sas_sinx_x(0.5*q*length_a*cos_val_a); 
    163     double siB = sas_sinx_x(0.5*q*length_b*cos_val_b); 
    164     double siC = sas_sinx_x(0.5*q*length_c*cos_val_c); 
    165     double siAt = sas_sinx_x(0.5*q*ta*cos_val_a); 
    166     double siBt = sas_sinx_x(0.5*q*tb*cos_val_b); 
    167     double siCt = sas_sinx_x(0.5*q*tc*cos_val_c); 
     162    double siA = sinc(0.5*q*length_a*cos_val_a); 
     163    double siB = sinc(0.5*q*length_b*cos_val_b); 
     164    double siC = sinc(0.5*q*length_c*cos_val_c); 
     165    double siAt = sinc(0.5*q*ta*cos_val_a); 
     166    double siBt = sinc(0.5*q*tb*cos_val_b); 
     167    double siCt = sinc(0.5*q*tc*cos_val_c); 
    168168     
    169169 
  • sasmodels/models/core_shell_sphere.py

    r925ad6e r4962519  
    7575# pylint: enable=bad-whitespace, line-too-long 
    7676 
    77 source = ["lib/sas_3j1x_x.c", "lib/core_shell.c", "core_shell_sphere.c"] 
     77source = ["lib/sph_j1c.c", "lib/core_shell.c", "core_shell_sphere.c"] 
    7878 
    7979demo = dict(scale=1, background=0, radius=60, thickness=10, 
  • sasmodels/models/cylinder.c

    r592343f rb829b16  
    1818    const double qr = q*radius; 
    1919    const double qh = q*0.5*length;  
    20     return sas_2J1x_x(qr*sn) * sas_sinx_x(qh*cn); 
     20    return sas_J1c(qr*sn) * sinc(qh*cn); 
    2121} 
    2222 
  • sasmodels/models/ellipsoid.c

    r925ad6e r73e08ae  
    1818    const double r = radius_equatorial 
    1919                     * sqrt(1.0 + sin_alpha*sin_alpha*(ratio*ratio - 1.0)); 
    20     const double f = sas_3j1x_x(q*r); 
     20    const double f = sph_j1c(q*r); 
    2121 
    2222    return f*f; 
  • sasmodels/models/ellipsoid.py

    r925ad6e r0d6e865  
    135135             ] 
    136136 
    137 source = ["lib/sas_3j1x_x.c", "lib/gauss76.c", "ellipsoid.c"] 
     137source = ["lib/sph_j1c.c", "lib/gauss76.c", "ellipsoid.c"] 
    138138 
    139139def ER(radius_polar, radius_equatorial): 
  • sasmodels/models/elliptical_cylinder.c

    r592343f r251f54b  
    3939            const double theta = ( Gauss20Z[j]*(vbj-vaj) + vaj + vbj )/2.0; 
    4040            const double r = sin_val*sqrt(rA - rB*cos(theta)); 
    41             const double be = sas_2J1x_x(q*r); 
     41            const double be = sas_J1c(q*r); 
    4242            inner_sum += Gauss20Wt[j] * be * be; 
    4343        } 
     
    4646 
    4747        //now calculate outer integral 
    48         const double si = sas_sinx_x(q*0.5*length*cos_val); 
     48        const double si = sinc(q*0.5*length*cos_val); 
    4949        outer_sum += Gauss76Wt[i] * inner_sum * si * si; 
    5050    } 
     
    7373    // Given:    radius_major = r_ratio * radius_minor 
    7474    const double r = radius_minor*sqrt(square(r_ratio*cos_nu) + cos_mu*cos_mu); 
    75     const double be = sas_2J1x_x(q*r); 
    76     const double si = sas_sinx_x(q*0.5*length*cos_val); 
     75    const double be = sas_J1c(q*r); 
     76    const double si = sinc(q*0.5*length*cos_val); 
    7777    const double Aq = be * si; 
    7878    const double delrho = sld - solvent_sld; 
  • sasmodels/models/fcc_paracrystal.py

    r925ad6e r0bef47b  
    116116# pylint: enable=bad-whitespace, line-too-long 
    117117 
    118 source = ["lib/sas_3j1x_x.c", "lib/gauss150.c", "lib/sphere_form.c", "fcc_paracrystal.c"] 
     118source = ["lib/sph_j1c.c", "lib/gauss150.c", "lib/sphere_form.c", "fcc_paracrystal.c"] 
    119119 
    120120# parameters for demo 
  • sasmodels/models/flexible_cylinder.c

    r592343f re6408d0  
    1414{ 
    1515    const double contrast = sld - solvent_sld; 
    16     const double cross_section = sas_2J1x_x(q*radius); 
     16    const double cross_section = sas_J1c(q*radius); 
    1717    const double volume = M_PI*radius*radius*length; 
    1818    const double flex = Sk_WR(q, length, kuhn_length); 
  • sasmodels/models/flexible_cylinder_elliptical.c

    r592343f r92ce163  
    2222        SINCOS(zi, sn, cn); 
    2323        const double arg = q*sqrt(a*a*sn*sn + b*b*cn*cn); 
    24         const double yyy = sas_2J1x_x(arg); 
     24        const double yyy = sas_J1c(arg); 
    2525        sum += Gauss76Wt[i] * yyy * yyy; 
    2626    } 
  • sasmodels/models/fractal.c

    r925ad6e r217590b  
    1414    //calculate P(q) for the spherical subunits 
    1515    const double V = M_4PI_3*cube(radius); 
    16     const double pq = V * square((sld_block-sld_solvent)*sas_3j1x_x(q*radius)); 
     16    const double pq = V * square((sld_block-sld_solvent)*sph_j1c(q*radius)); 
    1717 
    1818    // scale to units cm-1 sr-1 (assuming data on absolute scale) 
  • sasmodels/models/fractal.py

    r925ad6e rd1cfa86  
    9797# pylint: enable=bad-whitespace, line-too-long 
    9898 
    99 source = ["lib/sas_3j1x_x.c", "lib/sas_gamma.c", "lib/fractal_sq.c", "fractal.c"] 
     99source = ["lib/sph_j1c.c", "lib/sas_gamma.c", "lib/fractal_sq.c", "fractal.c"] 
    100100 
    101101demo = dict(volfraction=0.05, 
  • sasmodels/models/fractal_core_shell.py

    r925ad6e rd6f60c3  
    9595# pylint: enable=bad-whitespace, line-too-long 
    9696 
    97 source = ["lib/sas_3j1x_x.c", "lib/sas_gamma.c", "lib/core_shell.c", 
     97source = ["lib/sph_j1c.c", "lib/sas_gamma.c", "lib/core_shell.c", 
    9898          "lib/fractal_sq.c", "fractal_core_shell.c"] 
    9999 
  • sasmodels/models/fuzzy_sphere.py

    r925ad6e r3a48772  
    8181# pylint: enable=bad-whitespace,line-too-long 
    8282 
    83 source = ["lib/sas_3j1x_x.c"] 
     83source = ["lib/sph_j1c.c"] 
    8484 
    8585# No volume normalization despite having a volume parameter 
     
    9191Iq = """ 
    9292    const double qr = q*radius; 
    93     const double bes = sas_3j1x_x(qr); 
     93    const double bes = sph_j1c(qr); 
    9494    const double qf = q*fuzziness; 
    9595    const double fq = bes * (sld - sld_solvent) * form_volume(radius) * exp(-0.5*qf*qf); 
  • sasmodels/models/guinier_porod.py

    rcdcebf1 ra807206  
    44and dimensionality of scattering objects, including asymmetric objects 
    55such as rods or platelets, and shapes intermediate between spheres 
    6 and rods or between rods and platelets, and overcomes some of the  
    7 deficiencies of the (Beaucage) Unified_Power_Rg model (see Hammouda, 2010). 
     6and rods or between rods and platelets. 
    87 
    98Definition 
     
    6059--------- 
    6160 
    62 B Hammouda, *A new Guinier-Porod model, J. Appl. Cryst.*, (2010), 43, 716-719 
     61A Guinier, G Fournet, *Small-Angle Scattering of X-Rays*, 
     62John Wiley and Sons, New York, (1955) 
    6363 
    64 B Hammouda, *Analysis of the Beaucage model, J. Appl. Cryst.*, (2010), 43, 1474-1478 
    65  
     64O Glatter, O Kratky, *Small-Angle X-Ray Scattering*, Academic Press (1982) 
     65Check out Chapter 4 on Data Treatment, pages 155-156. 
    6666""" 
    6767 
  • sasmodels/models/hollow_cylinder.c

    r592343f rf8f0991  
    2020{ 
    2121    const double qs = q*sin_val; 
    22     const double lam1 = sas_2J1x_x((radius+thickness)*qs); 
    23     const double lam2 = sas_2J1x_x(radius*qs); 
     22    const double lam1 = sas_J1c((radius+thickness)*qs); 
     23    const double lam2 = sas_J1c(radius*qs); 
    2424    const double gamma_sq = square(radius/(radius+thickness)); 
    25     //Note: lim_{thickness -> 0} psi = sas_J0(radius*qs) 
    26     //Note: lim_{radius -> 0} psi = sas_2J1x_x(thickness*qs) 
     25    //Note: lim_{thickness -> 0} psi = J0(radius*qs) 
     26    //Note: lim_{radius -> 0} psi = sas_J1c(thickness*qs) 
    2727    const double psi = (lam1 - gamma_sq*lam2)/(1.0 - gamma_sq); //SRK 10/19/00 
    28     const double t2 = sas_sinx_x(0.5*q*length*cos_val); 
     28    const double t2 = sinc(0.5*q*length*cos_val); 
    2929    return psi*t2; 
    3030} 
  • sasmodels/models/hollow_rectangular_prism.c

    r1e7b0db0 r6f676fb  
    4545        SINCOS(theta, sin_theta, cos_theta); 
    4646 
    47         const double termC1 = sas_sinx_x(q * c_half * cos(theta)); 
    48         const double termC2 = sas_sinx_x(q * (c_half-thickness)*cos(theta)); 
     47        const double termC1 = sinc(q * c_half * cos(theta)); 
     48        const double termC2 = sinc(q * (c_half-thickness)*cos(theta)); 
    4949 
    5050        double inner_sum = 0.0; 
     
    5757            // Amplitude AP from eqn. (13), rewritten to avoid round-off effects when arg=0 
    5858 
    59             const double termA1 = sas_sinx_x(q * a_half * sin_theta * sin_phi); 
    60             const double termA2 = sas_sinx_x(q * (a_half-thickness) * sin_theta * sin_phi); 
     59            const double termA1 = sinc(q * a_half * sin_theta * sin_phi); 
     60            const double termA2 = sinc(q * (a_half-thickness) * sin_theta * sin_phi); 
    6161 
    62             const double termB1 = sas_sinx_x(q * b_half * sin_theta * cos_phi); 
    63             const double termB2 = sas_sinx_x(q * (b_half-thickness) * sin_theta * cos_phi); 
     62            const double termB1 = sinc(q * b_half * sin_theta * cos_phi); 
     63            const double termB2 = sinc(q * (b_half-thickness) * sin_theta * cos_phi); 
    6464 
    6565            const double AP1 = vol_total * termA1 * termB1 * termC1; 
  • sasmodels/models/lib/core_shell.c

    r925ad6e r3a48772  
    1616    const double core_qr = q * radius; 
    1717    const double core_contrast = core_sld - shell_sld; 
    18     const double core_bes = sas_3j1x_x(core_qr); 
     18    const double core_bes = sph_j1c(core_qr); 
    1919    const double core_volume = M_4PI_3 * cube(radius); 
    2020    double f = core_volume * core_bes * core_contrast; 
     
    2323    const double shell_qr = q * (radius + thickness); 
    2424    const double shell_contrast = shell_sld - solvent_sld; 
    25     const double shell_bes = sas_3j1x_x(shell_qr); 
     25    const double shell_bes = sph_j1c(shell_qr); 
    2626    const double shell_volume = M_4PI_3 * cube(radius + thickness); 
    2727    f += shell_volume * shell_bes * shell_contrast; 
  • sasmodels/models/lib/gfn.c

    r925ad6e r3a48772  
    1818    // changing to more accurate sph_j1c since the following inexplicably fails on Radeon Nano. 
    1919    //const double siq = (uq == 0.0 ? 1.0 : 3.0*(sin(uq)/uq/uq - cos(uq)/uq)/uq); 
    20     const double siq = sas_3j1x_x(uq); 
     20    const double siq = sph_j1c(uq); 
    2121    const double vc = M_4PI_3*aa*aa*bb; 
    2222    const double gfnc = siq*vc*delpc; 
     
    2626    const double vt = M_4PI_3*trmaj*trmaj*trmin; 
    2727    //const double sit = (ut == 0.0 ? 1.0 : 3.0*(sin(ut)/ut/ut - cos(ut)/ut)/ut); 
    28     const double sit = sas_3j1x_x(ut); 
     28    const double sit = sph_j1c(ut); 
    2929    const double gfnt = sit*vt*delps; 
    3030 
  • sasmodels/models/lib/sas_J1.c

    r473a9f1 rc8902ac  
    217217 
    218218//Finally J1c function that equals 2*J1(x)/x 
    219 double sas_2J1x_x(double x); 
    220 double sas_2J1x_x(double x) 
     219double sas_J1c(double x); 
     220double sas_J1c(double x) 
    221221{ 
    222222    return (x != 0.0 ) ? 2.0*sas_J1(x)/x : 1.0; 
  • sasmodels/models/lib/sphere_form.c

    r925ad6e rba32cdd  
    99double sphere_form(double q, double radius, double sld, double solvent_sld) 
    1010{ 
    11     const double fq = sphere_volume(radius) * sas_3j1x_x(q*radius); 
     11    const double fq = sphere_volume(radius) * sph_j1c(q*radius); 
    1212    const double contrast = (sld - solvent_sld); 
    1313    return 1.0e-4*square(contrast * fq); 
  • sasmodels/models/linear_pearls.c

    r925ad6e r4962519  
    4444 
    4545    //sine functions of a pearl 
    46     double psi = sas_3j1x_x(q * radius); 
     46    double psi = sph_j1c(q * radius); 
    4747 
    4848    // N pearls contribution 
     
    5050    n_contrib = num_pearls; 
    5151    for(int num=1; num<=n_max; num++) { 
    52         n_contrib += (2.0*(num_pearls-num)*sas_sinx_x(q*separation*num)); 
     52        n_contrib += (2.0*(num_pearls-num)*sinc(q*separation*num)); 
    5353    } 
    5454    // form factor for num_pearls 
  • sasmodels/models/linear_pearls.py

    r925ad6e r4962519  
    6363single = False 
    6464 
    65 source = ["lib/sas_3j1x_x.c", "linear_pearls.c"] 
     65source = ["lib/sph_j1c.c", "linear_pearls.c"] 
    6666 
    6767demo = dict(scale=1.0, background=0.0, 
  • sasmodels/models/mass_fractal.c

    r925ad6e r6d96b66  
    55{ 
    66    //calculate P(q) 
    7     const double pq = square(sas_3j1x_x(q*radius)); 
     7    const double pq = square(sph_j1c(q*radius)); 
    88 
    99    //calculate S(q) 
  • sasmodels/models/mass_fractal.py

    r925ad6e r6d96b66  
    8686# pylint: enable=bad-whitespace, line-too-long 
    8787 
    88 source = ["lib/sas_3j1x_x.c", "lib/sas_gamma.c", "mass_fractal.c"] 
     88source = ["lib/sph_j1c.c", "lib/sas_gamma.c", "mass_fractal.c"] 
    8989 
    9090demo = dict(scale=1, background=0, 
  • sasmodels/models/multilayer_vesicle.c

    r925ad6e r3a48772  
    2020        // layer 1 
    2121        voli = M_4PI_3*ri*ri*ri; 
    22         fval += voli*sldi*sas_3j1x_x(ri*q); 
     22        fval += voli*sldi*sph_j1c(ri*q); 
    2323 
    2424        ri += thick_shell; 
     
    2626        // layer 2 
    2727        voli = M_4PI_3*ri*ri*ri; 
    28         fval -= voli*sldi*sas_3j1x_x(ri*q); 
     28        fval -= voli*sldi*sph_j1c(ri*q); 
    2929 
    3030        //do 2 layers at a time 
  • sasmodels/models/multilayer_vesicle.py

    r925ad6e r1a6cd57  
    107107# pylint: enable=bad-whitespace, line-too-long 
    108108 
    109 source = ["lib/sas_3j1x_x.c", "multilayer_vesicle.c"] 
     109source = ["lib/sph_j1c.c", "multilayer_vesicle.c"] 
    110110 
    111111polydispersity = ["radius", "n_pairs"] 
  • sasmodels/models/onion.c

    r925ad6e r9762341  
    66  const double vol = M_4PI_3 * cube(r); 
    77  const double qr = q * r; 
    8   const double bes = sas_3j1x_x(qr); 
     8  const double bes = sph_j1c(qr); 
    99  const double alpha = A * r/thickness; 
    1010  double result; 
  • sasmodels/models/onion.py

    r925ad6e r9762341  
    314314# pylint: enable=bad-whitespace, line-too-long 
    315315 
    316 source = ["lib/sas_3j1x_x.c", "onion.c"] 
     316source = ["lib/sph_j1c.c", "onion.c"] 
    317317single = False 
    318318 
  • sasmodels/models/parallelepiped.c

    r1e7b0db0 r14838a3  
    3939            double sin_uu, cos_uu; 
    4040            SINCOS(M_PI_2*uu, sin_uu, cos_uu); 
    41             const double si1 = sas_sinx_x(mu_proj * sin_uu * a_scaled); 
    42             const double si2 = sas_sinx_x(mu_proj * cos_uu); 
     41            const double si1 = sinc(mu_proj * sin_uu * a_scaled); 
     42            const double si2 = sinc(mu_proj * cos_uu); 
    4343            inner_total += Gauss76Wt[j] * square(si1 * si2); 
    4444        } 
    4545        inner_total *= 0.5; 
    4646 
    47         const double si = sas_sinx_x(mu * c_scaled * sigma); 
     47        const double si = sinc(mu * c_scaled * sigma); 
    4848        outer_total += Gauss76Wt[i] * inner_total * si * si; 
    4949    } 
     
    7070    ORIENT_ASYMMETRIC(qx, qy, theta, phi, psi, q, cos_val_c, cos_val_b, cos_val_a); 
    7171 
    72     const double siA = sas_sinx_x(0.5*q*length_a*cos_val_a); 
    73     const double siB = sas_sinx_x(0.5*q*length_b*cos_val_b); 
    74     const double siC = sas_sinx_x(0.5*q*length_c*cos_val_c); 
     72    const double siA = sinc(0.5*q*length_a*cos_val_a); 
     73    const double siB = sinc(0.5*q*length_b*cos_val_b); 
     74    const double siC = sinc(0.5*q*length_c*cos_val_c); 
    7575    const double V = form_volume(length_a, length_b, length_c); 
    7676    const double drho = (sld - solvent_sld); 
  • sasmodels/models/pearl_necklace.c

    r4b541ac r2126131  
    3434    // But there is a 1/(1-sinc) term below which blows up so don't bother 
    3535    const double q_edge = q * edge_sep; 
    36     const double beta = (sas_Si(q*(A_s-radius)) - sas_Si(q*radius)) / q_edge; 
    37     const double gamma = sas_Si(q_edge) / q_edge; 
    38     const double psi = sas_3j1x_x(q*radius); 
     36    const double beta = (Si(q*(A_s-radius)) - Si(q*radius)) / q_edge; 
     37    const double gamma = Si(q_edge) / q_edge; 
     38    const double psi = sph_j1c(q*radius); 
    3939 
    4040    // Precomputed sinc terms 
    41     const double si = sas_sinx_x(q*A_s); 
     41    const double si = sinc(q*A_s); 
    4242    const double omsi = 1.0 - si; 
    4343    const double pow_si = pow(si, num_pearls); 
     
    5454        - 2.0 * (1.0 - pow_si/si)*beta*beta / (omsi*omsi) 
    5555        + 2.0 * num_strings*beta*beta / omsi 
    56         + num_strings * (2.0*gamma - square(sas_sinx_x(q_edge/2.0))) 
     56        + num_strings * (2.0*gamma - square(sinc(q_edge/2.0))) 
    5757        ); 
    5858 
  • sasmodels/models/pearl_necklace.py

    r4b541ac r2126131  
    9292             ] 
    9393 
    94 source = ["lib/sas_Si.c", "lib/sas_3j1x_x.c", "pearl_necklace.c"] 
     94source = ["lib/Si.c", "lib/sph_j1c.c", "pearl_necklace.c"] 
    9595single = False  # use double precision unless told otherwise 
    9696 
  • sasmodels/models/polymer_micelle.c

    r925ad6e rc3ebc71  
    3131 
    3232    // Self-correlation term of the core 
    33     const double bes_core = sas_3j1x_x(q*radius_core); 
     33    const double bes_core = sph_j1c(q*radius_core); 
    3434    const double term1 = square(n_aggreg*beta_core*bes_core); 
    3535 
     
    4141    // Interference cross-term between core and chains 
    4242    const double chain_ampl = (qrg2 == 0.0) ? 1.0 : -expm1(-qrg2)/qrg2; 
    43     const double bes_corona = sas_sinx_x(q*(radius_core + d_penetration * rg)); 
     43    const double bes_corona = sinc(q*(radius_core + d_penetration * rg)); 
    4444    const double term3 = 2.0 * n_aggreg * n_aggreg * beta_core * beta_corona * 
    4545                 bes_core * chain_ampl * bes_corona; 
  • sasmodels/models/polymer_micelle.py

    r925ad6e rbba9361  
    104104single = False 
    105105 
    106 source = ["lib/sas_3j1x_x.c", "polymer_micelle.c"] 
     106source = ["lib/sph_j1c.c", "polymer_micelle.c"] 
    107107 
    108108demo = dict(scale=1, background=0, 
  • sasmodels/models/pringle.c

    r1e7b0db0 r30fbe2e  
    9191        SINCOS(psi, sin_psi, cos_psi); 
    9292        double bessel_term = _sum_bessel_orders(radius, alpha, beta, q*sin_psi, q*cos_psi); 
    93         double sinc_term = square(sas_sinx_x(q * thickness * cos_psi / 2.0)); 
     93        double sinc_term = square(sinc(q * thickness * cos_psi / 2.0)); 
    9494        double pringle_kernel = 4.0 * sin_psi * bessel_term * sinc_term; 
    9595        sum += Gauss76Wt[i] * pringle_kernel; 
  • sasmodels/models/raspberry.c

    r925ad6e r2c74c11  
    5151 
    5252    //Form factors for each particle 
    53     psiL = sas_3j1x_x(q*rL); 
    54     psiS = sas_3j1x_x(q*rS); 
     53    psiL = sph_j1c(q*rL); 
     54    psiS = sph_j1c(q*rS); 
    5555 
    5656    //Cross term between large and small particles 
    57     sfLS = psiL*psiS*sas_sinx_x(q*(rL+deltaS*rS)); 
     57    sfLS = psiL*psiS*sinc(q*(rL+deltaS*rS)); 
    5858    //Cross term between small particles at the surface 
    59     sfSS = psiS*psiS*sas_sinx_x(q*(rL+deltaS*rS))*sas_sinx_x(q*(rL+deltaS*rS)); 
     59    sfSS = psiS*psiS*sinc(q*(rL+deltaS*rS))*sinc(q*(rL+deltaS*rS)); 
    6060 
    6161    //Large sphere form factor term 
  • sasmodels/models/raspberry.py

    r8e68ea0 r40a87fa  
    129129            Ref: J. coll. inter. sci. (2010) vol. 343 (1) pp. 36-41.""" 
    130130category = "shape:sphere" 
    131  
     131#single = False 
    132132 
    133133#             [ "name", "units", default, [lower, upper], "type", "description"], 
     
    152152             ] 
    153153 
    154 source = ["lib/sas_3j1x_x.c", "raspberry.c"] 
     154source = ["lib/sph_j1c.c", "raspberry.c"] 
    155155 
    156156# parameters for demo 
  • sasmodels/models/rectangular_prism.c

    r1e7b0db0 rab2aea8  
    3333        SINCOS(theta, sin_theta, cos_theta); 
    3434 
    35         const double termC = sas_sinx_x(q * c_half * cos_theta); 
     35        const double termC = sinc(q * c_half * cos_theta); 
    3636 
    3737        double inner_sum = 0.0; 
     
    4242 
    4343            // Amplitude AP from eqn. (12), rewritten to avoid round-off effects when arg=0 
    44             const double termA = sas_sinx_x(q * a_half * sin_theta * sin_phi); 
    45             const double termB = sas_sinx_x(q * b_half * sin_theta * cos_phi); 
     44            const double termA = sinc(q * a_half * sin_theta * sin_phi); 
     45            const double termB = sinc(q * b_half * sin_theta * cos_phi); 
    4646            const double AP = termA * termB * termC; 
    4747            inner_sum += Gauss76Wt[j] * AP * AP; 
  • sasmodels/models/sc_paracrystal.py

    r925ad6e r0bef47b  
    133133# pylint: enable=bad-whitespace, line-too-long 
    134134 
    135 source = ["lib/sas_3j1x_x.c", "lib/sphere_form.c", "lib/gauss150.c", "sc_paracrystal.c"] 
     135source = ["lib/sph_j1c.c", "lib/sphere_form.c", "lib/gauss150.c", "sc_paracrystal.c"] 
    136136 
    137137demo = dict(scale=1, background=0, 
  • sasmodels/models/sphere.py

    r925ad6e r7e6bea81  
    6666             ] 
    6767 
    68 source = ["lib/sas_3j1x_x.c", "lib/sphere_form.c"] 
     68source = ["lib/sph_j1c.c", "lib/sphere_form.c"] 
    6969 
    7070# No volume normalization despite having a volume parameter 
  • sasmodels/models/spherical_sld.c

    r925ad6e r54bcd4a  
    3434    const double qr = q * r; 
    3535    const double qrsq = qr * qr; 
    36     const double bes = sas_3j1x_x(qr); 
     36    const double bes = sph_j1c(qr); 
    3737    double sinqr, cosqr; 
    3838    SINCOS(qr, sinqr, cosqr); 
     
    6060 
    6161        // uniform shell; r=0 => r^3=0 => f=0, so works for core as well. 
    62         f -= M_4PI_3 * cube(r) * sld_l * sas_3j1x_x(q*r); 
     62        f -= M_4PI_3 * cube(r) * sld_l * sph_j1c(q*r); 
    6363        r += thickness[shell]; 
    64         f += M_4PI_3 * cube(r) * sld_l * sas_3j1x_x(q*r); 
     64        f += M_4PI_3 * cube(r) * sld_l * sph_j1c(q*r); 
    6565 
    6666        // iterate over sub_shells in the interface 
     
    9292    } 
    9393    // add in solvent effect 
    94     f -= M_4PI_3 * cube(r) * sld_solvent * sas_3j1x_x(q*r); 
     94    f -= M_4PI_3 * cube(r) * sld_solvent * sph_j1c(q*r); 
    9595 
    9696    const double f2 = f * f * 1.0e-4; 
  • sasmodels/models/spherical_sld.py

    r925ad6e r2d65d51  
    214214             ] 
    215215# pylint: enable=bad-whitespace, line-too-long 
    216 source = ["lib/polevl.c", "lib/sas_erf.c", "lib/sas_3j1x_x.c", "spherical_sld.c"] 
     216source = ["lib/polevl.c", "lib/sas_erf.c", "lib/sph_j1c.c", "spherical_sld.c"] 
    217217single = False  # TODO: fix low q behaviour 
    218218 
  • sasmodels/models/stacked_disks.c

    r6c3e266 r98ce141  
    5353    const double sinarg2 = q*(halfheight+thick_layer)*cos_alpha; 
    5454 
    55     const double be1 = sas_2J1x_x(besarg1); 
    56     //const double be2 = sas_2J1x_x(besarg2); 
     55    const double be1 = sas_J1c(besarg1); 
     56    //const double be2 = sas_J1c(besarg2); 
    5757    const double be2 = be1; 
    58     const double si1 = sas_sinx_x(sinarg1); 
    59     const double si2 = sas_sinx_x(sinarg2); 
     58    const double si1 = sinc(sinarg1); 
     59    const double si2 = sinc(sinarg2); 
    6060 
    6161    const double dr1 = core_sld - solvent_sld; 
  • sasmodels/models/surface_fractal.c

    r925ad6e rb716cc6  
    1515{ 
    1616    // calculate P(q) 
    17     const double pq = square(sas_3j1x_x(q*radius)); 
     17    const double pq = square(sph_j1c(q*radius)); 
    1818 
    1919    // calculate S(q) 
  • sasmodels/models/surface_fractal.py

    r925ad6e r5c94f41  
    7272# pylint: enable=bad-whitespace, line-too-long 
    7373 
    74 source = ["lib/sas_3j1x_x.c", "lib/sas_gamma.c", "surface_fractal.c"] 
     74source = ["lib/sph_j1c.c", "lib/sas_gamma.c", "surface_fractal.c"] 
    7575 
    7676demo = dict(scale=1, background=1e-5, 
  • sasmodels/models/triaxial_ellipsoid.c

    r925ad6e r3a48772  
    3737            const double ysq = square(Gauss76Z[j]*zm + zb); 
    3838            const double t = q*sqrt(acosx2 + bsinx2*(1.0-ysq) + c2*ysq); 
    39             const double fq = sas_3j1x_x(t); 
     39            const double fq = sph_j1c(t); 
    4040            inner += Gauss76Wt[j] * fq * fq ; 
    4141        } 
     
    6464                          + radius_equat_major*radius_equat_major*cmu*cmu 
    6565                          + radius_polar*radius_polar*calpha*calpha); 
    66     const double fq = sas_3j1x_x(t); 
     66    const double fq = sph_j1c(t); 
    6767    const double s = (sld - sld_solvent) * form_volume(radius_equat_minor, radius_equat_major, radius_polar); 
    6868 
  • sasmodels/models/triaxial_ellipsoid.py

    r925ad6e r416f5c7  
    104104             ] 
    105105 
    106 source = ["lib/sas_3j1x_x.c", "lib/gauss76.c", "triaxial_ellipsoid.c"] 
     106source = ["lib/sph_j1c.c", "lib/gauss76.c", "triaxial_ellipsoid.c"] 
    107107 
    108108def ER(radius_equat_minor, radius_equat_major, radius_polar): 
  • sasmodels/models/unified_power_Rg.py

    rcdcebf1 rb3f2a24  
    33---------- 
    44 
    5 This model employs the empirical multiple level unified Exponential/Power-law  
    6 fit method developed by Beaucage. Four functions are included so that 1, 2, 3,  
    7 or 4 levels can be used. In addition a 0 level has been added which simply  
    8 calculates 
     5The Beaucage model employs the empirical multiple level unified 
     6Exponential/Power-law fit method developed by G. Beaucage. Four functions 
     7are included so that 1, 2, 3, or 4 levels can be used. In addition a 0 level 
     8has been added which simply calculates 
    99 
    1010.. math:: 
     
    1515many different types of particles, including fractal clusters, random coils 
    1616(Debye equation), ellipsoidal particles, etc. 
    17  
    18 The model works best for mass fractal systems characterized by Porod exponents  
    19 between 5/3 and 3. It should not be used for surface fractal systems. Hammouda  
    20 (2010) has pointed out a deficiency in the way this model handles the  
    21 transitioning between the Guinier and Porod regimes and which can create  
    22 artefacts that appear as kinks in the fitted model function. 
    23  
    24 Also see the Guinier_Porod model. 
    2517 
    2618The empirical fit function is: 
     
    6456 
    6557G Beaucage, *J. Appl. Cryst.*, 29 (1996) 134-146 
    66  
    67 B Hammouda, *Analysis of the Beaucage model, J. Appl. Cryst.*, (2010), 43, 1474-1478 
    6858 
    6959""" 
  • sasmodels/models/vesicle.c

    r925ad6e r3a48772  
    3030    contrast = sld_solvent-sld; 
    3131    vol = M_4PI_3*cube(radius); 
    32     f = vol * sas_3j1x_x(q*radius) * contrast; 
     32    f = vol * sph_j1c(q*radius) * contrast; 
    3333  
    3434    //now the shell. No volume normalization as this is done by the caller 
    3535    contrast = sld-sld_solvent; 
    3636    vol = M_4PI_3*cube(radius+thickness); 
    37     f += vol * sas_3j1x_x(q*(radius+thickness)) * contrast; 
     37    f += vol * sph_j1c(q*(radius+thickness)) * contrast; 
    3838 
    3939    //rescale to [cm-1].  
  • sasmodels/models/vesicle.py

    r925ad6e r3a48772  
    9494             ] 
    9595 
    96 source = ["lib/sas_3j1x_x.c", "vesicle.c"] 
     96source = ["lib/sph_j1c.c", "vesicle.c"] 
    9797 
    9898def ER(radius, thickness): 
Note: See TracChangeset for help on using the changeset viewer.