[a807206] | 1 | double form_volume(double radius_polar, double radius_equatorial); |
---|
| 2 | double Iq(double q, double sld, double sld_solvent, double radius_polar, double radius_equatorial); |
---|
| 3 | double Iqxy(double qx, double qy, double sld, double sld_solvent, |
---|
| 4 | double radius_polar, double radius_equatorial, double theta, double phi); |
---|
[ce27e21] | 5 | |
---|
[a807206] | 6 | double form_volume(double radius_polar, double radius_equatorial) |
---|
[ce27e21] | 7 | { |
---|
[a807206] | 8 | return M_4PI_3*radius_polar*radius_equatorial*radius_equatorial; |
---|
[ce27e21] | 9 | } |
---|
| 10 | |
---|
[994d77f] | 11 | double Iq(double q, |
---|
| 12 | double sld, |
---|
[a807206] | 13 | double sld_solvent, |
---|
| 14 | double radius_polar, |
---|
| 15 | double radius_equatorial) |
---|
[ce27e21] | 16 | { |
---|
[3b571ae] | 17 | // Using ratio v = Rp/Re, we can implement the form given in Guinier (1955) |
---|
| 18 | // i(h) = int_0^pi/2 Phi^2(h a sqrt(cos^2 + v^2 sin^2) cos dT |
---|
| 19 | // = int_0^pi/2 Phi^2(h a sqrt((1-sin^2) + v^2 sin^2) cos dT |
---|
| 20 | // = int_0^pi/2 Phi^2(h a sqrt(1 + sin^2(v^2-1)) cos dT |
---|
| 21 | // u-substitution of |
---|
| 22 | // u = sin, du = cos dT |
---|
| 23 | // i(h) = int_0^1 Phi^2(h a sqrt(1 + u^2(v^2-1)) du |
---|
| 24 | const double v_square_minus_one = square(radius_polar/radius_equatorial) - 1.0; |
---|
| 25 | |
---|
[50e1e40] | 26 | // translate a point in [-1,1] to a point in [0, 1] |
---|
[3b571ae] | 27 | // const double u = Gauss76Z[i]*(upper-lower)/2 + (upper+lower)/2; |
---|
[50e1e40] | 28 | const double zm = 0.5; |
---|
| 29 | const double zb = 0.5; |
---|
[994d77f] | 30 | double total = 0.0; |
---|
[ce27e21] | 31 | for (int i=0;i<76;i++) { |
---|
[3b571ae] | 32 | const double u = Gauss76Z[i]*zm + zb; |
---|
| 33 | const double r = radius_equatorial*sqrt(1.0 + u*u*v_square_minus_one); |
---|
| 34 | const double f = sas_3j1x_x(q*r); |
---|
| 35 | total += Gauss76Wt[i] * f * f; |
---|
[ce27e21] | 36 | } |
---|
[50e1e40] | 37 | // translate dx in [-1,1] to dx in [lower,upper] |
---|
| 38 | const double form = total*zm; |
---|
[a807206] | 39 | const double s = (sld - sld_solvent) * form_volume(radius_polar, radius_equatorial); |
---|
[50e1e40] | 40 | return 1.0e-4 * s * s * form; |
---|
[ce27e21] | 41 | } |
---|
| 42 | |
---|
[994d77f] | 43 | double Iqxy(double qx, double qy, |
---|
| 44 | double sld, |
---|
[a807206] | 45 | double sld_solvent, |
---|
| 46 | double radius_polar, |
---|
| 47 | double radius_equatorial, |
---|
[994d77f] | 48 | double theta, |
---|
| 49 | double phi) |
---|
[ce27e21] | 50 | { |
---|
[5bddd89] | 51 | double q, sin_alpha, cos_alpha; |
---|
| 52 | ORIENT_SYMMETRIC(qx, qy, theta, phi, q, sin_alpha, cos_alpha); |
---|
[3b571ae] | 53 | const double r = sqrt(square(radius_equatorial*sin_alpha) |
---|
| 54 | + square(radius_polar*cos_alpha)); |
---|
| 55 | const double f = sas_3j1x_x(q*r); |
---|
[a807206] | 56 | const double s = (sld - sld_solvent) * form_volume(radius_polar, radius_equatorial); |
---|
[ce27e21] | 57 | |
---|
[3b571ae] | 58 | return 1.0e-4 * square(f * s); |
---|
[ce27e21] | 59 | } |
---|
| 60 | |
---|