Changeset 1e7b0db0 in sasmodels


Ignore:
Timestamp:
Jan 11, 2017 7:57:04 AM (8 years ago)
Author:
wojciech
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
925ad6e
Parents:
473a9f1
Message:

sinc tranfered to sas_sinx_x

Location:
sasmodels
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/generate.py

    r7fcdc9f r1e7b0db0  
    139139    square(x) = x*x 
    140140    cube(x) = x*x*x 
    141     sinc(x) = sin(x)/x, with sin(0)/0 -> 1 
     141    sas_sinx_x(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

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

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

    r3a48772 r1e7b0db0  
    5050    const double bell_fq = _bell_kernel(q, h, radius_bell, half_length, sin_alpha, cos_alpha); 
    5151    const double bj = sas_J1c(q*radius*sin_alpha); 
    52     const double si = sinc(q*half_length*cos_alpha); 
     52    const double si = sas_sinx_x(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/capped_cylinder.c

    r3a48772 r1e7b0db0  
    5555    const double cap_Fq = _cap_kernel(q, h, radius_cap, half_length, sin_alpha, cos_alpha); 
    5656    const double bj = sas_J1c(q*radius*sin_alpha); 
    57     const double si = sinc(q*half_length*cos_alpha); 
     57    const double si = sas_sinx_x(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_shell_bicelle.c

    r5bddd89 r1e7b0db0  
    5757    be1 = sas_J1c(besarg1); 
    5858    be2 = sas_J1c(besarg2); 
    59     si1 = sinc(sinarg1); 
    60     si2 = sinc(sinarg2); 
     59    si1 = sas_sinx_x(sinarg1); 
     60    si2 = sas_sinx_x(sinarg2); 
    6161 
    6262    const double t = vol1*dr1*si1*be1 + 
  • sasmodels/models/core_shell_bicelle_elliptical.c

    rfcb33e4 r1e7b0db0  
    7676        double sinarg1 = qq*halfheight*cos_alpha; 
    7777        double sinarg2 = qq*(halfheight+facthick)*cos_alpha; 
    78         si1 = sinc(sinarg1); 
    79         si2 = sinc(sinarg2); 
     78        si1 = sas_sinx_x(sinarg1); 
     79        si2 = sas_sinx_x(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) 
     
    131131    const double be1 = sas_J1c(qq*r); 
    132132    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 ); 
     133    const double si1 = sas_sinx_x( qq*halfheight*cos_val ); 
     134    const double si2 = sas_sinx_x( 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_cylinder.c

    r9aa4881 r1e7b0db0  
    1111double _cyl(double vd, double besarg, double siarg) 
    1212{ 
    13     return vd * sinc(siarg) * sas_J1c(besarg); 
     13    return vd * sas_sinx_x(siarg) * sas_J1c(besarg); 
    1414} 
    1515 
  • sasmodels/models/core_shell_parallelepiped.c

    r14838a3 r1e7b0db0  
    8787            double sin_uu, cos_uu; 
    8888            SINCOS(M_PI_2*uu, sin_uu, cos_uu); 
    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); 
     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); 
    9393 
    9494            // Expression in libCylinder.c (neither drC nor Vot are used) 
     
    109109 
    110110        // now sum up the outer integral 
    111         const double si = sinc(mu * c_scaled * sigma); 
     111        const double si = sas_sinx_x(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 = 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); 
     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); 
    168168     
    169169 
  • sasmodels/models/cylinder.c

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

    r251f54b r1e7b0db0  
    4646 
    4747        //now calculate outer integral 
    48         const double si = sinc(q*0.5*length*cos_val); 
     48        const double si = sas_sinx_x(q*0.5*length*cos_val); 
    4949        outer_sum += Gauss76Wt[i] * inner_sum * si * si; 
    5050    } 
     
    7474    const double r = radius_minor*sqrt(square(r_ratio*cos_nu) + cos_mu*cos_mu); 
    7575    const double be = sas_J1c(q*r); 
    76     const double si = sinc(q*0.5*length*cos_val); 
     76    const double si = sas_sinx_x(q*0.5*length*cos_val); 
    7777    const double Aq = be * si; 
    7878    const double delrho = sld - solvent_sld; 
  • sasmodels/models/hollow_cylinder.c

    rf8f0991 r1e7b0db0  
    2626    //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 = sinc(0.5*q*length*cos_val); 
     28    const double t2 = sas_sinx_x(0.5*q*length*cos_val); 
    2929    return psi*t2; 
    3030} 
  • sasmodels/models/hollow_rectangular_prism.c

    r6f676fb r1e7b0db0  
    4545        SINCOS(theta, sin_theta, cos_theta); 
    4646 
    47         const double termC1 = sinc(q * c_half * cos(theta)); 
    48         const double termC2 = sinc(q * (c_half-thickness)*cos(theta)); 
     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)); 
    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 = sinc(q * a_half * sin_theta * sin_phi); 
    60             const double termA2 = sinc(q * (a_half-thickness) * sin_theta * sin_phi); 
     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); 
    6161 
    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); 
     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); 
    6464 
    6565            const double AP1 = vol_total * termA1 * termB1 * termC1; 
  • sasmodels/models/linear_pearls.c

    r4962519 r1e7b0db0  
    5050    n_contrib = num_pearls; 
    5151    for(int num=1; num<=n_max; num++) { 
    52         n_contrib += (2.0*(num_pearls-num)*sinc(q*separation*num)); 
     52        n_contrib += (2.0*(num_pearls-num)*sas_sinx_x(q*separation*num)); 
    5353    } 
    5454    // form factor for num_pearls 
  • sasmodels/models/parallelepiped.c

    r14838a3 r1e7b0db0  
    3939            double sin_uu, cos_uu; 
    4040            SINCOS(M_PI_2*uu, sin_uu, cos_uu); 
    41             const double si1 = sinc(mu_proj * sin_uu * a_scaled); 
    42             const double si2 = sinc(mu_proj * 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); 
    4343            inner_total += Gauss76Wt[j] * square(si1 * si2); 
    4444        } 
    4545        inner_total *= 0.5; 
    4646 
    47         const double si = sinc(mu * c_scaled * sigma); 
     47        const double si = sas_sinx_x(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 = 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); 
     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); 
    7575    const double V = form_volume(length_a, length_b, length_c); 
    7676    const double drho = (sld - solvent_sld); 
  • sasmodels/models/pearl_necklace.c

    r2126131 r1e7b0db0  
    3939 
    4040    // Precomputed sinc terms 
    41     const double si = sinc(q*A_s); 
     41    const double si = sas_sinx_x(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(sinc(q_edge/2.0))) 
     56        + num_strings * (2.0*gamma - square(sas_sinx_x(q_edge/2.0))) 
    5757        ); 
    5858 
  • sasmodels/models/polymer_micelle.c

    rc3ebc71 r1e7b0db0  
    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 = sinc(q*(radius_core + d_penetration * rg)); 
     43    const double bes_corona = sas_sinx_x(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/pringle.c

    r30fbe2e r1e7b0db0  
    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(sinc(q * thickness * cos_psi / 2.0)); 
     93        double sinc_term = square(sas_sinx_x(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

    r2c74c11 r1e7b0db0  
    5555 
    5656    //Cross term between large and small particles 
    57     sfLS = psiL*psiS*sinc(q*(rL+deltaS*rS)); 
     57    sfLS = psiL*psiS*sas_sinx_x(q*(rL+deltaS*rS)); 
    5858    //Cross term between small particles at the surface 
    59     sfSS = psiS*psiS*sinc(q*(rL+deltaS*rS))*sinc(q*(rL+deltaS*rS)); 
     59    sfSS = psiS*psiS*sas_sinx_x(q*(rL+deltaS*rS))*sas_sinx_x(q*(rL+deltaS*rS)); 
    6060 
    6161    //Large sphere form factor term 
  • sasmodels/models/rectangular_prism.c

    rab2aea8 r1e7b0db0  
    3333        SINCOS(theta, sin_theta, cos_theta); 
    3434 
    35         const double termC = sinc(q * c_half * cos_theta); 
     35        const double termC = sas_sinx_x(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 = sinc(q * a_half * sin_theta * sin_phi); 
    45             const double termB = sinc(q * b_half * sin_theta * cos_phi); 
     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); 
    4646            const double AP = termA * termB * termC; 
    4747            inner_sum += Gauss76Wt[j] * AP * AP; 
  • sasmodels/models/stacked_disks.c

    r98ce141 r1e7b0db0  
    5656    //const double be2 = sas_J1c(besarg2); 
    5757    const double be2 = be1; 
    58     const double si1 = sinc(sinarg1); 
    59     const double si2 = sinc(sinarg2); 
     58    const double si1 = sas_sinx_x(sinarg1); 
     59    const double si2 = sas_sinx_x(sinarg2); 
    6060 
    6161    const double dr1 = core_sld - solvent_sld; 
Note: See TracChangeset for help on using the changeset viewer.