[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 _ellipsoid_kernel(double q, double radius_polar, double radius_equatorial, double sin_alpha); |
---|
| 7 | double _ellipsoid_kernel(double q, double radius_polar, double radius_equatorial, double sin_alpha) |
---|
[ce27e21] | 8 | { |
---|
[a807206] | 9 | double ratio = radius_polar/radius_equatorial; |
---|
[73e08ae] | 10 | // Given the following under the radical: |
---|
| 11 | // 1 + sin^2(T) (v^2 - 1) |
---|
| 12 | // we can expand to match the form given in Guinier (1955) |
---|
| 13 | // = (1 - sin^2(T)) + v^2 sin^2(T) = cos^2(T) + sin^2(T) |
---|
| 14 | // Instead of using pythagoras we could pass in sin and cos; this may be |
---|
| 15 | // slightly better for 2D which has already computed it, but it introduces |
---|
| 16 | // an extra sqrt and square for 1-D not required by the current form, so |
---|
| 17 | // leave it as is. |
---|
| 18 | const double r = radius_equatorial |
---|
| 19 | * sqrt(1.0 + sin_alpha*sin_alpha*(ratio*ratio - 1.0)); |
---|
| 20 | const double f = sph_j1c(q*r); |
---|
[513efc5] | 21 | |
---|
[5d4777d] | 22 | return f*f; |
---|
[ce27e21] | 23 | } |
---|
| 24 | |
---|
[a807206] | 25 | double form_volume(double radius_polar, double radius_equatorial) |
---|
[ce27e21] | 26 | { |
---|
[a807206] | 27 | return M_4PI_3*radius_polar*radius_equatorial*radius_equatorial; |
---|
[ce27e21] | 28 | } |
---|
| 29 | |
---|
[994d77f] | 30 | double Iq(double q, |
---|
| 31 | double sld, |
---|
[a807206] | 32 | double sld_solvent, |
---|
| 33 | double radius_polar, |
---|
| 34 | double radius_equatorial) |
---|
[ce27e21] | 35 | { |
---|
[50e1e40] | 36 | // translate a point in [-1,1] to a point in [0, 1] |
---|
| 37 | const double zm = 0.5; |
---|
| 38 | const double zb = 0.5; |
---|
[994d77f] | 39 | double total = 0.0; |
---|
[ce27e21] | 40 | for (int i=0;i<76;i++) { |
---|
[3f832f9] | 41 | //const double sin_alpha = (Gauss76Z[i]*(upper-lower) + upper + lower)/2; |
---|
[50e1e40] | 42 | const double sin_alpha = Gauss76Z[i]*zm + zb; |
---|
[a807206] | 43 | total += Gauss76Wt[i] * _ellipsoid_kernel(q, radius_polar, radius_equatorial, sin_alpha); |
---|
[ce27e21] | 44 | } |
---|
[50e1e40] | 45 | // translate dx in [-1,1] to dx in [lower,upper] |
---|
| 46 | const double form = total*zm; |
---|
[a807206] | 47 | const double s = (sld - sld_solvent) * form_volume(radius_polar, radius_equatorial); |
---|
[50e1e40] | 48 | return 1.0e-4 * s * s * form; |
---|
[ce27e21] | 49 | } |
---|
| 50 | |
---|
[994d77f] | 51 | double Iqxy(double qx, double qy, |
---|
| 52 | double sld, |
---|
[a807206] | 53 | double sld_solvent, |
---|
| 54 | double radius_polar, |
---|
| 55 | double radius_equatorial, |
---|
[994d77f] | 56 | double theta, |
---|
| 57 | double phi) |
---|
[ce27e21] | 58 | { |
---|
[5bddd89] | 59 | double q, sin_alpha, cos_alpha; |
---|
| 60 | ORIENT_SYMMETRIC(qx, qy, theta, phi, q, sin_alpha, cos_alpha); |
---|
| 61 | const double form = _ellipsoid_kernel(q, radius_polar, radius_equatorial, sin_alpha); |
---|
[a807206] | 62 | const double s = (sld - sld_solvent) * form_volume(radius_polar, radius_equatorial); |
---|
[ce27e21] | 63 | |
---|
[994d77f] | 64 | return 1.0e-4 * form * s * s; |
---|
[ce27e21] | 65 | } |
---|
| 66 | |
---|