[5933c7f] | 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 \leq R_b \leq R_c$ |
---|
| 5 | **Users should maintain this inequality for all calculations**. |
---|
| 6 | |
---|
| 7 | .. math:: |
---|
| 8 | |
---|
| 9 | P(q) = \text{scale} V \left< F^2(q) \right> + \text{background} |
---|
| 10 | |
---|
| 11 | where the volume $V = 4/3 \pi R_a R_b R_c$, and the averaging |
---|
| 12 | $\left<\ldots\right>$ is applied over all orientations for 1D. |
---|
| 13 | |
---|
| 14 | .. figure:: img/triaxial_ellipsoid_geometry.jpg |
---|
| 15 | |
---|
| 16 | Ellipsoid schematic. |
---|
| 17 | |
---|
| 18 | Definition |
---|
| 19 | ---------- |
---|
| 20 | |
---|
| 21 | The form factor calculated is |
---|
| 22 | |
---|
| 23 | .. math:: |
---|
| 24 | |
---|
| 25 | P(q) = \frac{\text{scale}}{V}\int_0^1\int_0^1 |
---|
| 26 | \Phi^2(qR_a^2\cos^2( \pi x/2) + qR_b^2\sin^2(\pi y/2)(1-y^2) + R_c^2y^2) |
---|
| 27 | dx dy |
---|
| 28 | |
---|
| 29 | where |
---|
| 30 | |
---|
| 31 | .. math:: |
---|
| 32 | |
---|
| 33 | \Phi(u) = 3 u^{-3} (\sin u - u \cos u) |
---|
| 34 | |
---|
| 35 | To provide easy access to the orientation of the triaxial ellipsoid, |
---|
| 36 | we define the axis of the cylinder using the angles $\theta$, $\phi$ |
---|
| 37 | and $\psi$. These angles are defined on |
---|
| 38 | :numref:`figure #<triaxial-ellipsoid-angles>`. |
---|
| 39 | The angle $\psi$ is the rotational angle around its own $c$ axis |
---|
| 40 | against the $q$ plane. For example, $\psi = 0$ when the |
---|
| 41 | $a$ axis is parallel to the $x$ axis of the detector. |
---|
| 42 | |
---|
| 43 | .. _triaxial-ellipsoid-angles: |
---|
| 44 | |
---|
| 45 | .. figure:: img/triaxial_ellipsoid_angle_projection.jpg |
---|
| 46 | |
---|
| 47 | The angles for oriented ellipsoid. |
---|
| 48 | |
---|
| 49 | The radius-of-gyration for this system is $R_g^2 = (R_a R_b R_c)^2/5$. |
---|
| 50 | |
---|
| 51 | The contrast is defined as SLD(ellipsoid) - SLD(solvent). In the |
---|
| 52 | parameters, $R_a$ is the minor equatorial radius, $R_b$ is the major |
---|
| 53 | equatorial radius, and $R_c$ is the polar radius of the ellipsoid. |
---|
| 54 | |
---|
| 55 | NB: The 2nd virial coefficient of the triaxial solid ellipsoid is |
---|
| 56 | calculated based on the polar radius $R_p = R_c$ and equatorial |
---|
| 57 | radius $R_e = \sqrt{R_a R_b}$, and used as the effective radius for |
---|
| 58 | $S(q)$ when $P(q) \cdot S(q)$ is applied. |
---|
| 59 | |
---|
| 60 | Validation |
---|
| 61 | ---------- |
---|
| 62 | |
---|
| 63 | Validation of our code was done by comparing the output of the |
---|
| 64 | 1D calculation to the angular average of the output of 2D calculation |
---|
| 65 | over all possible angles. |
---|
| 66 | |
---|
| 67 | |
---|
| 68 | References |
---|
| 69 | ---------- |
---|
| 70 | |
---|
| 71 | L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray |
---|
| 72 | and Neutron Scattering*, Plenum, New York, 1987. |
---|
| 73 | """ |
---|
| 74 | |
---|
| 75 | from numpy import inf |
---|
| 76 | |
---|
| 77 | name = "triaxial_ellipsoid" |
---|
| 78 | title = "Ellipsoid of uniform scattering length density with three independent axes." |
---|
| 79 | |
---|
| 80 | description = """\ |
---|
| 81 | Note: During fitting ensure that the inequality ra<rb<rc is not |
---|
| 82 | violated. Otherwise the calculation will |
---|
| 83 | not be correct. |
---|
| 84 | """ |
---|
| 85 | category = "shape:ellipsoid" |
---|
| 86 | |
---|
| 87 | # ["name", "units", default, [lower, upper], "type","description"], |
---|
| 88 | parameters = [["sld", "1e-6/Ang^2", 4, [-inf, inf], "", |
---|
| 89 | "Ellipsoid scattering length density"], |
---|
| 90 | ["solvent_sld", "1e-6/Ang^2", 1, [-inf, inf], "", |
---|
| 91 | "Solvent scattering length density"], |
---|
| 92 | ["req_minor", "Ang", 20, [0, inf], "volume", |
---|
| 93 | "Minor equitorial radius"], |
---|
| 94 | ["req_major", "Ang", 400, [0, inf], "volume", |
---|
| 95 | "Major equatorial radius"], |
---|
| 96 | ["rpolar", "Ang", 10, [0, inf], "volume", |
---|
| 97 | "Polar radius"], |
---|
| 98 | ["theta", "degrees", 60, [-inf, inf], "orientation", |
---|
| 99 | "In plane angle"], |
---|
| 100 | ["phi", "degrees", 60, [-inf, inf], "orientation", |
---|
| 101 | "Out of plane angle"], |
---|
| 102 | ["psi", "degrees", 60, [-inf, inf], "orientation", |
---|
| 103 | "Out of plane angle"], |
---|
| 104 | ] |
---|
| 105 | |
---|
| 106 | source = ["lib/sph_j1c.c", "lib/gauss76.c", "triaxial_ellipsoid.c"] |
---|
| 107 | |
---|
| 108 | def ER(req_minor, req_major, rpolar): |
---|
| 109 | """ |
---|
| 110 | Returns the effective radius used in the S*P calculation |
---|
| 111 | """ |
---|
| 112 | import numpy as np |
---|
| 113 | from .ellipsoid import ER as ellipsoid_ER |
---|
| 114 | return ellipsoid_ER(rpolar, np.sqrt(req_minor * req_major)) |
---|
| 115 | |
---|
| 116 | demo = dict(scale=1, background=0, |
---|
| 117 | sld=6, solvent_sld=1, |
---|
| 118 | theta=30, phi=15, psi=5, |
---|
| 119 | req_minor=25, req_major=36, rpolar=50, |
---|
| 120 | req_minor_pd=0, req_minor_pd_n=1, |
---|
| 121 | req_major_pd=0, req_major_pd_n=1, |
---|
| 122 | rpolar_pd=.2, rpolar_pd_n=30, |
---|
| 123 | theta_pd=15, theta_pd_n=45, |
---|
| 124 | phi_pd=15, phi_pd_n=1, |
---|
| 125 | psi_pd=15, psi_pd_n=1) |
---|
| 126 | oldname = 'TriaxialEllipsoidModel' |
---|
| 127 | oldpars = dict(theta='axis_theta', phi='axis_phi', psi='axis_psi', |
---|
| 128 | sld='sldEll', solvent_sld='sldSolv', |
---|
| 129 | req_minor='semi_axisA', req_major='semi_axisB', |
---|
| 130 | rpolar='semi_axisC') |
---|