[81dd619] | 1 | |
---|
[2a0b2b1] | 2 | // Converted from Igor function gfn4, using the same pattern as ellipsoid |
---|
| 3 | // for evaluating the parts of the integral. |
---|
| 4 | // FUNCTION gfn4: CONTAINS F(Q,A,B,MU)**2 AS GIVEN |
---|
| 5 | // BY (53) & (58-59) IN CHEN AND |
---|
| 6 | // KOTLARCHYK REFERENCE |
---|
| 7 | // |
---|
| 8 | // <OBLATE ELLIPSOID> |
---|
| 9 | static double |
---|
| 10 | _cs_ellipsoid_kernel(double qab, double qc, |
---|
| 11 | double equat_core, double polar_core, |
---|
| 12 | double equat_shell, double polar_shell, |
---|
| 13 | double sld_core_shell, double sld_shell_solvent) |
---|
| 14 | { |
---|
| 15 | const double qr_core = sqrt(square(equat_core*qab) + square(polar_core*qc)); |
---|
| 16 | const double si_core = sas_3j1x_x(qr_core); |
---|
| 17 | const double volume_core = M_4PI_3*equat_core*equat_core*polar_core; |
---|
| 18 | const double fq_core = si_core*volume_core*sld_core_shell; |
---|
[81dd619] | 19 | |
---|
[2a0b2b1] | 20 | const double qr_shell = sqrt(square(equat_shell*qab) + square(polar_shell*qc)); |
---|
| 21 | const double si_shell = sas_3j1x_x(qr_shell); |
---|
| 22 | const double volume_shell = M_4PI_3*equat_shell*equat_shell*polar_shell; |
---|
| 23 | const double fq_shell = si_shell*volume_shell*sld_shell_solvent; |
---|
[81dd619] | 24 | |
---|
[2a0b2b1] | 25 | return fq_core + fq_shell; |
---|
| 26 | } |
---|
[81dd619] | 27 | |
---|
[2a0b2b1] | 28 | static double |
---|
| 29 | form_volume(double radius_equat_core, |
---|
| 30 | double x_core, |
---|
| 31 | double thick_shell, |
---|
| 32 | double x_polar_shell) |
---|
[81dd619] | 33 | { |
---|
[5031ca3] | 34 | const double equat_shell = radius_equat_core + thick_shell; |
---|
| 35 | const double polar_shell = radius_equat_core*x_core + thick_shell*x_polar_shell; |
---|
[5bddd89] | 36 | double vol = M_4PI_3*equat_shell*equat_shell*polar_shell; |
---|
[81dd619] | 37 | return vol; |
---|
| 38 | } |
---|
| 39 | |
---|
[d277229] | 40 | static double |
---|
| 41 | radius_from_volume(double radius_equat_core, double x_core, double thick_shell, double x_polar_shell) |
---|
| 42 | { |
---|
| 43 | const double volume_ellipsoid = form_volume(radius_equat_core, x_core, thick_shell, x_polar_shell); |
---|
[6d5601c] | 44 | return cbrt(volume_ellipsoid/M_4PI_3); |
---|
[d277229] | 45 | } |
---|
| 46 | |
---|
| 47 | static double |
---|
| 48 | radius_from_curvature(double radius_equat_core, double x_core, double thick_shell, double x_polar_shell) |
---|
| 49 | { |
---|
| 50 | // Trivial cases |
---|
[3c60146] | 51 | if (1.0 == x_core && 1.0 == x_polar_shell) return radius_equat_core + thick_shell; |
---|
[d277229] | 52 | if ((radius_equat_core + thick_shell)*(radius_equat_core*x_core + thick_shell*x_polar_shell) == 0.) return 0.; |
---|
| 53 | |
---|
| 54 | // see equation (26) in A.Isihara, J.Chem.Phys. 18(1950)1446-1449 |
---|
| 55 | const double radius_equat_tot = radius_equat_core + thick_shell; |
---|
| 56 | const double radius_polar_tot = radius_equat_core*x_core + thick_shell*x_polar_shell; |
---|
| 57 | const double ratio = (radius_polar_tot < radius_equat_tot |
---|
| 58 | ? radius_polar_tot / radius_equat_tot |
---|
| 59 | : radius_equat_tot / radius_polar_tot); |
---|
| 60 | const double e1 = sqrt(1.0 - ratio*ratio); |
---|
| 61 | const double b1 = 1.0 + asin(e1) / (e1 * ratio); |
---|
| 62 | const double bL = (1.0 + e1) / (1.0 - e1); |
---|
| 63 | const double b2 = 1.0 + 0.5 * ratio * ratio / e1 * log(bL); |
---|
| 64 | const double delta = 0.75 * b1 * b2; |
---|
| 65 | const double ddd = 2.0 * (delta + 1.0) * radius_polar_tot * radius_equat_tot * radius_equat_tot; |
---|
| 66 | return 0.5 * cbrt(ddd); |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | static double |
---|
[a34b811] | 70 | radius_effective(int mode, double radius_equat_core, double x_core, double thick_shell, double x_polar_shell) |
---|
[d277229] | 71 | { |
---|
[3c60146] | 72 | const double radius_equat_tot = radius_equat_core + thick_shell; |
---|
| 73 | const double radius_polar_tot = radius_equat_core*x_core + thick_shell*x_polar_shell; |
---|
| 74 | |
---|
[ee60aa7] | 75 | switch (mode) { |
---|
[d42dd4a] | 76 | default: |
---|
[99658f6] | 77 | case 1: // average outer curvature |
---|
[d277229] | 78 | return radius_from_curvature(radius_equat_core, x_core, thick_shell, x_polar_shell); |
---|
[99658f6] | 79 | case 2: // equivalent volume sphere |
---|
| 80 | return radius_from_volume(radius_equat_core, x_core, thick_shell, x_polar_shell); |
---|
[ee60aa7] | 81 | case 3: // min outer radius |
---|
[d277229] | 82 | return (radius_polar_tot < radius_equat_tot ? radius_polar_tot : radius_equat_tot); |
---|
[ee60aa7] | 83 | case 4: // max outer radius |
---|
[d277229] | 84 | return (radius_polar_tot > radius_equat_tot ? radius_polar_tot : radius_equat_tot); |
---|
| 85 | } |
---|
| 86 | } |
---|
| 87 | |
---|
[71b751d] | 88 | static void |
---|
| 89 | Fq(double q, |
---|
| 90 | double *F1, |
---|
| 91 | double *F2, |
---|
[2a0b2b1] | 92 | double radius_equat_core, |
---|
| 93 | double x_core, |
---|
| 94 | double thick_shell, |
---|
| 95 | double x_polar_shell, |
---|
| 96 | double core_sld, |
---|
| 97 | double shell_sld, |
---|
| 98 | double solvent_sld) |
---|
[81dd619] | 99 | { |
---|
[2a0b2b1] | 100 | const double sld_core_shell = core_sld - shell_sld; |
---|
| 101 | const double sld_shell_solvent = shell_sld - solvent_sld; |
---|
[5031ca3] | 102 | |
---|
| 103 | const double polar_core = radius_equat_core*x_core; |
---|
| 104 | const double equat_shell = radius_equat_core + thick_shell; |
---|
| 105 | const double polar_shell = radius_equat_core*x_core + thick_shell*x_polar_shell; |
---|
[81dd619] | 106 | |
---|
[2a0b2b1] | 107 | // translate from [-1, 1] => [0, 1] |
---|
| 108 | const double m = 0.5; |
---|
| 109 | const double b = 0.5; |
---|
[71b751d] | 110 | double total_F1 = 0.0; //initialize intergral |
---|
| 111 | double total_F2 = 0.0; //initialize intergral |
---|
[74768cb] | 112 | for(int i=0;i<GAUSS_N;i++) { |
---|
| 113 | const double cos_theta = GAUSS_Z[i]*m + b; |
---|
[2a0b2b1] | 114 | const double sin_theta = sqrt(1.0 - cos_theta*cos_theta); |
---|
| 115 | double fq = _cs_ellipsoid_kernel(q*sin_theta, q*cos_theta, |
---|
| 116 | radius_equat_core, polar_core, |
---|
| 117 | equat_shell, polar_shell, |
---|
| 118 | sld_core_shell, sld_shell_solvent); |
---|
[71b751d] | 119 | total_F1 += GAUSS_W[i] * fq; |
---|
| 120 | total_F2 += GAUSS_W[i] * fq * fq; |
---|
[e7678b2] | 121 | } |
---|
[71b751d] | 122 | total_F1 *= m; |
---|
| 123 | total_F2 *= m; |
---|
[81dd619] | 124 | |
---|
[0a3d9b2] | 125 | // convert to [cm-1] |
---|
[71b751d] | 126 | *F1 = 1.0e-2 * total_F1; |
---|
| 127 | *F2 = 1.0e-4 * total_F2; |
---|
[81dd619] | 128 | } |
---|
| 129 | |
---|
[71b751d] | 130 | |
---|
[81dd619] | 131 | static double |
---|
[108e70e] | 132 | Iqac(double qab, double qc, |
---|
[2a0b2b1] | 133 | double radius_equat_core, |
---|
| 134 | double x_core, |
---|
| 135 | double thick_shell, |
---|
| 136 | double x_polar_shell, |
---|
| 137 | double core_sld, |
---|
| 138 | double shell_sld, |
---|
[becded3] | 139 | double solvent_sld) |
---|
[81dd619] | 140 | { |
---|
[2a0b2b1] | 141 | const double sld_core_shell = core_sld - shell_sld; |
---|
| 142 | const double sld_shell_solvent = shell_sld - solvent_sld; |
---|
[81dd619] | 143 | |
---|
[5031ca3] | 144 | const double polar_core = radius_equat_core*x_core; |
---|
| 145 | const double equat_shell = radius_equat_core + thick_shell; |
---|
| 146 | const double polar_shell = radius_equat_core*x_core + thick_shell*x_polar_shell; |
---|
| 147 | |
---|
[2a0b2b1] | 148 | double fq = _cs_ellipsoid_kernel(qab, qc, |
---|
| 149 | radius_equat_core, polar_core, |
---|
| 150 | equat_shell, polar_shell, |
---|
| 151 | sld_core_shell, sld_shell_solvent); |
---|
[81dd619] | 152 | |
---|
| 153 | //convert to [cm-1] |
---|
[2a0b2b1] | 154 | return 1.0e-4 * fq * fq; |
---|
[81dd619] | 155 | } |
---|