[c6ca41e] | 1 | r""" |
---|
| 2 | Definition |
---|
| 3 | ---------- |
---|
| 4 | |
---|
[5d23de2] | 5 | This model is a trivial extension of the core_shell_sphere function where the |
---|
| 6 | core is filled with solvent and is surrounded by $N$ shells of material |
---|
| 7 | (such as lipids) interleaved with $N - 1$ layers of solvent. For $N = 1$, this |
---|
| 8 | returns the same as the vesicle model, except for the normalisation, which here |
---|
| 9 | is to outermost volume. The shell thicknesses and SLD are constant for all |
---|
| 10 | shells as expected for a multilayer vesicle. |
---|
[c6ca41e] | 11 | |
---|
| 12 | .. figure:: img/multi_shell_geometry.jpg |
---|
| 13 | |
---|
| 14 | Geometry of the multilayer_vesicle model. |
---|
| 15 | |
---|
[9f60c06] | 16 | See the :ref:`core-shell-sphere` model for more documentation. |
---|
[c6ca41e] | 17 | |
---|
[041bc75] | 18 | The 1D scattering intensity is calculated in the following way (Guinier, 1955) |
---|
| 19 | |
---|
| 20 | .. math:: |
---|
[7e4a633] | 21 | P(q) = \text{scale} \cdot \frac{\phi}{V(R_N)} F^2(q) + \text{background} |
---|
[041bc75] | 22 | |
---|
| 23 | where |
---|
| 24 | |
---|
| 25 | .. math:: |
---|
[ec1d4bc] | 26 | F(q) = (\rho_\text{shell}-\rho_\text{solv}) \sum_{i=1}^{N} \left[ |
---|
| 27 | 3V(r_i)\frac{\sin(qr_i) - qr_i\cos(qr_i)}{(qr_i)^3} |
---|
| 28 | - 3V(R_i)\frac{\sin(qR_i) - qR_i\cos(qR_i)}{(qR_i)^3} |
---|
[041bc75] | 29 | \right] |
---|
| 30 | |
---|
[ec1d4bc] | 31 | for |
---|
[041bc75] | 32 | |
---|
[ec1d4bc] | 33 | .. math:: |
---|
| 34 | |
---|
[2e0c0b0] | 35 | r_i &= r_c + (i-1)(t_s + t_w) \text{ solvent radius before shell } i \\ |
---|
| 36 | R_i &= r_i + t_s \text{ shell radius for shell } i |
---|
[041bc75] | 37 | |
---|
[ec1d4bc] | 38 | $\phi$ is the volume fraction of particles, $V(r)$ is the volume of a sphere |
---|
| 39 | of radius $r$, $r_c$ is the radius of the core, $t_s$ is the thickness of |
---|
| 40 | the shell, $t_w$ is the thickness of the solvent layer between the shells, |
---|
| 41 | $\rho_\text{shell}$ is the scattering length density of a shell, and |
---|
| 42 | $\rho_\text{solv}$ is the scattering length density of the solvent. |
---|
[041bc75] | 43 | |
---|
[5d23de2] | 44 | USAGE NOTES |
---|
[041bc75] | 45 | |
---|
[5d23de2] | 46 | * The outer-most shell radius $R_N$ is used as the effective radius |
---|
| 47 | for $P(Q)$ when $P(Q) * S(Q)$ is applied. |
---|
| 48 | calculations rather slow. |
---|
| 49 | * The number of shells is always rounded to an integer value as a non interger |
---|
| 50 | number of layers is not physical. |
---|
| 51 | * Thus Polydispersity should only be applied to number of shells **VERY |
---|
| 52 | CAREFULLY**. A possible legitimate use would be for mixed systems in which |
---|
| 53 | some vesicles have 1 shell, some have 2, etc. A polydispersity on $N$ can be |
---|
| 54 | used to model the data by using the "array distriubtion" feature. First |
---|
| 55 | create a file such as *shell_dist.txt* containing the relative portion |
---|
| 56 | of each vesicle size:: |
---|
[68f45cb] | 57 | |
---|
| 58 | 1 20 |
---|
| 59 | 2 4 |
---|
| 60 | 3 1 |
---|
| 61 | |
---|
[5d23de2] | 62 | Turn on polydispersity and select an array distribution for the *n_shells* |
---|
| 63 | parameter. Choose the above *shell_dist.txt* file, and the model will be |
---|
| 64 | computed with 80% 1-shell vesicles, 16% 2-shell vesicles and 4% |
---|
| 65 | 3-shell vesicles. |
---|
| 66 | * This is a highly non-linear, highly oscillatory (especially around the |
---|
| 67 | q-values that correspond to the repeat distance of the layers), model |
---|
| 68 | function complicated by the fact that the number of water/shell pairs must |
---|
| 69 | physically be an integer value, although the optimization treats it as a |
---|
| 70 | floating point value. Thus it may be that the resolution interpolation is not |
---|
| 71 | sufficiently fine grained in certain cases. Please report any such occurences |
---|
| 72 | to the SasView team. Generally, for the best possible experience: |
---|
[870a2f4] | 73 | |
---|
| 74 | - Start with the best possible guess |
---|
| 75 | - Using a priori knowledge, hold as many parameters fixed as possible |
---|
| 76 | - if N=1, tw (water thickness) must by definition be zero. Both N and tw should |
---|
[5d23de2] | 77 | be fixed during fitting. |
---|
[870a2f4] | 78 | - If N>1, use constraints to keep N > 1 |
---|
| 79 | - Because N only really moves in integer steps, it may get "stuck" if the |
---|
[5d23de2] | 80 | optimizer step size is too small so care should be taken |
---|
| 81 | If you experience problems with this please contact the SasView team and let |
---|
| 82 | them know the issue preferably with example data and model which fail to |
---|
| 83 | converge. |
---|
[041bc75] | 84 | |
---|
[c6ca41e] | 85 | The 2D scattering intensity is the same as 1D, regardless of the orientation |
---|
| 86 | of the q vector which is defined as: |
---|
| 87 | |
---|
| 88 | .. math:: |
---|
| 89 | |
---|
| 90 | q = \sqrt{q_x^2 + q_y^2} |
---|
| 91 | |
---|
[40a87fa] | 92 | For information about polarised and magnetic scattering, see |
---|
[9a4811a] | 93 | the :ref:`magnetism` documentation. |
---|
[c6ca41e] | 94 | |
---|
| 95 | References |
---|
| 96 | ---------- |
---|
| 97 | |
---|
[5d23de2] | 98 | .. [#] B Cabane, *Small Angle Scattering Methods*, in *Surfactant Solutions: |
---|
| 99 | New Methods of Investigation*, Ch.2, Surfactant Science Series Vol. 22, Ed. |
---|
| 100 | R Zana and M Dekker, New York, (1987). |
---|
[c6ca41e] | 101 | |
---|
[5d23de2] | 102 | Authorship and Verification |
---|
| 103 | ---------------------------- |
---|
[c6ca41e] | 104 | |
---|
[5d23de2] | 105 | * **Author:** NIST IGOR/DANSE **Date:** pre 2010 |
---|
| 106 | * **Converted to sasmodels by:** Piotr Rozyczko **Date:** Feb 24, 2016 |
---|
| 107 | * **Last Modified by:** Paul Kienzle **Date:** Feb 7, 2017 |
---|
| 108 | * **Last Reviewed by:** Paul Butler **Date:** March 12, 2017 |
---|
[c6ca41e] | 109 | """ |
---|
| 110 | |
---|
[2d81cfe] | 111 | import numpy as np |
---|
[c6ca41e] | 112 | from numpy import inf |
---|
| 113 | |
---|
| 114 | name = "multilayer_vesicle" |
---|
| 115 | title = "P(Q) for a Multi-lamellar vesicle" |
---|
| 116 | description = """ |
---|
| 117 | multilayer_vesicle model parameters; |
---|
| 118 | scale : scale factor for abs intensity if needed else 1.0 |
---|
| 119 | volfraction: volume fraction |
---|
| 120 | radius : Core radius of the multishell |
---|
| 121 | thick_shell: shell thickness |
---|
| 122 | thick_solvent: water thickness |
---|
| 123 | sld_solvent: solvent scattering length density |
---|
| 124 | sld: shell scattering length density |
---|
[ec1d4bc] | 125 | n_shells:number of "shell plus solvent" layer pairs |
---|
[c6ca41e] | 126 | background: incoherent background |
---|
| 127 | """ |
---|
| 128 | category = "shape:sphere" |
---|
| 129 | |
---|
| 130 | # pylint: disable=bad-whitespace, line-too-long |
---|
| 131 | # ["name", "units", default, [lower, upper], "type","description"], |
---|
| 132 | parameters = [ |
---|
| 133 | ["volfraction", "", 0.05, [0.0, 1], "", "volume fraction of vesicles"], |
---|
[ec1d4bc] | 134 | ["radius", "Ang", 60.0, [0.0, inf], "volume", "radius of solvent filled core"], |
---|
| 135 | ["thick_shell", "Ang", 10.0, [0.0, inf], "volume", "thickness of one shell"], |
---|
| 136 | ["thick_solvent", "Ang", 10.0, [0.0, inf], "volume", "solvent thickness between shells"], |
---|
[e77872e] | 137 | ["sld_solvent", "1e-6/Ang^2", 6.4, [-inf, inf], "sld", "solvent scattering length density"], |
---|
[42356c8] | 138 | ["sld", "1e-6/Ang^2", 0.4, [-inf, inf], "sld", "Shell scattering length density"], |
---|
[ec1d4bc] | 139 | ["n_shells", "", 2.0, [1.0, inf], "volume", "Number of shell plus solvent layer pairs"], |
---|
[c6ca41e] | 140 | ] |
---|
| 141 | # pylint: enable=bad-whitespace, line-too-long |
---|
| 142 | |
---|
[7e4a633] | 143 | # TODO: proposed syntax for specifying which parameters can be polydisperse |
---|
| 144 | #polydispersity = ["radius", "thick_shell"] |
---|
| 145 | |
---|
[925ad6e] | 146 | source = ["lib/sas_3j1x_x.c", "multilayer_vesicle.c"] |
---|
[71b751d] | 147 | have_Fq = True |
---|
[d277229] | 148 | effective_radius_type = ["outer radius"] |
---|
[c6ca41e] | 149 | |
---|
[8f04da4] | 150 | def random(): |
---|
| 151 | volfraction = 10**np.random.uniform(-3, -0.5) # scale from 0.1% to 30% |
---|
| 152 | radius = 10**np.random.uniform(0, 2.5) # core less than 300 A |
---|
| 153 | total_thick = 10**np.random.uniform(2, 4) # up to 10000 A of shells |
---|
| 154 | # random number of shells, with shell+solvent thickness > 10 A |
---|
| 155 | n_shells = int(10**np.random.uniform(0, np.log10(total_thick)-1)+0.5) |
---|
| 156 | # split total shell thickness with preference for shell over solvent; |
---|
| 157 | # make sure that shell thickness is at least 1 A |
---|
| 158 | one_thick = total_thick/n_shells |
---|
| 159 | thick_solvent = 10**np.random.uniform(-2, 0)*(one_thick - 1) |
---|
| 160 | thick_shell = one_thick - thick_solvent |
---|
| 161 | pars = dict( |
---|
| 162 | scale=1, |
---|
| 163 | volfraction=volfraction, |
---|
| 164 | radius=radius, |
---|
| 165 | thick_shell=thick_shell, |
---|
| 166 | thick_solvent=thick_solvent, |
---|
| 167 | n_shells=n_shells, |
---|
| 168 | ) |
---|
| 169 | return pars |
---|
[c6ca41e] | 170 | |
---|
| 171 | tests = [ |
---|
| 172 | # Accuracy tests based on content in test/utest_other_models.py |
---|
| 173 | [{'radius': 60.0, |
---|
| 174 | 'thick_shell': 10.0, |
---|
| 175 | 'thick_solvent': 10.0, |
---|
| 176 | 'sld_solvent': 6.4, |
---|
| 177 | 'sld': 0.4, |
---|
[ec1d4bc] | 178 | 'n_shells': 2.0, |
---|
[c6ca41e] | 179 | 'scale': 1.0, |
---|
| 180 | 'background': 0.001, |
---|
| 181 | }, 0.001, 122.1405], |
---|
| 182 | |
---|
| 183 | [{'volfraction': 1.0, |
---|
| 184 | 'radius': 60.0, |
---|
| 185 | 'thick_shell': 10.0, |
---|
| 186 | 'thick_solvent': 10.0, |
---|
| 187 | 'sld_solvent': 6.4, |
---|
| 188 | 'sld': 0.4, |
---|
[ec1d4bc] | 189 | 'n_shells': 2.0, |
---|
[c6ca41e] | 190 | 'scale': 1.0, |
---|
| 191 | 'background': 0.001, |
---|
| 192 | }, (0.001, 0.30903), 1.61873], |
---|
| 193 | ] |
---|