[2a0b2b1] | 1 | static double |
---|
[251f54b] | 2 | form_volume(double radius_minor, double r_ratio, double length) |
---|
[a8b3cdb] | 3 | { |
---|
[a807206] | 4 | return M_PI * radius_minor * radius_minor * r_ratio * length; |
---|
[a8b3cdb] | 5 | } |
---|
| 6 | |
---|
[71b751d] | 7 | static void |
---|
| 8 | Fq(double q, double *F1, double *F2, double radius_minor, double r_ratio, double length, |
---|
[68425bf] | 9 | double sld, double solvent_sld) |
---|
| 10 | { |
---|
[a8b3cdb] | 11 | // orientational average limits |
---|
[68425bf] | 12 | const double va = 0.0; |
---|
| 13 | const double vb = 1.0; |
---|
[a8b3cdb] | 14 | // inner integral limits |
---|
[68425bf] | 15 | const double vaj=0.0; |
---|
| 16 | const double vbj=M_PI; |
---|
[a8b3cdb] | 17 | |
---|
[68425bf] | 18 | const double radius_major = r_ratio * radius_minor; |
---|
| 19 | const double rA = 0.5*(square(radius_major) + square(radius_minor)); |
---|
| 20 | const double rB = 0.5*(square(radius_major) - square(radius_minor)); |
---|
[a8b3cdb] | 21 | |
---|
[68425bf] | 22 | //initialize integral |
---|
[71b751d] | 23 | double outer_sum_F1 = 0.0; |
---|
| 24 | double outer_sum_F2 = 0.0; |
---|
[74768cb] | 25 | for(int i=0;i<GAUSS_N;i++) { |
---|
[a8b3cdb] | 26 | //setup inner integral over the ellipsoidal cross-section |
---|
[74768cb] | 27 | const double cos_val = ( GAUSS_Z[i]*(vb-va) + va + vb )/2.0; |
---|
[68425bf] | 28 | const double sin_val = sqrt(1.0 - cos_val*cos_val); |
---|
| 29 | //const double arg = radius_minor*sin_val; |
---|
[71b751d] | 30 | double inner_sum_F1 = 0.0; |
---|
| 31 | double inner_sum_F2 = 0.0; |
---|
[74768cb] | 32 | for(int j=0;j<GAUSS_N;j++) { |
---|
| 33 | const double theta = ( GAUSS_Z[j]*(vbj-vaj) + vaj + vbj )/2.0; |
---|
[68425bf] | 34 | const double r = sin_val*sqrt(rA - rB*cos(theta)); |
---|
[592343f] | 35 | const double be = sas_2J1x_x(q*r); |
---|
[71b751d] | 36 | inner_sum_F1 += GAUSS_W[j] * be; |
---|
| 37 | inner_sum_F2 += GAUSS_W[j] * be * be; |
---|
[a8b3cdb] | 38 | } |
---|
| 39 | //now calculate the value of the inner integral |
---|
[71b751d] | 40 | inner_sum_F1 *= 0.5*(vbj-vaj); |
---|
| 41 | inner_sum_F2 *= 0.5*(vbj-vaj); |
---|
[a8b3cdb] | 42 | |
---|
| 43 | //now calculate outer integral |
---|
[1e7b0db0] | 44 | const double si = sas_sinx_x(q*0.5*length*cos_val); |
---|
[71b751d] | 45 | outer_sum_F1 += GAUSS_W[i] * inner_sum_F1 * si; |
---|
| 46 | outer_sum_F2 += GAUSS_W[i] * inner_sum_F2 * si * si; |
---|
[a8b3cdb] | 47 | } |
---|
[71b751d] | 48 | // correct limits and divide integral by pi |
---|
| 49 | outer_sum_F1 *= 0.5*(vb-va)/M_PI; |
---|
| 50 | outer_sum_F2 *= 0.5*(vb-va)/M_PI; |
---|
[a8b3cdb] | 51 | |
---|
[68425bf] | 52 | // scale by contrast and volume, and convert to to 1/cm units |
---|
[71b751d] | 53 | const double volume = form_volume(radius_minor, r_ratio, length); |
---|
| 54 | const double contrast = sld - solvent_sld; |
---|
| 55 | const double s = contrast*volume; |
---|
| 56 | *F1 = 1.0e-2*s*outer_sum_F1; |
---|
| 57 | *F2 = 1.0e-4*s*s*outer_sum_F2; |
---|
[a8b3cdb] | 58 | } |
---|
| 59 | |
---|
| 60 | |
---|
[2a0b2b1] | 61 | static double |
---|
[108e70e] | 62 | Iqabc(double qa, double qb, double qc, |
---|
[68425bf] | 63 | double radius_minor, double r_ratio, double length, |
---|
[becded3] | 64 | double sld, double solvent_sld) |
---|
[68425bf] | 65 | { |
---|
| 66 | // Compute: r = sqrt((radius_major*cos_nu)^2 + (radius_minor*cos_mu)^2) |
---|
| 67 | // Given: radius_major = r_ratio * radius_minor |
---|
[82592da] | 68 | const double qr = radius_minor*sqrt(square(r_ratio*qb) + square(qa)); |
---|
[2a0b2b1] | 69 | const double be = sas_2J1x_x(qr); |
---|
| 70 | const double si = sas_sinx_x(qc*0.5*length); |
---|
[71b751d] | 71 | const double fq = be * si; |
---|
| 72 | const double contrast = sld - solvent_sld; |
---|
| 73 | const double volume = form_volume(radius_minor, r_ratio, length); |
---|
| 74 | return 1.0e-4 * square(contrast * volume * fq); |
---|
[a8b3cdb] | 75 | } |
---|