Changeset 3c97ff0 in sasmodels
- Timestamp:
- Jan 6, 2016 9:23:47 PM (9 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:
- 3f832f9
- Parents:
- 74667d3
- Location:
- sasmodels/models
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/barbell.c
rc138211 r3c97ff0 1 1 double form_volume(double bell_radius, double radius, double length); 2 double Iq(double q, double sld, double solvent_sld, double bell_radius, double radius, double length); 2 double Iq(double q, double sld, double solvent_sld, 3 double bell_radius, double radius, double length); 3 4 double Iqxy(double qx, double qy, double sld, double solvent_sld, 4 double bell_radius, double radius, double length, double theta, double phi); 5 double bell_radius, double radius, double length, 6 double theta, double phi); 5 7 6 8 //barbell kernel - same as dumbell 7 9 double _bell_kernel(double q, double h, double bell_radius, 8 double length, double sin_alpha, double cos_alpha);10 double length, double sin_alpha, double cos_alpha); 9 11 double _bell_kernel(double q, double h, double bell_radius, 10 double length, double sin_alpha, double cos_alpha)12 double length, double sin_alpha, double cos_alpha) 11 13 { 12 14 const double upper = 1.0; … … 16 18 for (int i = 0; i < 76; i++){ 17 19 const double t = 0.5*(Gauss76Z[i]*(upper-lower)+upper+lower); 18 const double arg1 = q*cos_alpha*(bell_radius*t+h+length*0.5); 19 const double arg2 = q*bell_radius*sin_alpha*sqrt(1.0-t*t); 20 20 const double arg1 = q*cos_alpha*(bell_radius*t+h+length*0.5); 21 const double arg2 = q*bell_radius*sin_alpha*sqrt(1.0-t*t); 21 22 const double be = (arg2 == 0.0 ? 0.5 :J1(arg2)/arg2); 22 23 const double Fq = cos(arg1)*(1.0-t*t)*be; 24 25 total += Gauss76Wt[i] * Fq; 23 const double Fq = cos(arg1)*(1.0-t*t)*be; 24 total += Gauss76Wt[i] * Fq; 26 25 } 27 26 const double integral = 0.5*(upper-lower)*total; … … 44 43 45 44 double Iq(double q, double sld, 46 double solvent_sld,47 double bell_radius,48 double radius,49 double length)45 double solvent_sld, 46 double bell_radius, 47 double radius, 48 double length) 50 49 { 51 50 double sn, cn; // slots to hold sincos function output … … 84 83 85 84 double Iqxy(double qx, double qy, 86 double sld,87 double solvent_sld,88 double bell_radius,89 double radius,90 double length,91 double theta,92 double phi)85 double sld, 86 double solvent_sld, 87 double bell_radius, 88 double radius, 89 double length, 90 double theta, 91 double phi) 93 92 { 94 93 double sn, cn; // slots to hold sincos function output -
sasmodels/models/cylinder.c
ref2861b r3c97ff0 33 33 // translate a point in [-1,1] to a point in [lower,upper] 34 34 //const double alpha = ( Gauss76Z[i]*(upper-lower) + upper + lower )/2.0; 35 const double alpha = 0.5*(Gauss76Z[i]*M_PI_2 + M_PI_2);35 const double alpha = M_PI_4*(Gauss76Z[i] + 1.0); 36 36 double sn, cn; 37 37 SINCOS(alpha, sn, cn); 38 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/2Vdrather than fq.39 // factor, 2Vdrho, out of the loop, so this is fq/2Vdrho rather than fq. 40 40 const double fq = _cyl(qr*sn, qh*cn); 41 41 total += Gauss76Wt[i] * fq * fq * sn; … … 43 43 // translate dx in [-1,1] to dx in [lower,upper] 44 44 //const double form = (upper-lower)/2.0*total; 45 const double two vd= 2.0*(sld-solvent_sld)*form_volume(radius, length);46 return 1.0e-4 * two vd * twovd* total * M_PI_4;45 const double twoVdrho = 2.0*(sld-solvent_sld)*form_volume(radius, length); 46 return 1.0e-4 * twoVdrho * twoVdrho * total * M_PI_4; 47 47 } 48 48
Note: See TracChangeset
for help on using the changeset viewer.