[a807206] | 1 | double form_volume(double length_a, double b2a_ratio, double c2a_ratio, double thickness); |
---|
[8de1477] | 2 | double Iq(double q, double sld, double solvent_sld, double length_a, |
---|
[deb7ee0] | 3 | double b2a_ratio, double c2a_ratio, double thickness); |
---|
| 4 | |
---|
[a807206] | 5 | double form_volume(double length_a, double b2a_ratio, double c2a_ratio, double thickness) |
---|
[deb7ee0] | 6 | { |
---|
[ab2aea8] | 7 | double length_b = length_a * b2a_ratio; |
---|
| 8 | double length_c = length_a * c2a_ratio; |
---|
[a807206] | 9 | double a_core = length_a - 2.0*thickness; |
---|
[ab2aea8] | 10 | double b_core = length_b - 2.0*thickness; |
---|
| 11 | double c_core = length_c - 2.0*thickness; |
---|
[deb7ee0] | 12 | double vol_core = a_core * b_core * c_core; |
---|
[ab2aea8] | 13 | double vol_total = length_a * length_b * length_c; |
---|
[deb7ee0] | 14 | double vol_shell = vol_total - vol_core; |
---|
| 15 | return vol_shell; |
---|
| 16 | } |
---|
| 17 | |
---|
| 18 | double Iq(double q, |
---|
| 19 | double sld, |
---|
| 20 | double solvent_sld, |
---|
[a807206] | 21 | double length_a, |
---|
[deb7ee0] | 22 | double b2a_ratio, |
---|
| 23 | double c2a_ratio, |
---|
| 24 | double thickness) |
---|
| 25 | { |
---|
[6f676fb] | 26 | const double length_b = length_a * b2a_ratio; |
---|
| 27 | const double length_c = length_a * c2a_ratio; |
---|
| 28 | const double a_half = 0.5 * length_a; |
---|
| 29 | const double b_half = 0.5 * length_b; |
---|
| 30 | const double c_half = 0.5 * length_c; |
---|
| 31 | const double vol_total = length_a * length_b * length_c; |
---|
| 32 | const double vol_core = 8.0 * (a_half-thickness) * (b_half-thickness) * (c_half-thickness); |
---|
[deb7ee0] | 33 | |
---|
[ab2aea8] | 34 | //Integration limits to use in Gaussian quadrature |
---|
[6f676fb] | 35 | const double v1a = 0.0; |
---|
| 36 | const double v1b = M_PI_2; //theta integration limits |
---|
| 37 | const double v2a = 0.0; |
---|
| 38 | const double v2b = M_PI_2; //phi integration limits |
---|
[8de1477] | 39 | |
---|
[ab2aea8] | 40 | double outer_sum = 0.0; |
---|
| 41 | for(int i=0; i<76; i++) { |
---|
[deb7ee0] | 42 | |
---|
[6f676fb] | 43 | const double theta = 0.5 * ( Gauss76Z[i]*(v1b-v1a) + v1a + v1b ); |
---|
| 44 | double sin_theta, cos_theta; |
---|
| 45 | SINCOS(theta, sin_theta, cos_theta); |
---|
[deb7ee0] | 46 | |
---|
[1e7b0db0] | 47 | const double termC1 = sas_sinx_x(q * c_half * cos(theta)); |
---|
| 48 | const double termC2 = sas_sinx_x(q * (c_half-thickness)*cos(theta)); |
---|
[deb7ee0] | 49 | |
---|
[ab2aea8] | 50 | double inner_sum = 0.0; |
---|
| 51 | for(int j=0; j<76; j++) { |
---|
[deb7ee0] | 52 | |
---|
[6f676fb] | 53 | const double phi = 0.5 * ( Gauss76Z[j]*(v2b-v2a) + v2a + v2b ); |
---|
| 54 | double sin_phi, cos_phi; |
---|
| 55 | SINCOS(phi, sin_phi, cos_phi); |
---|
[deb7ee0] | 56 | |
---|
| 57 | // Amplitude AP from eqn. (13), rewritten to avoid round-off effects when arg=0 |
---|
| 58 | |
---|
[1e7b0db0] | 59 | const double termA1 = sas_sinx_x(q * a_half * sin_theta * sin_phi); |
---|
| 60 | const double termA2 = sas_sinx_x(q * (a_half-thickness) * sin_theta * sin_phi); |
---|
[deb7ee0] | 61 | |
---|
[1e7b0db0] | 62 | const double termB1 = sas_sinx_x(q * b_half * sin_theta * cos_phi); |
---|
| 63 | const double termB2 = sas_sinx_x(q * (b_half-thickness) * sin_theta * cos_phi); |
---|
[deb7ee0] | 64 | |
---|
[6f676fb] | 65 | const double AP1 = vol_total * termA1 * termB1 * termC1; |
---|
| 66 | const double AP2 = vol_core * termA2 * termB2 * termC2; |
---|
[deb7ee0] | 67 | |
---|
[ab2aea8] | 68 | inner_sum += Gauss76Wt[j] * square(AP1-AP2); |
---|
| 69 | } |
---|
[6f676fb] | 70 | inner_sum *= 0.5 * (v2b-v2a); |
---|
[deb7ee0] | 71 | |
---|
[ab2aea8] | 72 | outer_sum += Gauss76Wt[i] * inner_sum * sin(theta); |
---|
[deb7ee0] | 73 | } |
---|
[6f676fb] | 74 | outer_sum *= 0.5*(v1b-v1a); |
---|
[deb7ee0] | 75 | |
---|
| 76 | // Normalize as in Eqn. (15) without the volume factor (as cancels with (V*DelRho)^2 normalization) |
---|
| 77 | // The factor 2 is due to the different theta integration limit (pi/2 instead of pi) |
---|
[6f676fb] | 78 | const double form = outer_sum/M_PI_2; |
---|
[deb7ee0] | 79 | |
---|
| 80 | // Multiply by contrast^2. Factor corresponding to volume^2 cancels with previous normalization. |
---|
[6f676fb] | 81 | const double delrho = sld - solvent_sld; |
---|
[deb7ee0] | 82 | |
---|
| 83 | // Convert from [1e-12 A-1] to [cm-1] |
---|
[6f676fb] | 84 | return 1.0e-4 * delrho * delrho * form; |
---|
[deb7ee0] | 85 | } |
---|
[8de1477] | 86 | |
---|
| 87 | double Iqxy(double qa, double qb, double qc, |
---|
| 88 | double sld, |
---|
| 89 | double solvent_sld, |
---|
| 90 | double length_a, |
---|
| 91 | double b2a_ratio, |
---|
| 92 | double c2a_ratio, |
---|
| 93 | double thickness) |
---|
| 94 | { |
---|
| 95 | const double length_b = length_a * b2a_ratio; |
---|
| 96 | const double length_c = length_a * c2a_ratio; |
---|
| 97 | const double a_half = 0.5 * length_a; |
---|
| 98 | const double b_half = 0.5 * length_b; |
---|
| 99 | const double c_half = 0.5 * length_c; |
---|
| 100 | const double vol_total = length_a * length_b * length_c; |
---|
| 101 | const double vol_core = 8.0 * (a_half-thickness) * (b_half-thickness) * (c_half-thickness); |
---|
| 102 | |
---|
| 103 | // Amplitude AP from eqn. (13) |
---|
| 104 | |
---|
| 105 | const double termA1 = sas_sinx_x(qa * a_half); |
---|
| 106 | const double termA2 = sas_sinx_x(qa * (a_half-thickness)); |
---|
| 107 | |
---|
| 108 | const double termB1 = sas_sinx_x(qb * b_half); |
---|
| 109 | const double termB2 = sas_sinx_x(qb * (b_half-thickness)); |
---|
| 110 | |
---|
| 111 | const double termC1 = sas_sinx_x(qc * c_half); |
---|
| 112 | const double termC2 = sas_sinx_x(qc * (c_half-thickness)); |
---|
| 113 | |
---|
| 114 | const double AP1 = vol_total * termA1 * termB1 * termC1; |
---|
| 115 | const double AP2 = vol_core * termA2 * termB2 * termC2; |
---|
| 116 | |
---|
| 117 | // Multiply by contrast^2. Factor corresponding to volume^2 cancels with previous normalization. |
---|
| 118 | const double delrho = sld - solvent_sld; |
---|
| 119 | |
---|
| 120 | // Convert from [1e-12 A-1] to [cm-1] |
---|
| 121 | return 1.0e-4 * square(delrho * (AP1-AP2)); |
---|
| 122 | } |
---|