Changeset 1e7b0db0 in sasmodels
- Timestamp:
- Jan 11, 2017 7:57:04 AM (8 years ago)
- 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
- Location:
- sasmodels
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/generate.py
r7fcdc9f r1e7b0db0 139 139 square(x) = x*x 140 140 cube(x) = x*x*x 141 s inc(x) = sin(x)/x, with sin(0)/0 -> 1141 sas_sinx_x(x) = sin(x)/x, with sin(0)/0 -> 1 142 142 all double precision constants must include the decimal point 143 143 all double declarations may be converted to half, float, or long double -
sasmodels/kernel_header.c
rf1ec7002 r1e7b0db0 146 146 inline double square(double x) { return x*x; } 147 147 inline double cube(double x) { return x*x*x; } 148 inline double s inc(double x) { return x==0 ? 1.0 : sin(x)/x; }148 inline double sas_sinx_x(double x) { return x==0 ? 1.0 : sin(x)/x; } 149 149 150 150 #if 1 -
sasmodels/kernel_template.c
r0d6e865 r1e7b0db0 133 133 inline double square(double x) { return x*x; } 134 134 inline double cube(double x) { return x*x*x; } 135 inline double s inc(double x) { return x==0 ? 1.0 : sin(x)/x; }135 inline double sas_sinx_x(double x) { return x==0 ? 1.0 : sin(x)/x; } 136 136 137 137 -
sasmodels/models/barbell.c
r3a48772 r1e7b0db0 50 50 const double bell_fq = _bell_kernel(q, h, radius_bell, half_length, sin_alpha, cos_alpha); 51 51 const double bj = sas_J1c(q*radius*sin_alpha); 52 const double si = s inc(q*half_length*cos_alpha);52 const double si = sas_sinx_x(q*half_length*cos_alpha); 53 53 const double cyl_fq = 2.0*M_PI*radius*radius*half_length*bj*si; 54 54 const double Aq = bell_fq + cyl_fq; -
sasmodels/models/capped_cylinder.c
r3a48772 r1e7b0db0 55 55 const double cap_Fq = _cap_kernel(q, h, radius_cap, half_length, sin_alpha, cos_alpha); 56 56 const double bj = sas_J1c(q*radius*sin_alpha); 57 const double si = s inc(q*half_length*cos_alpha);57 const double si = sas_sinx_x(q*half_length*cos_alpha); 58 58 const double cyl_Fq = 2.0*M_PI*radius*radius*half_length*bj*si; 59 59 const double Aq = cap_Fq + cyl_Fq; -
sasmodels/models/core_shell_bicelle.c
r5bddd89 r1e7b0db0 57 57 be1 = sas_J1c(besarg1); 58 58 be2 = sas_J1c(besarg2); 59 si1 = s inc(sinarg1);60 si2 = s inc(sinarg2);59 si1 = sas_sinx_x(sinarg1); 60 si2 = sas_sinx_x(sinarg2); 61 61 62 62 const double t = vol1*dr1*si1*be1 + -
sasmodels/models/core_shell_bicelle_elliptical.c
rfcb33e4 r1e7b0db0 76 76 double sinarg1 = qq*halfheight*cos_alpha; 77 77 double sinarg2 = qq*(halfheight+facthick)*cos_alpha; 78 si1 = s inc(sinarg1);79 si2 = s inc(sinarg2);78 si1 = sas_sinx_x(sinarg1); 79 si2 = sas_sinx_x(sinarg2); 80 80 for(int j=0;j<76;j++) { 81 81 //76 gauss points for the inner integral (WAS 20 points,so this may make unecessarily slow, but playing safe) … … 131 131 const double be1 = sas_J1c(qq*r); 132 132 const double be2 = sas_J1c( qq*(r + radthick ) ); 133 const double si1 = s inc( qq*halfheight*cos_val );134 const double si2 = s inc( 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 ); 135 135 const double Aq = square( vol1*dr1*si1*be1 + vol2*dr2*si2*be2 + vol3*dr3*si2*be1); 136 136 //const double vol = form_volume(radius_minor, r_ratio, length); -
sasmodels/models/core_shell_cylinder.c
r9aa4881 r1e7b0db0 11 11 double _cyl(double vd, double besarg, double siarg) 12 12 { 13 return vd * s inc(siarg) * sas_J1c(besarg);13 return vd * sas_sinx_x(siarg) * sas_J1c(besarg); 14 14 } 15 15 -
sasmodels/models/core_shell_parallelepiped.c
r14838a3 r1e7b0db0 87 87 double sin_uu, cos_uu; 88 88 SINCOS(M_PI_2*uu, sin_uu, cos_uu); 89 const double si1 = s inc(mu_proj * sin_uu * a_scaled);90 const double si2 = s inc(mu_proj * cos_uu);91 const double si3 = s inc(mu_proj * sin_uu * ta);92 const double si4 = s inc(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); 93 93 94 94 // Expression in libCylinder.c (neither drC nor Vot are used) … … 109 109 110 110 // now sum up the outer integral 111 const double si = s inc(mu * c_scaled * sigma);111 const double si = sas_sinx_x(mu * c_scaled * sigma); 112 112 outer_total += Gauss76Wt[i] * inner_total * si * si; 113 113 } … … 160 160 double tc = length_a + 2.0*thick_rim_c; 161 161 //handle arg=0 separately, as sin(t)/t -> 1 as t->0 162 double siA = s inc(0.5*q*length_a*cos_val_a);163 double siB = s inc(0.5*q*length_b*cos_val_b);164 double siC = s inc(0.5*q*length_c*cos_val_c);165 double siAt = s inc(0.5*q*ta*cos_val_a);166 double siBt = s inc(0.5*q*tb*cos_val_b);167 double siCt = s inc(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); 168 168 169 169 -
sasmodels/models/cylinder.c
rb829b16 r1e7b0db0 18 18 const double qr = q*radius; 19 19 const double qh = q*0.5*length; 20 return sas_J1c(qr*sn) * s inc(qh*cn);20 return sas_J1c(qr*sn) * sas_sinx_x(qh*cn); 21 21 } 22 22 -
sasmodels/models/elliptical_cylinder.c
r251f54b r1e7b0db0 46 46 47 47 //now calculate outer integral 48 const double si = s inc(q*0.5*length*cos_val);48 const double si = sas_sinx_x(q*0.5*length*cos_val); 49 49 outer_sum += Gauss76Wt[i] * inner_sum * si * si; 50 50 } … … 74 74 const double r = radius_minor*sqrt(square(r_ratio*cos_nu) + cos_mu*cos_mu); 75 75 const double be = sas_J1c(q*r); 76 const double si = s inc(q*0.5*length*cos_val);76 const double si = sas_sinx_x(q*0.5*length*cos_val); 77 77 const double Aq = be * si; 78 78 const double delrho = sld - solvent_sld; -
sasmodels/models/hollow_cylinder.c
rf8f0991 r1e7b0db0 26 26 //Note: lim_{radius -> 0} psi = sas_J1c(thickness*qs) 27 27 const double psi = (lam1 - gamma_sq*lam2)/(1.0 - gamma_sq); //SRK 10/19/00 28 const double t2 = s inc(0.5*q*length*cos_val);28 const double t2 = sas_sinx_x(0.5*q*length*cos_val); 29 29 return psi*t2; 30 30 } -
sasmodels/models/hollow_rectangular_prism.c
r6f676fb r1e7b0db0 45 45 SINCOS(theta, sin_theta, cos_theta); 46 46 47 const double termC1 = s inc(q * c_half * cos(theta));48 const double termC2 = s inc(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)); 49 49 50 50 double inner_sum = 0.0; … … 57 57 // Amplitude AP from eqn. (13), rewritten to avoid round-off effects when arg=0 58 58 59 const double termA1 = s inc(q * a_half * sin_theta * sin_phi);60 const double termA2 = s inc(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); 61 61 62 const double termB1 = s inc(q * b_half * sin_theta * cos_phi);63 const double termB2 = s inc(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); 64 64 65 65 const double AP1 = vol_total * termA1 * termB1 * termC1; -
sasmodels/models/linear_pearls.c
r4962519 r1e7b0db0 50 50 n_contrib = num_pearls; 51 51 for(int num=1; num<=n_max; num++) { 52 n_contrib += (2.0*(num_pearls-num)*s inc(q*separation*num));52 n_contrib += (2.0*(num_pearls-num)*sas_sinx_x(q*separation*num)); 53 53 } 54 54 // form factor for num_pearls -
sasmodels/models/parallelepiped.c
r14838a3 r1e7b0db0 39 39 double sin_uu, cos_uu; 40 40 SINCOS(M_PI_2*uu, sin_uu, cos_uu); 41 const double si1 = s inc(mu_proj * sin_uu * a_scaled);42 const double si2 = s inc(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); 43 43 inner_total += Gauss76Wt[j] * square(si1 * si2); 44 44 } 45 45 inner_total *= 0.5; 46 46 47 const double si = s inc(mu * c_scaled * sigma);47 const double si = sas_sinx_x(mu * c_scaled * sigma); 48 48 outer_total += Gauss76Wt[i] * inner_total * si * si; 49 49 } … … 70 70 ORIENT_ASYMMETRIC(qx, qy, theta, phi, psi, q, cos_val_c, cos_val_b, cos_val_a); 71 71 72 const double siA = s inc(0.5*q*length_a*cos_val_a);73 const double siB = s inc(0.5*q*length_b*cos_val_b);74 const double siC = s inc(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); 75 75 const double V = form_volume(length_a, length_b, length_c); 76 76 const double drho = (sld - solvent_sld); -
sasmodels/models/pearl_necklace.c
r2126131 r1e7b0db0 39 39 40 40 // Precomputed sinc terms 41 const double si = s inc(q*A_s);41 const double si = sas_sinx_x(q*A_s); 42 42 const double omsi = 1.0 - si; 43 43 const double pow_si = pow(si, num_pearls); … … 54 54 - 2.0 * (1.0 - pow_si/si)*beta*beta / (omsi*omsi) 55 55 + 2.0 * num_strings*beta*beta / omsi 56 + num_strings * (2.0*gamma - square(s inc(q_edge/2.0)))56 + num_strings * (2.0*gamma - square(sas_sinx_x(q_edge/2.0))) 57 57 ); 58 58 -
sasmodels/models/polymer_micelle.c
rc3ebc71 r1e7b0db0 41 41 // Interference cross-term between core and chains 42 42 const double chain_ampl = (qrg2 == 0.0) ? 1.0 : -expm1(-qrg2)/qrg2; 43 const double bes_corona = s inc(q*(radius_core + d_penetration * rg));43 const double bes_corona = sas_sinx_x(q*(radius_core + d_penetration * rg)); 44 44 const double term3 = 2.0 * n_aggreg * n_aggreg * beta_core * beta_corona * 45 45 bes_core * chain_ampl * bes_corona; -
sasmodels/models/pringle.c
r30fbe2e r1e7b0db0 91 91 SINCOS(psi, sin_psi, cos_psi); 92 92 double bessel_term = _sum_bessel_orders(radius, alpha, beta, q*sin_psi, q*cos_psi); 93 double sinc_term = square(s inc(q * thickness * cos_psi / 2.0));93 double sinc_term = square(sas_sinx_x(q * thickness * cos_psi / 2.0)); 94 94 double pringle_kernel = 4.0 * sin_psi * bessel_term * sinc_term; 95 95 sum += Gauss76Wt[i] * pringle_kernel; -
sasmodels/models/raspberry.c
r2c74c11 r1e7b0db0 55 55 56 56 //Cross term between large and small particles 57 sfLS = psiL*psiS*s inc(q*(rL+deltaS*rS));57 sfLS = psiL*psiS*sas_sinx_x(q*(rL+deltaS*rS)); 58 58 //Cross term between small particles at the surface 59 sfSS = psiS*psiS*s inc(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)); 60 60 61 61 //Large sphere form factor term -
sasmodels/models/rectangular_prism.c
rab2aea8 r1e7b0db0 33 33 SINCOS(theta, sin_theta, cos_theta); 34 34 35 const double termC = s inc(q * c_half * cos_theta);35 const double termC = sas_sinx_x(q * c_half * cos_theta); 36 36 37 37 double inner_sum = 0.0; … … 42 42 43 43 // Amplitude AP from eqn. (12), rewritten to avoid round-off effects when arg=0 44 const double termA = s inc(q * a_half * sin_theta * sin_phi);45 const double termB = s inc(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); 46 46 const double AP = termA * termB * termC; 47 47 inner_sum += Gauss76Wt[j] * AP * AP; -
sasmodels/models/stacked_disks.c
r98ce141 r1e7b0db0 56 56 //const double be2 = sas_J1c(besarg2); 57 57 const double be2 = be1; 58 const double si1 = s inc(sinarg1);59 const double si2 = s inc(sinarg2);58 const double si1 = sas_sinx_x(sinarg1); 59 const double si2 = sas_sinx_x(sinarg2); 60 60 61 61 const double dr1 = core_sld - solvent_sld;
Note: See TracChangeset
for help on using the changeset viewer.