[aea2e2a] | 1 | //#define INVALID(v) (v.radius_core >= v.radius) |
---|
| 2 | |
---|
[5bddd89] | 3 | static double |
---|
[2a0b2b1] | 4 | _fq(double qab, double qc, |
---|
| 5 | double radius, double thickness, double length) |
---|
[aea2e2a] | 6 | { |
---|
[2a0b2b1] | 7 | const double lam1 = sas_2J1x_x((radius+thickness)*qab); |
---|
| 8 | const double lam2 = sas_2J1x_x(radius*qab); |
---|
[aea2e2a] | 9 | const double gamma_sq = square(radius/(radius+thickness)); |
---|
[2a0b2b1] | 10 | //Note: lim_{thickness -> 0} psi = sas_J0(radius*qab) |
---|
| 11 | //Note: lim_{radius -> 0} psi = sas_2J1x_x(thickness*qab) |
---|
| 12 | const double psi = (lam1 - gamma_sq*lam2)/(1.0 - gamma_sq); //SRK 10/19/00 |
---|
| 13 | const double t2 = sas_sinx_x(0.5*length*qc); |
---|
[5bddd89] | 14 | return psi*t2; |
---|
[aea2e2a] | 15 | } |
---|
| 16 | |
---|
[becded3] | 17 | static double |
---|
[5bddd89] | 18 | form_volume(double radius, double thickness, double length) |
---|
[aea2e2a] | 19 | { |
---|
[ed23abe] | 20 | double v_shell = M_PI*length*(square(radius+thickness) - radius*radius); |
---|
| 21 | return v_shell; |
---|
[aea2e2a] | 22 | } |
---|
| 23 | |
---|
[d277229] | 24 | static double |
---|
| 25 | radius_from_volume(double radius, double thickness, double length) |
---|
| 26 | { |
---|
| 27 | const double volume_outer_cyl = M_PI*square(radius + thickness)*length; |
---|
| 28 | return cbrt(0.75*volume_outer_cyl/M_PI); |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | static double |
---|
| 32 | radius_from_diagonal(double radius, double thickness, double length) |
---|
| 33 | { |
---|
| 34 | return sqrt(square(radius + thickness) + 0.25*square(length)); |
---|
| 35 | } |
---|
| 36 | |
---|
| 37 | static double |
---|
| 38 | effective_radius(int mode, double radius, double thickness, double length) |
---|
| 39 | { |
---|
| 40 | if (mode == 1) { |
---|
| 41 | return radius_from_volume(radius, thickness, length); |
---|
| 42 | } else if (mode == 2) { |
---|
| 43 | return radius + thickness; |
---|
| 44 | } else if (mode == 3) { |
---|
| 45 | return 0.5*length; |
---|
| 46 | } else if (mode == 4) { |
---|
| 47 | return (radius + thickness < 0.5*length ? radius + thickness : 0.5*length); |
---|
| 48 | } else if (mode == 5) { |
---|
| 49 | return (radius + thickness > 0.5*length ? radius + thickness : 0.5*length); |
---|
| 50 | } else { |
---|
| 51 | return radius_from_diagonal(radius,thickness,length); |
---|
| 52 | } |
---|
| 53 | } |
---|
[aea2e2a] | 54 | |
---|
[71b751d] | 55 | static void |
---|
| 56 | Fq(double q, double *F1, double *F2, double radius, double thickness, double length, |
---|
[aea2e2a] | 57 | double sld, double solvent_sld) |
---|
| 58 | { |
---|
[5bddd89] | 59 | const double lower = 0.0; |
---|
[2a0b2b1] | 60 | const double upper = 1.0; //limits of numerical integral |
---|
[5bddd89] | 61 | |
---|
[71b751d] | 62 | double total_F1 = 0.0; //initialize intergral |
---|
| 63 | double total_F2 = 0.0; |
---|
[74768cb] | 64 | for (int i=0;i<GAUSS_N;i++) { |
---|
| 65 | const double cos_theta = 0.5*( GAUSS_Z[i] * (upper-lower) + lower + upper ); |
---|
[2a0b2b1] | 66 | const double sin_theta = sqrt(1.0 - cos_theta*cos_theta); |
---|
| 67 | const double form = _fq(q*sin_theta, q*cos_theta, |
---|
| 68 | radius, thickness, length); |
---|
[71b751d] | 69 | total_F1 += GAUSS_W[i] * form; |
---|
| 70 | total_F2 += GAUSS_W[i] * form * form; |
---|
[aea2e2a] | 71 | } |
---|
[71b751d] | 72 | total_F1 *= 0.5*(upper-lower); |
---|
| 73 | total_F2 *= 0.5*(upper-lower); |
---|
| 74 | const double s = (sld - solvent_sld) * form_volume(radius, thickness, length); |
---|
| 75 | *F1 = 1e-2 * s * total_F1; |
---|
| 76 | *F2 = 1e-4 * s*s * total_F2; |
---|
[5bddd89] | 77 | } |
---|
[aea2e2a] | 78 | |
---|
[71b751d] | 79 | |
---|
[becded3] | 80 | static double |
---|
[108e70e] | 81 | Iqac(double qab, double qc, |
---|
[5bddd89] | 82 | double radius, double thickness, double length, |
---|
[becded3] | 83 | double sld, double solvent_sld) |
---|
[5bddd89] | 84 | { |
---|
[2a0b2b1] | 85 | const double form = _fq(qab, qc, radius, thickness, length); |
---|
[71b751d] | 86 | const double s = (sld - solvent_sld) * form_volume(radius, thickness, length); |
---|
| 87 | return 1.0e-4*square(s * form); |
---|
[aea2e2a] | 88 | } |
---|