Changeset ef2861b in sasmodels
 Timestamp:
 Oct 31, 2014 4:43:39 PM (6 years ago)
 Branches:
 master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket1257vesicleproduct, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
 Children:
 ba69383
 Parents:
 994d77f
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

sasmodels/models/cylinder.c
r994d77f ref2861b 7 7 // besarg = q * R * sin(alpha) 8 8 // siarg = q * L/2 * cos(alpha) 9 double _cyl(double twovd, doublebesarg, double siarg);10 double _cyl(double twovd, doublebesarg, double siarg)9 double _cyl(double besarg, double siarg); 10 double _cyl(double besarg, double siarg) 11 11 { 12 12 const double bj = (besarg == 0.0 ? 0.5 : J1(besarg)/besarg); 13 13 const double si = (siarg == 0.0 ? 1.0 : sin(siarg)/siarg); 14 return twovd*si*bj;14 return si*bj; 15 15 } 16 16 … … 28 28 const double qr = q*radius; 29 29 const double qh = q*0.5*length; 30 const double twovd = 2.0*(sldsolvent_sld)*form_volume(radius, length);31 30 double total = 0.0; 32 31 // double lower=0, upper=M_PI_2; … … 37 36 double sn, cn; 38 37 SINCOS(alpha, sn, cn); 39 const double fq = _cyl(twovd, qr*sn, qh*cn); 38 // For a bit of efficiency, we are moving the 2 V delta rho constant 39 // factor, 2Vd, out of the loop, so this is fq/2Vd rather than fq. 40 const double fq = _cyl(qr*sn, qh*cn); 40 41 total += Gauss76Wt[i] * fq * fq * sn; 41 42 } 42 43 // translate dx in [1,1] to dx in [lower,upper] 43 44 //const double form = (upperlower)/2.0*total; 44 return 1.0e4 * total * M_PI_4; 45 const double twovd = 2.0*(sldsolvent_sld)*form_volume(radius, length); 46 return 1.0e4 * twovd * twovd * total * M_PI_4; 45 47 } 46 48 … … 62 64 SINCOS(theta*M_PI_180, sn, cn); 63 65 const double q = sqrt(qx*qx+qy*qy); 64 const double cos_val = cn*cos(phi*M_PI_180)*(qx/q) + sn*(qy/q);66 const double cos_val = (q==0. ? 1.0 : (cn*cos(phi*M_PI_180)*qx + sn*qy)/q); 65 67 const double alpha = acos(cos_val); 68 SINCOS(alpha, sn, cn); 69 //sn = sqrt(1.0  cos_val*cos_val); 70 //sn = 1.0  0.5*cos_val*cos_val; // if cos_val is very small 71 //cn = cos_val; 66 72 67 73 const double twovd = 2.0*(sldsolvent_sld)*form_volume(radius, length); 68 SINCOS(alpha, sn, cn); 69 const double fq = _cyl(twovd, q*radius*sn, q*0.5*length*cn); 74 const double fq = twovd * _cyl(q*radius*sn, q*0.5*length*cn); 70 75 return 1.0e4 * fq * fq; 71 76 }
Note: See TracChangeset
for help on using the changeset viewer.