1 | double form_volume(double radius_equat_minor, double radius_equat_major, double radius_polar); |
---|
2 | double Iq(double q, double sld, double sld_solvent, |
---|
3 | double radius_equat_minor, double radius_equat_major, double radius_polar); |
---|
4 | double Iqxy(double qx, double qy, double sld, double sld_solvent, |
---|
5 | double radius_equat_minor, double radius_equat_major, double radius_polar, double theta, double phi, double psi); |
---|
6 | |
---|
7 | //#define INVALID(v) (v.radius_equat_minor > v.radius_equat_major || v.radius_equat_major > v.radius_polar) |
---|
8 | |
---|
9 | |
---|
10 | double form_volume(double radius_equat_minor, double radius_equat_major, double radius_polar) |
---|
11 | { |
---|
12 | return M_4PI_3*radius_equat_minor*radius_equat_major*radius_polar; |
---|
13 | } |
---|
14 | |
---|
15 | double Iq(double q, |
---|
16 | double sld, |
---|
17 | double sld_solvent, |
---|
18 | double radius_equat_minor, |
---|
19 | double radius_equat_major, |
---|
20 | double radius_polar) |
---|
21 | { |
---|
22 | const double pa = square(radius_equat_minor/radius_equat_major) - 1.0; |
---|
23 | const double pc = square(radius_polar/radius_equat_major) - 1.0; |
---|
24 | // translate a point in [-1,1] to a point in [0, pi/2] |
---|
25 | const double zm = M_PI_4; |
---|
26 | const double zb = M_PI_4; |
---|
27 | double outer = 0.0; |
---|
28 | for (int i=0;i<76;i++) { |
---|
29 | //const double u = Gauss76Z[i]*(upper-lower)/2 + (upper + lower)/2; |
---|
30 | const double phi = Gauss76Z[i]*zm + zb; |
---|
31 | const double pa_sinsq_phi = pa*square(sin(phi)); |
---|
32 | |
---|
33 | double inner = 0.0; |
---|
34 | const double um = 0.5; |
---|
35 | const double ub = 0.5; |
---|
36 | for (int j=0;j<76;j++) { |
---|
37 | // translate a point in [-1,1] to a point in [0, 1] |
---|
38 | const double usq = square(Gauss76Z[j]*um + ub); |
---|
39 | const double r = radius_equat_major*sqrt(pa_sinsq_phi*(1.0-usq) + 1.0 + pc*usq); |
---|
40 | const double fq = sas_3j1x_x(q*r); |
---|
41 | inner += Gauss76Wt[j] * fq * fq; |
---|
42 | } |
---|
43 | outer += Gauss76Wt[i] * inner; // correcting for dx later |
---|
44 | } |
---|
45 | // translate integration ranges from [-1,1] to [lower,upper] and normalize by 4 pi |
---|
46 | const double fqsq = outer/4.0; // = outer*um*zm*8.0/(4.0*M_PI); |
---|
47 | const double s = (sld - sld_solvent) * form_volume(radius_equat_minor, radius_equat_major, radius_polar); |
---|
48 | return 1.0e-4 * s * s * fqsq; |
---|
49 | } |
---|
50 | |
---|
51 | double Iqxy(double qx, double qy, |
---|
52 | double sld, |
---|
53 | double sld_solvent, |
---|
54 | double radius_equat_minor, |
---|
55 | double radius_equat_major, |
---|
56 | double radius_polar, |
---|
57 | double theta, |
---|
58 | double phi, |
---|
59 | double psi) |
---|
60 | { |
---|
61 | double q, xhat, yhat, zhat; |
---|
62 | ORIENT_ASYMMETRIC(qx, qy, theta, phi, psi, q, xhat, yhat, zhat); |
---|
63 | |
---|
64 | const double r = sqrt(square(radius_equat_minor*xhat) |
---|
65 | + square(radius_equat_major*yhat) |
---|
66 | + square(radius_polar*zhat)); |
---|
67 | const double fq = sas_3j1x_x(q*r); |
---|
68 | const double s = (sld - sld_solvent) * form_volume(radius_equat_minor, radius_equat_major, radius_polar); |
---|
69 | |
---|
70 | return 1.0e-4 * square(s * fq); |
---|
71 | } |
---|
72 | |
---|