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