[5d4777d] | 1 | # triaxial ellipsoid model |
---|
| 2 | # Note: model title and parameter table are inserted automatically |
---|
| 3 | r""" |
---|
| 4 | All three axes are of different lengths with $R_a \le R_b <= R_c$ |
---|
| 5 | **Users should maintain this inequality for all calculations**. |
---|
| 6 | |
---|
| 7 | .. math:: |
---|
| 8 | |
---|
[19dcb933] | 9 | P(Q) = \text{scale} V \left< F^2(Q) \right> + \text{background} |
---|
[5d4777d] | 10 | |
---|
| 11 | where the volume $V = 4/3 \pi R_a R_b R_c$, and the averaging |
---|
| 12 | $\left< \cdots \right>$ is applied over all orientations for 1D. |
---|
| 13 | |
---|
[19dcb933] | 14 | .. figure:: img/triaxial_ellipsoid_geometry.jpg |
---|
[5d4777d] | 15 | |
---|
| 16 | Ellipsoid schematic. |
---|
| 17 | |
---|
| 18 | The returned value is in units of |cm^-1|, on absolute scale. |
---|
| 19 | |
---|
| 20 | Definition |
---|
| 21 | ---------- |
---|
| 22 | |
---|
| 23 | The form factor calculated is |
---|
| 24 | |
---|
| 25 | .. math:: |
---|
| 26 | |
---|
[19dcb933] | 27 | P(Q) = \frac{\text{scale}}{V}\int_0^1\int_0^1 |
---|
| 28 | \Phi^2(QR_a^2\cos^2( \pi x/2) + QR_b^2\sin^2(\pi y/2)(1-y^2) + c^2y^2) |
---|
[5d4777d] | 29 | dx dy |
---|
| 30 | |
---|
| 31 | where |
---|
| 32 | |
---|
| 33 | .. math:: |
---|
| 34 | |
---|
| 35 | \Phi(u) = 3 u^{-3} (\sin u - u \cos u) |
---|
| 36 | |
---|
| 37 | To provide easy access to the orientation of the triaxial ellipsoid, |
---|
| 38 | we define the axis of the cylinder using the angles $\theta$, $\phi$ |
---|
| 39 | and $\psi$. These angles are defined on |
---|
[19dcb933] | 40 | :num:`figure #triaxial-ellipsoid-angles`. |
---|
[5d4777d] | 41 | The angle $\psi$ is the rotational angle around its own $c$ axis |
---|
[19dcb933] | 42 | against the $Q$ plane. For example, $\psi = 0$ when the |
---|
[5d4777d] | 43 | $a$ axis is parallel to the $x$ axis of the detector. |
---|
| 44 | |
---|
| 45 | .. _triaxial-ellipsoid-angles: |
---|
| 46 | |
---|
[19dcb933] | 47 | .. figure:: img/triaxial_ellipsoid_angles.jpg |
---|
[5d4777d] | 48 | |
---|
| 49 | The angles for oriented ellipsoid. |
---|
| 50 | |
---|
[19dcb933] | 51 | The radius-of-gyration for this system is $R_g^2 = (R_a R_b R_c)^2/5$. |
---|
[5d4777d] | 52 | |
---|
| 53 | The contrast is defined as SLD(ellipsoid) - SLD(solvent). In the |
---|
| 54 | parameters, *a* is the minor equatorial radius, *b* is the major |
---|
| 55 | equatorial radius, and c is the polar radius of the ellipsoid. |
---|
| 56 | |
---|
| 57 | NB: The 2nd virial coefficient of the triaxial solid ellipsoid is |
---|
| 58 | calculated based on the polar radius $R_p = R_c$ and equatorial |
---|
| 59 | radius $R_e = \sqrt{R_a R_b}$, and used as the effective radius for |
---|
[19dcb933] | 60 | $S(Q)$ when $P(Q) \cdot S(Q)$ is applied. |
---|
[5d4777d] | 61 | |
---|
[19dcb933] | 62 | .. figure:: img/triaxial_ellipsoid_1d.jpg |
---|
[5d4777d] | 63 | |
---|
| 64 | 1D plot using the default values (w/1000 data point). |
---|
| 65 | |
---|
| 66 | Validation |
---|
| 67 | ---------- |
---|
| 68 | |
---|
| 69 | Validation of our code was done by comparing the output of the |
---|
| 70 | 1D calculation to the angular average of the output of 2D calculation |
---|
| 71 | over all possible angles. |
---|
[19dcb933] | 72 | :num:`Figure #triaxial-ellipsoid-comparison` shows the comparison where |
---|
[5d4777d] | 73 | the solid dot refers to averaged 2D while the line represents the |
---|
| 74 | result of 1D calculation (for 2D averaging, 76, 180, and 76 points |
---|
| 75 | are taken for the angles of $\theta$, $\phi$, and $\psi$ respectively). |
---|
| 76 | |
---|
[19dcb933] | 77 | .. _triaxial-ellipsoid-comparison: |
---|
[5d4777d] | 78 | |
---|
[19dcb933] | 79 | .. figure:: img/triaxial_ellipsoid_comparison.png |
---|
[5d4777d] | 80 | |
---|
| 81 | Comparison between 1D and averaged 2D. |
---|
| 82 | |
---|
| 83 | Our model uses the form factor calculations implemented in a c-library provided by the NIST Center for Neutron Research |
---|
| 84 | (Kline, 2006) |
---|
| 85 | |
---|
| 86 | REFERENCE |
---|
| 87 | |
---|
| 88 | L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and Neutron Scattering*, Plenum, |
---|
| 89 | New York, 1987. |
---|
| 90 | """ |
---|
| 91 | |
---|
| 92 | from numpy import pi, inf |
---|
| 93 | |
---|
| 94 | name = "triaxial_ellipsoid" |
---|
| 95 | title = "Ellipsoid of uniform scattering length density with three independent axes." |
---|
| 96 | |
---|
| 97 | description = """\ |
---|
| 98 | Note: During fitting ensure that the inequality ra<rb<rc is not |
---|
| 99 | violated. Otherwise the calculation will |
---|
| 100 | not be correct. |
---|
| 101 | """ |
---|
| 102 | |
---|
| 103 | parameters = [ |
---|
| 104 | # [ "name", "units", default, [lower, upper], "type", |
---|
| 105 | # "description" ], |
---|
| 106 | [ "sld", "1e-6/Ang^2", 4, [-inf,inf], "", |
---|
| 107 | "Ellipsoid scattering length density" ], |
---|
| 108 | [ "solvent_sld", "1e-6/Ang^2", 1, [-inf,inf], "", |
---|
| 109 | "Solvent scattering length density" ], |
---|
| 110 | [ "req_minor", "Ang", 20, [0, inf], "volume", |
---|
| 111 | "Minor equitorial radius" ], |
---|
| 112 | [ "req_major", "Ang", 400, [0, inf], "volume", |
---|
| 113 | "Major equatorial radius" ], |
---|
| 114 | [ "rpolar", "Ang", 10, [0, inf], "volume", |
---|
| 115 | "Polar radius" ], |
---|
| 116 | [ "theta", "degrees", 60, [-inf, inf], "orientation", |
---|
| 117 | "In plane angle" ], |
---|
| 118 | [ "phi", "degrees", 60, [-inf, inf], "orientation", |
---|
| 119 | "Out of plane angle" ], |
---|
| 120 | [ "psi", "degrees", 60, [-inf, inf], "orientation", |
---|
| 121 | "Out of plane angle" ], |
---|
| 122 | ] |
---|
| 123 | |
---|
| 124 | source = [ "lib/J1.c", "lib/gauss76.c", "triaxial_ellipsoid.c"] |
---|
| 125 | |
---|
| 126 | def ER(req_minor, req_major, rpolar): |
---|
| 127 | import numpy as np |
---|
| 128 | from .ellipsoid import ER as ellipsoid_ER |
---|
| 129 | return ellipsoid_ER(rpolar, np.sqrt(req_minor*req_major)) |
---|
| 130 | |
---|