Changeset 2222134 in sasmodels for sasmodels/models/barbell.c
- Timestamp:
- Sep 30, 2016 11:07:16 AM (8 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:
- a807206
- Parents:
- 6e5b2a7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/barbell.c
r2f5c6d4 r2222134 1 double form_volume(double bell_radius, double radius, double length);1 double form_volume(double radius_bell, double radius, double length); 2 2 double Iq(double q, double sld, double solvent_sld, 3 double bell_radius, double radius, double length);3 double radius_bell, double radius, double length); 4 4 double Iqxy(double qx, double qy, double sld, double solvent_sld, 5 double bell_radius, double radius, double length,5 double radius_bell, double radius, double length, 6 6 double theta, double phi); 7 7 8 #define INVALID(v) (v. bell_radius< v.radius)8 #define INVALID(v) (v.radius_bell < v.radius) 9 9 10 10 //barbell kernel - same as dumbell 11 11 static double 12 _bell_kernel(double q, double h, double bell_radius,12 _bell_kernel(double q, double h, double radius_bell, 13 13 double half_length, double sin_alpha, double cos_alpha) 14 14 { 15 15 // translate a point in [-1,1] to a point in [lower,upper] 16 16 const double upper = 1.0; 17 const double lower = h/ bell_radius;17 const double lower = h/radius_bell; 18 18 const double zm = 0.5*(upper-lower); 19 19 const double zb = 0.5*(upper+lower); … … 26 26 // m = q R cos(alpha) 27 27 // b = q(L/2-h) cos(alpha) 28 const double m = q* bell_radius*cos_alpha; // cos argument slope28 const double m = q*radius_bell*cos_alpha; // cos argument slope 29 29 const double b = q*(half_length-h)*cos_alpha; // cos argument intercept 30 const double qrst = q* bell_radius*sin_alpha; // Q*R*sin(theta)30 const double qrst = q*radius_bell*sin_alpha; // Q*R*sin(theta) 31 31 double total = 0.0; 32 32 for (int i = 0; i < 76; i++){ … … 39 39 // translate dx in [-1,1] to dx in [lower,upper] 40 40 const double integral = total*zm; 41 const double bell_Fq = 2*M_PI*cube( bell_radius)*integral;41 const double bell_Fq = 2*M_PI*cube(radius_bell)*integral; 42 42 return bell_Fq; 43 43 } 44 44 45 double form_volume(double bell_radius,45 double form_volume(double radius_bell, 46 46 double radius, 47 47 double length) … … 49 49 50 50 // bell radius should never be less than radius when this is called 51 const double hdist = sqrt(square( bell_radius) - square(radius));52 const double p1 = 2.0/3.0*cube( bell_radius);53 const double p2 = square( bell_radius)*hdist;51 const double hdist = sqrt(square(radius_bell) - square(radius)); 52 const double p1 = 2.0/3.0*cube(radius_bell); 53 const double p2 = square(radius_bell)*hdist; 54 54 const double p3 = cube(hdist)/3.0; 55 55 … … 58 58 59 59 double Iq(double q, double sld, double solvent_sld, 60 double bell_radius, double radius, double length)60 double radius_bell, double radius, double length) 61 61 { 62 const double h = -sqrt( bell_radius*bell_radius- radius*radius);62 const double h = -sqrt(radius_bell*radius_bell - radius*radius); 63 63 const double half_length = 0.5*length; 64 64 … … 72 72 SINCOS(alpha, sin_alpha, cos_alpha); 73 73 74 const double bell_Fq = _bell_kernel(q, h, bell_radius, half_length, sin_alpha, cos_alpha);74 const double bell_Fq = _bell_kernel(q, h, radius_bell, half_length, sin_alpha, cos_alpha); 75 75 const double bj = sas_J1c(q*radius*sin_alpha); 76 76 const double si = sinc(q*half_length*cos_alpha); … … 90 90 double Iqxy(double qx, double qy, 91 91 double sld, double solvent_sld, 92 double bell_radius, double radius, double length,92 double radius_bell, double radius, double length, 93 93 double theta, double phi) 94 94 { … … 100 100 const double alpha = acos(cos_val); // rod angle relative to q 101 101 102 const double h = -sqrt(square( bell_radius) - square(radius));102 const double h = -sqrt(square(radius_bell) - square(radius)); 103 103 const double half_length = 0.5*length; 104 104 105 105 double sin_alpha, cos_alpha; // slots to hold sincos function output 106 106 SINCOS(alpha, sin_alpha, cos_alpha); 107 const double bell_Fq = _bell_kernel(q, h, bell_radius, half_length, sin_alpha, cos_alpha);107 const double bell_Fq = _bell_kernel(q, h, radius_bell, half_length, sin_alpha, cos_alpha); 108 108 const double bj = sas_J1c(q*radius*sin_alpha); 109 109 const double si = sinc(q*half_length*cos_alpha);
Note: See TracChangeset
for help on using the changeset viewer.