[d86f0fc] | 1 | static double |
---|
| 2 | form_volume(double length_a, double b2a_ratio, double c2a_ratio) |
---|
[deb7ee0] | 3 | { |
---|
[ab2aea8] | 4 | double length_b = length_a * b2a_ratio; |
---|
| 5 | double length_c = length_a * c2a_ratio; |
---|
| 6 | double vol_shell = 2.0 * (length_a*length_b + length_a*length_c + length_b*length_c); |
---|
[deb7ee0] | 7 | return vol_shell; |
---|
| 8 | } |
---|
| 9 | |
---|
[d86f0fc] | 10 | static double |
---|
| 11 | Iq(double q, |
---|
[deb7ee0] | 12 | double sld, |
---|
| 13 | double solvent_sld, |
---|
[a807206] | 14 | double length_a, |
---|
[deb7ee0] | 15 | double b2a_ratio, |
---|
| 16 | double c2a_ratio) |
---|
| 17 | { |
---|
[ab2aea8] | 18 | const double length_b = length_a * b2a_ratio; |
---|
| 19 | const double length_c = length_a * c2a_ratio; |
---|
| 20 | const double a_half = 0.5 * length_a; |
---|
| 21 | const double b_half = 0.5 * length_b; |
---|
| 22 | const double c_half = 0.5 * length_c; |
---|
[deb7ee0] | 23 | |
---|
| 24 | //Integration limits to use in Gaussian quadrature |
---|
[ab2aea8] | 25 | const double v1a = 0.0; |
---|
| 26 | const double v1b = M_PI_2; //theta integration limits |
---|
| 27 | const double v2a = 0.0; |
---|
| 28 | const double v2b = M_PI_2; //phi integration limits |
---|
[74768cb] | 29 | |
---|
[ab2aea8] | 30 | double outer_sum = 0.0; |
---|
[74768cb] | 31 | for(int i=0; i<GAUSS_N; i++) { |
---|
| 32 | const double theta = 0.5 * ( GAUSS_Z[i]*(v1b-v1a) + v1a + v1b ); |
---|
[deb7ee0] | 33 | |
---|
[ab2aea8] | 34 | double sin_theta, cos_theta; |
---|
| 35 | double sin_c, cos_c; |
---|
| 36 | SINCOS(theta, sin_theta, cos_theta); |
---|
| 37 | SINCOS(q*c_half*cos_theta, sin_c, cos_c); |
---|
[deb7ee0] | 38 | |
---|
| 39 | // To check potential problems if denominator goes to zero here !!! |
---|
[ab2aea8] | 40 | const double termAL_theta = 8.0 * cos_c / (q*q*sin_theta*sin_theta); |
---|
| 41 | const double termAT_theta = 8.0 * sin_c / (q*q*sin_theta*cos_theta); |
---|
| 42 | |
---|
| 43 | double inner_sum = 0.0; |
---|
[74768cb] | 44 | for(int j=0; j<GAUSS_N; j++) { |
---|
| 45 | const double phi = 0.5 * ( GAUSS_Z[j]*(v2b-v2a) + v2a + v2b ); |
---|
[deb7ee0] | 46 | |
---|
[ab2aea8] | 47 | double sin_phi, cos_phi; |
---|
| 48 | double sin_a, cos_a; |
---|
| 49 | double sin_b, cos_b; |
---|
| 50 | SINCOS(phi, sin_phi, cos_phi); |
---|
| 51 | SINCOS(q*a_half*sin_theta*sin_phi, sin_a, cos_a); |
---|
| 52 | SINCOS(q*b_half*sin_theta*cos_phi, sin_b, cos_b); |
---|
[deb7ee0] | 53 | |
---|
| 54 | // Amplitude AL from eqn. (7c) |
---|
[ab2aea8] | 55 | const double AL = termAL_theta |
---|
| 56 | * sin_a*sin_b / (sin_phi*cos_phi); |
---|
[deb7ee0] | 57 | |
---|
| 58 | // Amplitude AT from eqn. (9) |
---|
[ab2aea8] | 59 | const double AT = termAT_theta |
---|
| 60 | * ( cos_a*sin_b/cos_phi + cos_b*sin_a/sin_phi ); |
---|
[deb7ee0] | 61 | |
---|
[74768cb] | 62 | inner_sum += GAUSS_W[j] * square(AL+AT); |
---|
[ab2aea8] | 63 | } |
---|
[deb7ee0] | 64 | |
---|
[ab2aea8] | 65 | inner_sum *= 0.5 * (v2b-v2a); |
---|
[74768cb] | 66 | outer_sum += GAUSS_W[i] * inner_sum * sin_theta; |
---|
[deb7ee0] | 67 | } |
---|
| 68 | |
---|
[ab2aea8] | 69 | outer_sum *= 0.5*(v1b-v1a); |
---|
[deb7ee0] | 70 | |
---|
| 71 | // Normalize as in Eqn. (15) without the volume factor (as cancels with (V*DelRho)^2 normalization) |
---|
| 72 | // The factor 2 is due to the different theta integration limit (pi/2 instead of pi) |
---|
[ab2aea8] | 73 | double answer = outer_sum/M_PI_2; |
---|
[deb7ee0] | 74 | |
---|
| 75 | // Multiply by contrast^2. Factor corresponding to volume^2 cancels with previous normalization. |
---|
[ab2aea8] | 76 | answer *= square(sld-solvent_sld); |
---|
[deb7ee0] | 77 | |
---|
| 78 | // Convert from [1e-12 A-1] to [cm-1] |
---|
| 79 | answer *= 1.0e-4; |
---|
| 80 | |
---|
| 81 | return answer; |
---|
| 82 | } |
---|