Changeset f4cf580 in sasmodels for sasmodels/models/capped_cylinder.c
- Timestamp:
- Sep 2, 2014 11:15:40 AM (10 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 87985ca
- Parents:
- 5d4777d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/capped_cylinder.c
r5d4777d rf4cf580 22 22 const real upper = REAL(1.0); 23 23 const real lower = h/cap_radius; // integral lower bound 24 const real m = q*cos_alpha*cap_radius; // cos argument slope 25 const real b = q*cos_alpha*(REAL(0.5)*length-h); // cos argument intercept 26 const real qrst = q*sin_alpha*cap_radius; // Q*R*sin(theta) 24 // cos term in integral is: 25 // cos (q (R t - h + L/2) cos(alpha)) 26 // so turn it into: 27 // cos (m t + b) 28 // where: 29 // m = q R cos(alpha) 30 // b = q(L/2-h) cos(alpha) 31 const real m = q*cap_radius*cos_alpha; // cos argument slope 32 const real b = q*(REAL(0.5)*length-h)*cos_alpha; // cos argument intercept 33 const real qrst = q*cap_radius*sin_alpha; // Q*R*sin(theta) 27 34 real total = REAL(0.0); 28 35 for (int i=0; i<76 ;i++) { … … 31 38 const real t = REAL(0.5)*(Gauss76Z[i]*(upper-lower)+upper+lower); 32 39 const real radical = REAL(1.0) - t*t; 33 const real caparg = qrst*sqrt(radical); // cap bessel function arg34 const real be = ( caparg == REAL(0.0) ? REAL(0.5) : J1(caparg)/caparg);40 const real arg = qrst*sqrt(radical); // cap bessel function arg 41 const real be = (arg == REAL(0.0) ? REAL(0.5) : J1(arg)/arg); 35 42 const real Fq = cos(m*t + b) * radical * be; 36 43 total += Gauss76Wt[i] * Fq; … … 84 91 // faster since we don't multiply and divide sin(alpha). 85 92 const real besarg = q*radius*sn; 86 const real siarg = REAL(0.5)*q*length*cn;93 const real siarg = q*REAL(0.5)*length*cn; 87 94 // lim_{x->0} J1(x)/x = 1/2, lim_{x->0} sin(x)/x = 1 88 95 const real bj = (besarg == REAL(0.0) ? REAL(0.5) : J1(besarg)/besarg); … … 131 138 const real cap_Fq = _cap_kernel(q, h, cap_radius, length, sn, cn); 132 139 133 // The following is CylKernel() / sin(alpha), but we are doing it in place134 // to avoid sin(alpha)/sin(alpha) for alpha = 0. It is also a teensy bit135 // faster since we don't multiply and divide sin(alpha).136 140 const real besarg = q*radius*sn; 137 const real siarg = REAL(0.5)*q*length*cn;141 const real siarg = q*REAL(0.5)*length*cn; 138 142 // lim_{x->0} J1(x)/x = 1/2, lim_{x->0} sin(x)/x = 1 139 143 const real bj = (besarg == REAL(0.0) ? REAL(0.5) : J1(besarg)/besarg);
Note: See TracChangeset
for help on using the changeset viewer.