Changeset 2a0b2b1 in sasmodels for sasmodels/models/barbell.c
- Timestamp:
- Apr 14, 2017 6:30:29 AM (7 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- fdd56a1
- Parents:
- 9901384
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/barbell.c
r592343f r2a0b2b1 10 10 //barbell kernel - same as dumbell 11 11 static double 12 _bell_kernel(double q , double h, double radius_bell,13 double half_length , double sin_alpha, double cos_alpha)12 _bell_kernel(double qab, double qc, double h, double radius_bell, 13 double half_length) 14 14 { 15 15 // translate a point in [-1,1] to a point in [lower,upper] … … 26 26 // m = q R cos(alpha) 27 27 // b = q(L/2-h) cos(alpha) 28 const double m = q*radius_bell*cos_alpha; // cos argument slope29 const double b = q*(half_length-h)*cos_alpha; // cos argument intercept30 const double q rst = q*radius_bell*sin_alpha; // Q*R*sin(theta)28 const double m = radius_bell*qc; // cos argument slope 29 const double b = (half_length-h)*qc; // cos argument intercept 30 const double qab_r = radius_bell*qab; // Q*R*sin(theta) 31 31 double total = 0.0; 32 32 for (int i = 0; i < 76; i++){ 33 33 const double t = Gauss76Z[i]*zm + zb; 34 34 const double radical = 1.0 - t*t; 35 const double bj = sas_2J1x_x(q rst*sqrt(radical));35 const double bj = sas_2J1x_x(qab_r*sqrt(radical)); 36 36 const double Fq = cos(m*t + b) * radical * bj; 37 37 total += Gauss76Wt[i] * Fq; … … 44 44 45 45 static double 46 _fq(double q, double h, 47 double radius_bell, double radius, double half_length, 48 double sin_alpha, double cos_alpha) 46 _fq(double qab, double qc, double h, 47 double radius_bell, double radius, double half_length) 49 48 { 50 const double bell_fq = _bell_kernel(q , h, radius_bell, half_length, sin_alpha, cos_alpha);51 const double bj = sas_2J1x_x( q*radius*sin_alpha);52 const double si = sas_sinx_x( q*half_length*cos_alpha);49 const double bell_fq = _bell_kernel(qab, qc, h, radius_bell, half_length); 50 const double bj = sas_2J1x_x(radius*qab); 51 const double si = sas_sinx_x(half_length*qc); 53 52 const double cyl_fq = 2.0*M_PI*radius*radius*half_length*bj*si; 54 53 const double Aq = bell_fq + cyl_fq; … … 84 83 double sin_alpha, cos_alpha; // slots to hold sincos function output 85 84 SINCOS(alpha, sin_alpha, cos_alpha); 86 const double Aq = _fq(q , h, radius_bell, radius, half_length, sin_alpha, cos_alpha);85 const double Aq = _fq(q*sin_alpha, q*cos_alpha, h, radius_bell, radius, half_length); 87 86 total += Gauss76Wt[i] * Aq * Aq * sin_alpha; 88 87 } … … 103 102 double q, sin_alpha, cos_alpha; 104 103 ORIENT_SYMMETRIC(qx, qy, theta, phi, q, sin_alpha, cos_alpha); 104 const double qab = q*sin_alpha; 105 const double qc = q*cos_alpha; 105 106 106 107 const double h = -sqrt(square(radius_bell) - square(radius)); 107 const double Aq = _fq(q , h, radius_bell, radius, 0.5*length, sin_alpha, cos_alpha);108 const double Aq = _fq(qab, qc, h, radius_bell, radius, 0.5*length); 108 109 109 110 // Multiply by contrast^2 and convert to cm-1
Note: See TracChangeset
for help on using the changeset viewer.