1 | static double |
---|
2 | form_volume(double radius_polar, double radius_equatorial) |
---|
3 | { |
---|
4 | return M_4PI_3*radius_polar*radius_equatorial*radius_equatorial; |
---|
5 | } |
---|
6 | |
---|
7 | static double |
---|
8 | Iq(double q, |
---|
9 | double sld, |
---|
10 | double sld_solvent, |
---|
11 | double radius_polar, |
---|
12 | double radius_equatorial) |
---|
13 | { |
---|
14 | // Using ratio v = Rp/Re, we can implement the form given in Guinier (1955) |
---|
15 | // i(h) = int_0^pi/2 Phi^2(h a sqrt(cos^2 + v^2 sin^2) cos dT |
---|
16 | // = int_0^pi/2 Phi^2(h a sqrt((1-sin^2) + v^2 sin^2) cos dT |
---|
17 | // = int_0^pi/2 Phi^2(h a sqrt(1 + sin^2(v^2-1)) cos dT |
---|
18 | // u-substitution of |
---|
19 | // u = sin, du = cos dT |
---|
20 | // i(h) = int_0^1 Phi^2(h a sqrt(1 + u^2(v^2-1)) du |
---|
21 | const double v_square_minus_one = square(radius_polar/radius_equatorial) - 1.0; |
---|
22 | |
---|
23 | // translate a point in [-1,1] to a point in [0, 1] |
---|
24 | // const double u = GAUSS_Z[i]*(upper-lower)/2 + (upper+lower)/2; |
---|
25 | const double zm = 0.5; |
---|
26 | const double zb = 0.5; |
---|
27 | double total = 0.0; |
---|
28 | for (int i=0;i<GAUSS_N;i++) { |
---|
29 | const double u = GAUSS_Z[i]*zm + zb; |
---|
30 | const double r = radius_equatorial*sqrt(1.0 + u*u*v_square_minus_one); |
---|
31 | const double f = sas_3j1x_x(q*r); |
---|
32 | total += GAUSS_W[i] * f * f; |
---|
33 | } |
---|
34 | // translate dx in [-1,1] to dx in [lower,upper] |
---|
35 | const double form = total*zm; |
---|
36 | const double s = (sld - sld_solvent) * form_volume(radius_polar, radius_equatorial); |
---|
37 | return 1.0e-4 * s * s * form; |
---|
38 | } |
---|
39 | |
---|
40 | static double |
---|
41 | Iqac(double qab, double qc, |
---|
42 | double sld, |
---|
43 | double sld_solvent, |
---|
44 | double radius_polar, |
---|
45 | double radius_equatorial) |
---|
46 | { |
---|
47 | const double qr = sqrt(square(radius_equatorial*qab) + square(radius_polar*qc)); |
---|
48 | const double f = sas_3j1x_x(qr); |
---|
49 | const double s = (sld - sld_solvent) * form_volume(radius_polar, radius_equatorial); |
---|
50 | |
---|
51 | return 1.0e-4 * square(f * s); |
---|
52 | } |
---|