[2a0b2b1] | 1 | static double |
---|
| 2 | form_volume(double radius, double thick_rim, double thick_face, double length) |
---|
[8007311] | 3 | { |
---|
[2a0b2b1] | 4 | return M_PI*square(radius+thick_rim)*(length+2.0*thick_face); |
---|
[8007311] | 5 | } |
---|
| 6 | |
---|
| 7 | static double |
---|
[2a0b2b1] | 8 | bicelle_kernel(double qab, |
---|
| 9 | double qc, |
---|
| 10 | double radius, |
---|
| 11 | double thick_radius, |
---|
| 12 | double thick_face, |
---|
| 13 | double halflength, |
---|
| 14 | double sld_core, |
---|
| 15 | double sld_face, |
---|
| 16 | double sld_rim, |
---|
| 17 | double sld_solvent) |
---|
[8007311] | 18 | { |
---|
[2a0b2b1] | 19 | const double dr1 = sld_core-sld_face; |
---|
| 20 | const double dr2 = sld_rim-sld_solvent; |
---|
| 21 | const double dr3 = sld_face-sld_rim; |
---|
| 22 | const double vol1 = M_PI*square(radius)*2.0*(halflength); |
---|
| 23 | const double vol2 = M_PI*square(radius+thick_radius)*2.0*(halflength+thick_face); |
---|
| 24 | const double vol3 = M_PI*square(radius)*2.0*(halflength+thick_face); |
---|
| 25 | |
---|
| 26 | const double be1 = sas_2J1x_x((radius)*qab); |
---|
| 27 | const double be2 = sas_2J1x_x((radius+thick_radius)*qab); |
---|
| 28 | const double si1 = sas_sinx_x((halflength)*qc); |
---|
| 29 | const double si2 = sas_sinx_x((halflength+thick_face)*qc); |
---|
[e7678b2] | 30 | |
---|
| 31 | const double t = vol1*dr1*si1*be1 + |
---|
| 32 | vol2*dr2*si2*be2 + |
---|
| 33 | vol3*dr3*si2*be1; |
---|
| 34 | |
---|
[2a0b2b1] | 35 | return t; |
---|
[8007311] | 36 | } |
---|
| 37 | |
---|
[d277229] | 38 | static double |
---|
[99658f6] | 39 | radius_from_excluded_volume(double radius, double thick_rim, double thick_face, double length) |
---|
| 40 | { |
---|
| 41 | const double radius_tot = radius + thick_rim; |
---|
| 42 | const double length_tot = length + 2.0*thick_face; |
---|
| 43 | return 0.5*cbrt(0.75*radius_tot*(2.0*radius_tot*length_tot + (radius_tot + length_tot)*(M_PI*radius_tot + length_tot))); |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | static double |
---|
[d277229] | 47 | radius_from_volume(double radius, double thick_rim, double thick_face, double length) |
---|
| 48 | { |
---|
| 49 | const double volume_bicelle = form_volume(radius,thick_rim,thick_face,length); |
---|
[6d5601c] | 50 | return cbrt(volume_bicelle/M_4PI_3); |
---|
[d277229] | 51 | } |
---|
| 52 | |
---|
| 53 | static double |
---|
| 54 | radius_from_diagonal(double radius, double thick_rim, double thick_face, double length) |
---|
| 55 | { |
---|
| 56 | const double radius_tot = radius + thick_rim; |
---|
| 57 | const double length_tot = length + 2.0*thick_face; |
---|
| 58 | return sqrt(radius_tot*radius_tot + 0.25*length_tot*length_tot); |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | static double |
---|
| 62 | effective_radius(int mode, double radius, double thick_rim, double thick_face, double length) |
---|
| 63 | { |
---|
[ee60aa7] | 64 | switch (mode) { |
---|
[d42dd4a] | 65 | default: |
---|
[99658f6] | 66 | case 1: // equivalent cylinder excluded volume |
---|
| 67 | return radius_from_excluded_volume(radius, thick_rim, thick_face, length); |
---|
| 68 | case 2: // equivalent sphere |
---|
[d277229] | 69 | return radius_from_volume(radius, thick_rim, thick_face, length); |
---|
[99658f6] | 70 | case 3: // outer rim radius |
---|
[d277229] | 71 | return radius + thick_rim; |
---|
[99658f6] | 72 | case 4: // half outer thickness |
---|
[d277229] | 73 | return 0.5*length + thick_face; |
---|
[99658f6] | 74 | case 5: // half diagonal |
---|
[d277229] | 75 | return radius_from_diagonal(radius,thick_rim,thick_face,length); |
---|
| 76 | } |
---|
| 77 | } |
---|
| 78 | |
---|
[71b751d] | 79 | static void |
---|
| 80 | Fq(double q, |
---|
| 81 | double *F1, |
---|
| 82 | double *F2, |
---|
[2a0b2b1] | 83 | double radius, |
---|
| 84 | double thick_radius, |
---|
| 85 | double thick_face, |
---|
| 86 | double length, |
---|
| 87 | double sld_core, |
---|
| 88 | double sld_face, |
---|
| 89 | double sld_rim, |
---|
| 90 | double sld_solvent) |
---|
[8007311] | 91 | { |
---|
[e7678b2] | 92 | // set up the integration end points |
---|
[5bddd89] | 93 | const double uplim = M_PI_4; |
---|
[b260926] | 94 | const double halflength = 0.5*length; |
---|
[e7678b2] | 95 | |
---|
[71b751d] | 96 | double total_F1 = 0.0; |
---|
| 97 | double total_F2 = 0.0; |
---|
[74768cb] | 98 | for(int i=0;i<GAUSS_N;i++) { |
---|
| 99 | double theta = (GAUSS_Z[i] + 1.0)*uplim; |
---|
[2a0b2b1] | 100 | double sin_theta, cos_theta; // slots to hold sincos function output |
---|
| 101 | SINCOS(theta, sin_theta, cos_theta); |
---|
[71b751d] | 102 | double form = bicelle_kernel(q*sin_theta, q*cos_theta, radius, thick_radius, thick_face, |
---|
[2a0b2b1] | 103 | halflength, sld_core, sld_face, sld_rim, sld_solvent); |
---|
[71b751d] | 104 | total_F1 += GAUSS_W[i]*form*sin_theta; |
---|
| 105 | total_F2 += GAUSS_W[i]*form*form*sin_theta; |
---|
[e7678b2] | 106 | } |
---|
[71b751d] | 107 | // Correct for integration range |
---|
| 108 | total_F1 *= uplim; |
---|
| 109 | total_F2 *= uplim; |
---|
[e7678b2] | 110 | |
---|
[71b751d] | 111 | *F1 = 1.0e-2*total_F1; |
---|
| 112 | *F2 = 1.0e-4*total_F2; |
---|
[8007311] | 113 | } |
---|
| 114 | |
---|
| 115 | static double |
---|
[108e70e] | 116 | Iqac(double qab, double qc, |
---|
[2a0b2b1] | 117 | double radius, |
---|
| 118 | double thick_rim, |
---|
| 119 | double thick_face, |
---|
| 120 | double length, |
---|
| 121 | double core_sld, |
---|
| 122 | double face_sld, |
---|
| 123 | double rim_sld, |
---|
[becded3] | 124 | double solvent_sld) |
---|
[8007311] | 125 | { |
---|
[2a0b2b1] | 126 | double fq = bicelle_kernel(qab, qc, radius, thick_rim, thick_face, |
---|
[5bddd89] | 127 | 0.5*length, core_sld, face_sld, rim_sld, |
---|
[2a0b2b1] | 128 | solvent_sld); |
---|
| 129 | return 1.0e-4*fq*fq; |
---|
[d277229] | 130 | } |
---|