1 | //#define INVALID(v) (v.radius_core >= v.radius) |
---|
2 | |
---|
3 | // From Igor library |
---|
4 | static double |
---|
5 | _hollow_cylinder_scaling(double integrand, double delrho, double volume) |
---|
6 | { |
---|
7 | return 1.0e-4 * square(volume * delrho) * integrand; |
---|
8 | } |
---|
9 | |
---|
10 | static double |
---|
11 | _fq(double qab, double qc, |
---|
12 | double radius, double thickness, double length) |
---|
13 | { |
---|
14 | const double lam1 = sas_2J1x_x((radius+thickness)*qab); |
---|
15 | const double lam2 = sas_2J1x_x(radius*qab); |
---|
16 | const double gamma_sq = square(radius/(radius+thickness)); |
---|
17 | //Note: lim_{thickness -> 0} psi = sas_J0(radius*qab) |
---|
18 | //Note: lim_{radius -> 0} psi = sas_2J1x_x(thickness*qab) |
---|
19 | const double psi = (lam1 - gamma_sq*lam2)/(1.0 - gamma_sq); //SRK 10/19/00 |
---|
20 | const double t2 = sas_sinx_x(0.5*length*qc); |
---|
21 | return psi*t2; |
---|
22 | } |
---|
23 | |
---|
24 | static double |
---|
25 | form_volume(double radius, double thickness, double length) |
---|
26 | { |
---|
27 | double v_shell = M_PI*length*(square(radius+thickness) - radius*radius); |
---|
28 | return v_shell; |
---|
29 | } |
---|
30 | |
---|
31 | |
---|
32 | static double |
---|
33 | Iq(double q, double radius, double thickness, double length, |
---|
34 | double sld, double solvent_sld) |
---|
35 | { |
---|
36 | const double lower = 0.0; |
---|
37 | const double upper = 1.0; //limits of numerical integral |
---|
38 | |
---|
39 | double summ = 0.0; //initialize intergral |
---|
40 | for (int i=0;i<GAUSS_N;i++) { |
---|
41 | const double cos_theta = 0.5*( GAUSS_Z[i] * (upper-lower) + lower + upper ); |
---|
42 | const double sin_theta = sqrt(1.0 - cos_theta*cos_theta); |
---|
43 | const double form = _fq(q*sin_theta, q*cos_theta, |
---|
44 | radius, thickness, length); |
---|
45 | summ += GAUSS_W[i] * form * form; |
---|
46 | } |
---|
47 | |
---|
48 | const double Aq = 0.5*summ*(upper-lower); |
---|
49 | const double volume = form_volume(radius, thickness, length); |
---|
50 | return _hollow_cylinder_scaling(Aq, solvent_sld - sld, volume); |
---|
51 | } |
---|
52 | |
---|
53 | static double |
---|
54 | Iqac(double qab, double qc, |
---|
55 | double radius, double thickness, double length, |
---|
56 | double sld, double solvent_sld) |
---|
57 | { |
---|
58 | const double form = _fq(qab, qc, radius, thickness, length); |
---|
59 | |
---|
60 | const double vol = form_volume(radius, thickness, length); |
---|
61 | return _hollow_cylinder_scaling(form*form, solvent_sld-sld, vol); |
---|
62 | } |
---|