[becded3] | 1 | static double |
---|
| 2 | form_volume(double length_a, double length_b, double length_c) |
---|
[c5b7d07] | 3 | { |
---|
[a807206] | 4 | return length_a * length_b * length_c; |
---|
[c5b7d07] | 5 | } |
---|
| 6 | |
---|
[deb7ee0] | 7 | |
---|
[becded3] | 8 | static double |
---|
| 9 | Iq(double q, |
---|
[c5b7d07] | 10 | double sld, |
---|
| 11 | double solvent_sld, |
---|
[a807206] | 12 | double length_a, |
---|
| 13 | double length_b, |
---|
| 14 | double length_c) |
---|
[c5b7d07] | 15 | { |
---|
[14838a3] | 16 | const double mu = 0.5 * q * length_b; |
---|
[2a0b2b1] | 17 | |
---|
[c5b7d07] | 18 | // Scale sides by B |
---|
[14838a3] | 19 | const double a_scaled = length_a / length_b; |
---|
| 20 | const double c_scaled = length_c / length_b; |
---|
[2a0b2b1] | 21 | |
---|
[14838a3] | 22 | // outer integral (with gauss points), integration limits = 0, 1 |
---|
| 23 | double outer_total = 0; //initialize integral |
---|
| 24 | |
---|
| 25 | for( int i=0; i<76; i++) { |
---|
| 26 | const double sigma = 0.5 * ( Gauss76Z[i] + 1.0 ); |
---|
| 27 | const double mu_proj = mu * sqrt(1.0-sigma*sigma); |
---|
| 28 | |
---|
| 29 | // inner integral (with gauss points), integration limits = 0, 1 |
---|
| 30 | // corresponding to angles from 0 to pi/2. |
---|
| 31 | double inner_total = 0.0; |
---|
| 32 | for(int j=0; j<76; j++) { |
---|
| 33 | const double uu = 0.5 * ( Gauss76Z[j] + 1.0 ); |
---|
| 34 | double sin_uu, cos_uu; |
---|
| 35 | SINCOS(M_PI_2*uu, sin_uu, cos_uu); |
---|
[1e7b0db0] | 36 | const double si1 = sas_sinx_x(mu_proj * sin_uu * a_scaled); |
---|
| 37 | const double si2 = sas_sinx_x(mu_proj * cos_uu); |
---|
[14838a3] | 38 | inner_total += Gauss76Wt[j] * square(si1 * si2); |
---|
[c5b7d07] | 39 | } |
---|
[14838a3] | 40 | inner_total *= 0.5; |
---|
[c5b7d07] | 41 | |
---|
[1e7b0db0] | 42 | const double si = sas_sinx_x(mu * c_scaled * sigma); |
---|
[14838a3] | 43 | outer_total += Gauss76Wt[i] * inner_total * si * si; |
---|
| 44 | } |
---|
| 45 | outer_total *= 0.5; |
---|
| 46 | |
---|
| 47 | // Multiply by contrast^2 and convert from [1e-12 A-1] to [cm-1] |
---|
| 48 | const double V = form_volume(length_a, length_b, length_c); |
---|
| 49 | const double drho = (sld-solvent_sld); |
---|
| 50 | return 1.0e-4 * square(drho * V) * outer_total; |
---|
[c5b7d07] | 51 | } |
---|
| 52 | |
---|
| 53 | |
---|
[becded3] | 54 | static double |
---|
[9b7b23f] | 55 | Iqxy(double qa, double qb, double qc, |
---|
[c5b7d07] | 56 | double sld, |
---|
| 57 | double solvent_sld, |
---|
[a807206] | 58 | double length_a, |
---|
| 59 | double length_b, |
---|
[becded3] | 60 | double length_c) |
---|
[c5b7d07] | 61 | { |
---|
[2a0b2b1] | 62 | const double siA = sas_sinx_x(0.5*length_a*qa); |
---|
| 63 | const double siB = sas_sinx_x(0.5*length_b*qb); |
---|
| 64 | const double siC = sas_sinx_x(0.5*length_c*qc); |
---|
[14838a3] | 65 | const double V = form_volume(length_a, length_b, length_c); |
---|
| 66 | const double drho = (sld - solvent_sld); |
---|
| 67 | const double form = V * drho * siA * siB * siC; |
---|
| 68 | // Square and convert from [1e-12 A-1] to [cm-1] |
---|
| 69 | return 1.0e-4 * form * form; |
---|
[c5b7d07] | 70 | } |
---|