[5933c7f] | 1 | # triaxial ellipsoid model |
---|
| 2 | # Note: model title and parameter table are inserted automatically |
---|
| 3 | r""" |
---|
[67595af] | 4 | Definition |
---|
| 5 | ---------- |
---|
| 6 | |
---|
| 7 | .. figure:: img/triaxial_ellipsoid_geometry.jpg |
---|
| 8 | |
---|
| 9 | Ellipsoid with $R_a$ as *radius_equat_minor*, $R_b$ as *radius_equat_major* |
---|
| 10 | and $R_c$ as *radius_polar*. For highest accuracy in the orientational |
---|
| 11 | average, prefer $R_c > R_b > R_a$. |
---|
| 12 | |
---|
| 13 | Given an ellipsoid |
---|
[5933c7f] | 14 | |
---|
| 15 | .. math:: |
---|
| 16 | |
---|
[67595af] | 17 | \frac{X^2}{R_a^2} + \frac{Y^2}{R_b^2} + \frac{Z^2}{R_c^2} = 1 |
---|
[5933c7f] | 18 | |
---|
[67595af] | 19 | the scattering is defined by the average over all orientations $\Omega$, |
---|
[5933c7f] | 20 | |
---|
[67595af] | 21 | .. math:: |
---|
[5933c7f] | 22 | |
---|
[67595af] | 23 | P(q) = \text{scale}\frac{V}{4 \pi}\int_\Omega \Phi^2(qr) d\Omega + \text{background} |
---|
[5933c7f] | 24 | |
---|
[67595af] | 25 | where |
---|
[5933c7f] | 26 | |
---|
[67595af] | 27 | .. math:: |
---|
| 28 | |
---|
| 29 | \Phi(qr) &= 3 j_1(qr)/qr = 3 (\sin qr - qr \cos qr)/(qr)^3 \\ |
---|
| 30 | r^2 &= R_a^2e^2 + R_b^2f^2 + R_c^2g^2 \\ |
---|
| 31 | V &= \tfrac{4}{3} \pi R_a R_b R_c |
---|
| 32 | |
---|
| 33 | The $e$, $f$ and $g$ terms are the projections of the orientation vector on $X$, |
---|
| 34 | $Y$ and $Z$ respectively. Keeping the orientation fixed at the canonical |
---|
| 35 | axes, we can integrate over the incident direction using polar angle |
---|
| 36 | $-\pi/2 \le \gamma \le \pi/2$ and equatorial angle $0 \le \phi \le 2\pi$ |
---|
| 37 | (as defined in ref [1]), |
---|
| 38 | |
---|
| 39 | .. math:: |
---|
| 40 | |
---|
| 41 | \langle\Phi^2\rangle = \int_0^{2\pi} \int_{-\pi/2}^{\pi/2} \Phi^2(qr) \cos \gamma\,d\gamma d\phi |
---|
| 42 | |
---|
| 43 | with $e = \cos\gamma \sin\phi$, $f = \cos\gamma \cos\phi$ and $g = \sin\gamma$. |
---|
| 44 | A little algebra yields |
---|
[5933c7f] | 45 | |
---|
| 46 | .. math:: |
---|
| 47 | |
---|
[67595af] | 48 | r^2 = b^2(p_a \sin^2 \phi \cos^2 \gamma + 1 + p_c \sin^2 \gamma) |
---|
[5933c7f] | 49 | |
---|
[67595af] | 50 | for |
---|
[5933c7f] | 51 | |
---|
| 52 | .. math:: |
---|
| 53 | |
---|
[67595af] | 54 | p_a = \frac{a^2}{b^2} - 1 \text{ and } p_c = \frac{c^2}{b^2} - 1 |
---|
| 55 | |
---|
| 56 | Due to symmetry, the ranges can be restricted to a single quadrant |
---|
| 57 | $0 \le \gamma \le \pi/2$ and $0 \le \phi \le \pi/2$, scaling the resulting |
---|
| 58 | integral by 8. The computation is done using the substitution $u = \sin\gamma$, |
---|
| 59 | $du = \cos\gamma\,d\gamma$, giving |
---|
| 60 | |
---|
| 61 | .. math:: |
---|
| 62 | |
---|
| 63 | \langle\Phi^2\rangle &= 8 \int_0^{\pi/2} \int_0^1 \Phi^2(qr) du d\phi \\ |
---|
| 64 | r^2 &= b^2(p_a \sin^2(\phi)(1 - u^2) + 1 + p_c u^2) |
---|
[5933c7f] | 65 | |
---|
| 66 | To provide easy access to the orientation of the triaxial ellipsoid, |
---|
| 67 | we define the axis of the cylinder using the angles $\theta$, $\phi$ |
---|
| 68 | and $\psi$. These angles are defined on |
---|
[416f5c7] | 69 | :numref:`triaxial-ellipsoid-angles` . |
---|
[5933c7f] | 70 | The angle $\psi$ is the rotational angle around its own $c$ axis |
---|
| 71 | against the $q$ plane. For example, $\psi = 0$ when the |
---|
| 72 | $a$ axis is parallel to the $x$ axis of the detector. |
---|
| 73 | |
---|
| 74 | .. _triaxial-ellipsoid-angles: |
---|
| 75 | |
---|
| 76 | .. figure:: img/triaxial_ellipsoid_angle_projection.jpg |
---|
| 77 | |
---|
| 78 | The angles for oriented ellipsoid. |
---|
| 79 | |
---|
| 80 | The radius-of-gyration for this system is $R_g^2 = (R_a R_b R_c)^2/5$. |
---|
| 81 | |
---|
| 82 | The contrast is defined as SLD(ellipsoid) - SLD(solvent). In the |
---|
| 83 | parameters, $R_a$ is the minor equatorial radius, $R_b$ is the major |
---|
| 84 | equatorial radius, and $R_c$ is the polar radius of the ellipsoid. |
---|
| 85 | |
---|
| 86 | NB: The 2nd virial coefficient of the triaxial solid ellipsoid is |
---|
| 87 | calculated based on the polar radius $R_p = R_c$ and equatorial |
---|
| 88 | radius $R_e = \sqrt{R_a R_b}$, and used as the effective radius for |
---|
| 89 | $S(q)$ when $P(q) \cdot S(q)$ is applied. |
---|
| 90 | |
---|
| 91 | Validation |
---|
| 92 | ---------- |
---|
| 93 | |
---|
| 94 | Validation of our code was done by comparing the output of the |
---|
| 95 | 1D calculation to the angular average of the output of 2D calculation |
---|
| 96 | over all possible angles. |
---|
| 97 | |
---|
| 98 | |
---|
| 99 | References |
---|
| 100 | ---------- |
---|
| 101 | |
---|
[67595af] | 102 | [1] Finnigan, J.A., Jacobs, D.J., 1971. |
---|
| 103 | *Light scattering by ellipsoidal particles in solution*, |
---|
| 104 | J. Phys. D: Appl. Phys. 4, 72-77. doi:10.1088/0022-3727/4/1/310 |
---|
| 105 | |
---|
[5933c7f] | 106 | """ |
---|
| 107 | |
---|
| 108 | from numpy import inf |
---|
| 109 | |
---|
| 110 | name = "triaxial_ellipsoid" |
---|
| 111 | title = "Ellipsoid of uniform scattering length density with three independent axes." |
---|
| 112 | |
---|
| 113 | description = """\ |
---|
| 114 | Note: During fitting ensure that the inequality ra<rb<rc is not |
---|
| 115 | violated. Otherwise the calculation will |
---|
| 116 | not be correct. |
---|
| 117 | """ |
---|
| 118 | category = "shape:ellipsoid" |
---|
| 119 | |
---|
| 120 | # ["name", "units", default, [lower, upper], "type","description"], |
---|
[42356c8] | 121 | parameters = [["sld", "1e-6/Ang^2", 4, [-inf, inf], "sld", |
---|
[5933c7f] | 122 | "Ellipsoid scattering length density"], |
---|
[a807206] | 123 | ["sld_solvent", "1e-6/Ang^2", 1, [-inf, inf], "sld", |
---|
[5933c7f] | 124 | "Solvent scattering length density"], |
---|
[a807206] | 125 | ["radius_equat_minor", "Ang", 20, [0, inf], "volume", |
---|
[67595af] | 126 | "Minor equatorial radius, Ra"], |
---|
[a807206] | 127 | ["radius_equat_major", "Ang", 400, [0, inf], "volume", |
---|
[67595af] | 128 | "Major equatorial radius, Rb"], |
---|
[a807206] | 129 | ["radius_polar", "Ang", 10, [0, inf], "volume", |
---|
[67595af] | 130 | "Polar radius, Rc"], |
---|
[5933c7f] | 131 | ["theta", "degrees", 60, [-inf, inf], "orientation", |
---|
| 132 | "In plane angle"], |
---|
| 133 | ["phi", "degrees", 60, [-inf, inf], "orientation", |
---|
| 134 | "Out of plane angle"], |
---|
| 135 | ["psi", "degrees", 60, [-inf, inf], "orientation", |
---|
| 136 | "Out of plane angle"], |
---|
| 137 | ] |
---|
| 138 | |
---|
[925ad6e] | 139 | source = ["lib/sas_3j1x_x.c", "lib/gauss76.c", "triaxial_ellipsoid.c"] |
---|
[5933c7f] | 140 | |
---|
[a807206] | 141 | def ER(radius_equat_minor, radius_equat_major, radius_polar): |
---|
[5933c7f] | 142 | """ |
---|
| 143 | Returns the effective radius used in the S*P calculation |
---|
| 144 | """ |
---|
| 145 | import numpy as np |
---|
| 146 | from .ellipsoid import ER as ellipsoid_ER |
---|
[a807206] | 147 | return ellipsoid_ER(radius_polar, np.sqrt(radius_equat_minor * radius_equat_major)) |
---|
[5933c7f] | 148 | |
---|
| 149 | demo = dict(scale=1, background=0, |
---|
[a807206] | 150 | sld=6, sld_solvent=1, |
---|
[5933c7f] | 151 | theta=30, phi=15, psi=5, |
---|
[a807206] | 152 | radius_equat_minor=25, radius_equat_major=36, radius_polar=50, |
---|
| 153 | radius_equat_minor_pd=0, radius_equat_minor_pd_n=1, |
---|
| 154 | radius_equat_major_pd=0, radius_equat_major_pd_n=1, |
---|
| 155 | radius_polar_pd=.2, radius_polar_pd_n=30, |
---|
[5933c7f] | 156 | theta_pd=15, theta_pd_n=45, |
---|
| 157 | phi_pd=15, phi_pd_n=1, |
---|
| 158 | psi_pd=15, psi_pd_n=1) |
---|