1 | // vd = volume * delta_rho |
---|
2 | // besarg = q * R * sin(theta) |
---|
3 | // siarg = q * L/2 * cos(theta) |
---|
4 | static double _cyl(double vd, double besarg, double siarg) |
---|
5 | { |
---|
6 | return vd * sas_sinx_x(siarg) * sas_2J1x_x(besarg); |
---|
7 | } |
---|
8 | |
---|
9 | static double |
---|
10 | form_volume(double radius, double thickness, double length) |
---|
11 | { |
---|
12 | return M_PI*square(radius+thickness)*(length+2.0*thickness); |
---|
13 | } |
---|
14 | |
---|
15 | static double |
---|
16 | Iq(double q, |
---|
17 | double core_sld, |
---|
18 | double shell_sld, |
---|
19 | double solvent_sld, |
---|
20 | double radius, |
---|
21 | double thickness, |
---|
22 | double length) |
---|
23 | { |
---|
24 | // precalculate constants |
---|
25 | const double core_r = radius; |
---|
26 | const double core_h = 0.5*length; |
---|
27 | const double core_vd = form_volume(radius,0,length) * (core_sld-shell_sld); |
---|
28 | const double shell_r = (radius + thickness); |
---|
29 | const double shell_h = (0.5*length + thickness); |
---|
30 | const double shell_vd = form_volume(radius,thickness,length) * (shell_sld-solvent_sld); |
---|
31 | double total = 0.0; |
---|
32 | for (int i=0; i<76 ;i++) { |
---|
33 | // translate a point in [-1,1] to a point in [0, pi/2] |
---|
34 | //const double theta = ( Gauss76Z[i]*(upper-lower) + upper + lower )/2.0; |
---|
35 | double sin_theta, cos_theta; |
---|
36 | const double theta = Gauss76Z[i]*M_PI_4 + M_PI_4; |
---|
37 | SINCOS(theta, sin_theta, cos_theta); |
---|
38 | const double qab = q*sin_theta; |
---|
39 | const double qc = q*cos_theta; |
---|
40 | const double fq = _cyl(core_vd, core_r*qab, core_h*qc) |
---|
41 | + _cyl(shell_vd, shell_r*qab, shell_h*qc); |
---|
42 | total += Gauss76Wt[i] * fq * fq * sin_theta; |
---|
43 | } |
---|
44 | // translate dx in [-1,1] to dx in [lower,upper] |
---|
45 | //const double form = (upper-lower)/2.0*total; |
---|
46 | return 1.0e-4 * total * M_PI_4; |
---|
47 | } |
---|
48 | |
---|
49 | |
---|
50 | double Iqxy(double qx, double qy, |
---|
51 | double core_sld, |
---|
52 | double shell_sld, |
---|
53 | double solvent_sld, |
---|
54 | double radius, |
---|
55 | double thickness, |
---|
56 | double length, |
---|
57 | double theta, |
---|
58 | double phi) |
---|
59 | { |
---|
60 | double q, sin_alpha, cos_alpha; |
---|
61 | ORIENT_SYMMETRIC(qx, qy, theta, phi, q, sin_alpha, cos_alpha); |
---|
62 | const double qab = q*sin_alpha; |
---|
63 | const double qc = q*cos_alpha; |
---|
64 | |
---|
65 | const double core_r = radius; |
---|
66 | const double core_h = 0.5*length; |
---|
67 | const double core_vd = form_volume(radius,0,length) * (core_sld-shell_sld); |
---|
68 | const double shell_r = (radius + thickness); |
---|
69 | const double shell_h = (0.5*length + thickness); |
---|
70 | const double shell_vd = form_volume(radius,thickness,length) * (shell_sld-solvent_sld); |
---|
71 | |
---|
72 | const double fq = _cyl(core_vd, core_r*qab, core_h*qc) |
---|
73 | + _cyl(shell_vd, shell_r*qab, shell_h*qc); |
---|
74 | return 1.0e-4 * fq * fq; |
---|
75 | } |
---|