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