Changes in sasmodels/models/multilayer_vesicle.py [925ad6e:5d23de2] in sasmodels
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/multilayer_vesicle.py
r925ad6e r5d23de2 3 3 ---------- 4 4 5 This model is a trivial extension of the core_shell_sphere function to include6 *N* shells where the core is filled with solvent and the shells are interleaved 7 with layers of solvent. For *N = 1*, this returns the same as the vesicle model, 8 except for the normalisation, which here is to outermost volume. 9 The shell thicknessess and SLD are constant for all shells as expected for 10 a multilayer vesicle.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. 11 11 12 12 .. figure:: img/multi_shell_geometry.jpg … … 19 19 20 20 .. math:: 21 22 P(q) = \frac{\text{scale.volfraction}}{V_t} F^2(q) + \text{background} 21 P(q) = \text{scale} \cdot \frac{\phi}{V(R_N)} F^2(q) + \text{background} 23 22 24 23 where 25 24 26 25 .. math:: 27 28 F(q) = (\rho_{shell}-\rho_{solv}) \sum_{i=1}^{n\_pairs} \left[ 29 3V(R_i)\frac{\sin(qR_i)-qR_i\cos(qR_i)}{(qR_i)^3} \\ 30 - 3V(R_i+t_s)\frac{\sin(q(R_i+t_s))-q(R_i+t_s)\cos(q(R_i+t_s))}{(q(R_i+t_s))^3} 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} 31 29 \right] 32 30 31 for 33 32 34 where $R_i = r_c + (i-1)(t_s + t_w)$ 35 36 where $V_t$ is the volume of the whole particle, $V(R)$ is the volume of a sphere 37 of radius $R$, $r_c$ is the radius of the core, $\rho_{shell}$ is the scattering length 38 density of a shell, $\rho_{solv}$ is the scattering length density of the solvent. 33 .. math:: 39 34 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 37 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. 43 44 USAGE NOTES 45 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:: 57 58 1 20 59 2 4 60 3 1 61 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: 73 * Start with the best possible guess 74 * Using a priori knowledge, hold as many parameters fixed as possible 75 * if N=1, tw (water thickness) must by definition be zero. Both N and tw should 76 be fixed during fitting. 77 * If N>1, use constraints to keep N > 1 78 * Because N only really moves in integer steps, it may get "stuck" if the 79 optimizer step size is too small so care should be taken 80 If you experience problems with this please contact the SasView team and let 81 them know the issue preferably with example data and model which fail to 82 converge. 40 83 41 84 The 2D scattering intensity is the same as 1D, regardless of the orientation … … 46 89 q = \sqrt{q_x^2 + q_y^2} 47 90 48 49 The outer most radius50 51 $radius + n\_pairs * thick\_shell + (n\_pairs- 1) * thick\_solvent$52 53 is used for both the volume fraction normalization and for the54 effective radius for *S(Q)* when $P(Q) * S(Q)$ is applied.55 56 91 For information about polarised and magnetic scattering, see 57 92 the :ref:`magnetism` documentation. 58 59 This code is based on the form factor calculations implemented in the NIST60 Center for Neutron Research provided c-library (Kline, 2006).61 93 62 94 References 63 95 ---------- 64 96 65 B Cabane, *Small Angle Scattering Methods*, 66 in *Surfactant Solutions: New Methods of Investigation*, 67 Ch.2, Surfactant Science Series Vol. 22, Ed. R Zana and M Dekker, 68 New York, (1987). 97 .. [#] B Cabane, *Small Angle Scattering Methods*, in *Surfactant Solutions: 98 New Methods of Investigation*, Ch.2, Surfactant Science Series Vol. 22, Ed. 99 R Zana and M Dekker, New York, (1987). 69 100 70 **Author:** NIST IGOR/DANSE **on:** pre 2010 101 Authorship and Verification 102 ---------------------------- 71 103 72 **Last Modified by:** Piotr Rozyczko**on:** Feb 24, 2016 73 74 **Last Reviewed by:** Paul Butler **on:** March 20, 2016 104 * **Author:** NIST IGOR/DANSE **Date:** pre 2010 105 * **Converted to sasmodels by:** Piotr Rozyczko **Date:** Feb 24, 2016 106 * **Last Modified by:** Paul Kienzle **Date:** Feb 7, 2017 107 * **Last Reviewed by:** Paul Butler **Date:** March 12, 2017 75 108 76 109 """ … … 89 122 sld_solvent: solvent scattering length density 90 123 sld: shell scattering length density 91 n_ pairs:number of "shell plus solvent" layer pairs124 n_shells:number of "shell plus solvent" layer pairs 92 125 background: incoherent background 93 126 """ … … 98 131 parameters = [ 99 132 ["volfraction", "", 0.05, [0.0, 1], "", "volume fraction of vesicles"], 100 ["radius", "Ang", 60.0, [0.0, inf], " ", "radius of solvent filled core"],101 ["thick_shell", "Ang", 10.0, [0.0, inf], " ", "thickness of one shell"],102 ["thick_solvent", "Ang", 10.0, [0.0, inf], " ", "solvent thickness between shells"],133 ["radius", "Ang", 60.0, [0.0, inf], "volume", "radius of solvent filled core"], 134 ["thick_shell", "Ang", 10.0, [0.0, inf], "volume", "thickness of one shell"], 135 ["thick_solvent", "Ang", 10.0, [0.0, inf], "volume", "solvent thickness between shells"], 103 136 ["sld_solvent", "1e-6/Ang^2", 6.4, [-inf, inf], "sld", "solvent scattering length density"], 104 137 ["sld", "1e-6/Ang^2", 0.4, [-inf, inf], "sld", "Shell scattering length density"], 105 ["n_ pairs", "", 2.0, [1.0, inf], "", "Number of shell plus solvent layer pairs"],138 ["n_shells", "", 2.0, [1.0, inf], "volume", "Number of shell plus solvent layer pairs"], 106 139 ] 107 140 # pylint: enable=bad-whitespace, line-too-long 108 141 142 # TODO: proposed syntax for specifying which parameters can be polydisperse 143 #polydispersity = ["radius", "thick_shell"] 144 109 145 source = ["lib/sas_3j1x_x.c", "multilayer_vesicle.c"] 110 146 111 polydispersity = ["radius", "n_pairs"] 147 def ER(radius, thick_shell, thick_solvent, n_shells): 148 n_shells = int(n_shells+0.5) 149 return radius + n_shells * (thick_shell + thick_solvent) - thick_solvent 112 150 113 151 demo = dict(scale=1, background=0, … … 118 156 sld_solvent=6.4, 119 157 sld=0.4, 120 n_ pairs=2.0)158 n_shells=2.0) 121 159 122 160 tests = [ … … 127 165 'sld_solvent': 6.4, 128 166 'sld': 0.4, 129 'n_ pairs': 2.0,167 'n_shells': 2.0, 130 168 'scale': 1.0, 131 169 'background': 0.001, … … 138 176 'sld_solvent': 6.4, 139 177 'sld': 0.4, 140 'n_ pairs': 2.0,178 'n_shells': 2.0, 141 179 'scale': 1.0, 142 180 'background': 0.001,
Note: See TracChangeset
for help on using the changeset viewer.