Changeset 745b7bb in sasmodels for sasmodels/models/spherical_sld.py
- Timestamp:
- Aug 4, 2016 9:32:17 PM (8 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 4e0968b
- Parents:
- 54bcd4a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/spherical_sld.py
r54bcd4a r745b7bb 1 1 r""" 2 This model calculates an empirical functional form for SAS data using 3 SpericalSLD profile 4 5 Similarly to the OnionExpShellModel, this model provides the form factor, 6 P(q), for a multi-shell sphere, where the interface between the each neighboring 7 shells can be described by one of a number of functions including error, 8 power-law, and exponential functions. 9 This model is to calculate the scattering intensity by building a continuous 10 custom SLD profile against the radius of the particle. 11 The SLD profile is composed of a flat core, a flat solvent, a number (up to 9 ) 12 flat shells, and the interfacial layers between the adjacent flat shells 13 (or core, and solvent) (see below). 14 15 .. figure:: img/spherical_sld_profile.gif 16 17 Exemplary SLD profile 2 Similarly to the onion, this model provides the form factor, $P(q)$, for 3 a multi-shell sphere, where the interface between the each neighboring 4 shells can be described by the error function, power-law, or exponential 5 functions. The scattering intensity is computed by building a continuous 6 custom SLD profile along the radius of the particle. The SLD profile is 7 composed of a number of uniform shells with interfacial shells between them. 8 9 .. figure:: img/spherical_sld_profile.png 10 11 Example SLD profile 18 12 19 13 Unlike the <onion> model (using an analytical integration), the interfacial 20 layers here are sub-divided and numerically integrated assuming each of the 21 sub-layers are described by a line function. 22 The number of the sub-layer can be given by users by setting the integer values 23 of npts_inter. The form factor is normalized by the total volume of the sphere. 14 shells here are sub-divided and numerically integrated assuming each 15 sub-shell is described by a line function, with *n_steps* sub-shells per 16 interface. The form factor is normalized by the total volume of the sphere. 24 17 25 18 Definition … … 42 35 43 36 44 so that individual terms can be calcu alted as follows:37 so that individual terms can be calculated as follows: 45 38 46 39 .. math:: … … 72 65 73 66 74 Here we assumed that the SLDs of the core and solvent are constant against$r$.67 Here we assumed that the SLDs of the core and solvent are constant in $r$. 75 68 The SLD at the interface between shells, $\rho_{\text {inter}_i}$ 76 69 is calculated with a function chosen by an user, where the functions are … … 107 100 The functions are normalized so that they vary between 0 and 1, and they are 108 101 constrained such that the SLD is continuous at the boundaries of the interface 109 as well as each sub- layers. Thus B and C are determined.110 111 Once $\rho_{\text{inter}_i}$ is found at the boundary of the sub- layerof the102 as well as each sub-shell. Thus B and C are determined. 103 104 Once $\rho_{\text{inter}_i}$ is found at the boundary of the sub-shell of the 112 105 interface, we can find its contribution to the form factor $P(q)$ 113 106 … … 121 114 4 \pi \sum_{j=0}^{npts_{\text{inter}_i} -1 } \Big[ 122 115 3 ( \rho_{ \text{inter}_i } ( r_{j+1} ) - \rho_{ \text{inter}_i } 123 ( r_{j} ) V ( r_{ \text{sub layer}_j } )116 ( r_{j} ) V ( r_{ \text{subshell}_j } ) 124 117 \Big[ \frac {r_j^2 \beta_\text{out}^2 \sin(\beta_\text{out}) 125 118 - (\beta_\text{out}^2-2) \cos(\beta_\text{out}) } … … 127 120 128 121 - 3 ( \rho_{ \text{inter}_i } ( r_{j+1} ) - \rho_{ \text{inter}_i } 129 ( r_{j} ) V ( r_{ \text{sub layer}_j-1 } )122 ( r_{j} ) V ( r_{ \text{subshell}_j-1 } ) 130 123 \Big[ \frac {r_{j-1}^2 \sin(\beta_\text{in}) 131 124 - (\beta_\text{in}^2-2) \cos(\beta_\text{in}) } … … 152 145 153 146 154 We assume the $\rho_{\text{inter}_i} (r)$ can beapproximately linear155 within a sub-layer $j$156 157 Finally form factor can be calculated by147 We assume $\rho_{\text{inter}_j} (r)$ is approximately linear 148 within the sub-shell $j$. 149 150 Finally the form factor can be calculated by 158 151 159 152 .. math:: … … 169 162 q = \sqrt{q_x^2 + q_y^2} 170 163 171 172 .. figure:: img/spherical_sld_1d.jpg173 174 1D plot using the default values (w/400 data point).175 176 .. figure:: img/spherical_sld_default_profile.jpg177 178 SLD profile from the default values.179 180 164 .. note:: 165 181 166 The outer most radius is used as the effective radius for S(Q) 182 167 when $P(Q) * S(Q)$ is applied. … … 206 191 # pylint: disable=bad-whitespace, line-too-long 207 192 # ["name", "units", default, [lower, upper], "type", "description"], 208 parameters = [["n_shells", "", 1, [1, 1 1], "volume", "number of shells"],193 parameters = [["n_shells", "", 1, [1, 10], "volume", "number of shells"], 209 194 ["sld_solvent", "1e-6/Ang^2", 1.0, [-inf, inf], "sld", "solvent sld"], 210 195 ["sld[n_shells]", "1e-6/Ang^2", 4.06, [-inf, inf], "sld", "sld of the shell"], … … 258 243 rho.append(sld_solvent) 259 244 # return sld profile (r, beta) 260 return np.asarray(z), np.asarray(rho) *1e-6245 return np.asarray(z), np.asarray(rho) 261 246 262 247
Note: See TracChangeset
for help on using the changeset viewer.