source: sasmodels/sasmodels/models/raspberry.py @ 2d81cfe

core_shell_microgelsmagnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 2d81cfe was 2d81cfe, checked in by Paul Kienzle <pkienzle@…>, 6 years ago

lint

  • Property mode set to 100644
File size: 7.2 KB
Line 
1r"""
2Definition
3----------
4
5The figure below shows a schematic of a large droplet surrounded by several
6smaller particles forming a structure similar to that of Pickering emulsions.
7
8.. figure:: img/raspberry_geometry.jpg
9
10    Schematic of the raspberry model
11
12In order to calculate the form factor of the entire complex, the
13self-correlation of the large droplet, the self-correlation of the particles,
14the correlation terms between different particles and the cross terms between
15large droplet and small particles all need to be calculated.
16
17Consider two infinitely thin shells of radii $R_1$ and $R_2$ separated by
18distance $r$. The general structure of the equation is then the form factor
19of the two shells multiplied by the phase factor that accounts for the
20separation of their centers.
21
22.. math::
23
24    S(q) = \frac{\sin(qR_1)}{qR_1}\frac{\sin(qR_2)}{qR_2}\frac{\sin(qr)}{qr}
25
26In this case, the large droplet and small particles are solid spheres rather
27than thin shells. Thus the two terms must be integrated over $R_L$ and $R_S$
28respectively using the weighting function of a sphere. We then obtain the
29functions for the form of the two spheres:
30
31.. math::
32
33    \Psi_L = \int_0^{R_L}(4\pi R^2_L)\frac{\sin(qR_L)}{qR_L}dR_L =
34    \frac{3[\sin(qR_L)-qR_L\cos(qR_L)]}{(qR_L)^2}
35
36.. math::
37
38    \Psi_S = \int_0^{R_S}(4\pi R^2_S)\frac{\sin(qR_S)}{qR_S}dR_S =
39    \frac{3[\sin(qR_S)-qR_L\cos(qR_S)]}{(qR_S)^2}
40
41The cross term between the large droplet and small particles is given by:
42
43.. math::
44    S_{LS} = \Psi_L\Psi_S\frac{\sin(q(R_L+\delta R_S))}{q(R_L+\delta\ R_S)}
45
46and the self term between small particles is given by:
47
48.. math::
49    S_{SS} = \Psi_S^2\biggl[\frac{\sin(q(R_L+\delta R_S))}{q(R_L+\delta\ R_S)}
50    \biggr]^2
51
52The number of small particles per large droplet, $N_p$, is given by:
53
54.. math::
55
56    N_p = \frac{\phi_S\phi_\text{surface}V_L}{\phi_L V_S}
57
58where $\phi_S$ is the volume fraction of small particles in the sample,
59$\phi_\text{surface}$ is the fraction of the small particles that are adsorbed
60to the large droplets, $\phi_L$ is the volume fraction of large droplets in the
61sample, and $V_S$ and $V_L$ are the volumes of individual small particles and
62large droplets respectively.
63
64The form factor of the entire complex can now be calculated including the excess
65scattering length densities of the components $\Delta\rho_L$ and $\Delta\rho_S$,
66where $\Delta\rho_x = \left|\rho_x-\rho_\text{solvent}\right|$ :
67
68.. math::
69
70    P_{LS} = \frac{1}{M^2}\bigl[(\Delta\rho_L)^2V_L^2\Psi_L^2
71                +N_p(\Delta\rho_S)^2V_S^2\Psi_S^2
72                + N_p(1-N_p)(\Delta\rho_S)^2V_S^2S_{SS}
73                + 2N_p\Delta\rho_L\Delta\rho_SV_LV_SS_{LS}\bigr]
74
75where M is the total scattering length of the whole complex :
76
77.. math::
78    M = \Delta\rho_LV_L + N_p\Delta\rho_SV_S
79
80In a real system, there will ususally be an excess of small particles such that
81some fraction remain unbound. Therefore the overall scattering intensity is
82given by:
83
84.. math::
85    I(Q) = I_{LS}(Q) + I_S(Q) = (\phi_L(\Delta\rho_L)^2V_L +
86            \phi_S\phi_\text{surface}N_p(\Delta\rho_S)^2V_S)P_{LS}
87            + \phi_S(1-\phi_\text{surface})(\Delta\rho_S)^2V_S\Psi_S^2
88
89A useful parameter to extract is the fraction of the surface area of the large
90droplets that is covered by small particles. This can be calculated from the
91model parameters as:
92
93.. math::
94    \chi = \frac{4\phi_L\phi_\text{surface}(R_L+\delta R_S)}{\phi_LR_S}
95
96
97References
98----------
99
100K Larson-Smith, A Jackson, and D C Pozzo, *Small angle scattering model for
101Pickering emulsions and raspberry particles*, *Journal of Colloid and Interface
102Science*, 343(1) (2010) 36-41
103
104**Author:** Andrew Jackson **on:** 2008
105
106**Modified by:** Andrew Jackson **on:** March 20, 2016
107
108**Reviewed by:** Andrew Jackson **on:** March 20, 2016
109"""
110
111import numpy as np
112from numpy import inf
113
114name = "raspberry"
115title = "Calculates the form factor, *P(q)*, for a 'Raspberry-like' structure \
116where there are smaller spheres at the surface of a larger sphere, such as the \
117structure of a Pickering emulsion."
118description = """
119                RaspBerryModel:
120                volfraction_lg = volume fraction large spheres
121                radius_lg = radius large sphere (A)
122                sld_lg = sld large sphere (A-2)
123                volfraction_sm = volume fraction small spheres
124                radius_sm = radius small sphere (A)
125                surface_fraction = fraction of small spheres at surface
126                sld_sm = sld small sphere
127                penetration = small sphere penetration (A)
128                sld_solvent   = sld solvent
129                background = background (cm-1)
130            Ref: J. coll. inter. sci. (2010) vol. 343 (1) pp. 36-41."""
131category = "shape:sphere"
132
133
134#             [ "name", "units", default, [lower, upper], "type", "description"],
135parameters = [["sld_lg", "1e-6/Ang^2", -0.4, [-inf, inf], "sld",
136               "large particle scattering length density"],
137              ["sld_sm", "1e-6/Ang^2", 3.5, [-inf, inf], "sld",
138               "small particle scattering length density"],
139              ["sld_solvent", "1e-6/Ang^2", 6.36, [-inf, inf], "sld",
140               "solvent scattering length density"],
141              ["volfraction_lg", "", 0.05, [-inf, inf], "",
142               "volume fraction of large spheres"],
143              ["volfraction_sm", "", 0.005, [-inf, inf], "",
144               "volume fraction of small spheres"],
145              ["surface_fraction", "", 0.4, [-inf, inf], "",
146               "fraction of small spheres at surface"],
147              ["radius_lg", "Ang", 5000, [0, inf], "volume",
148               "radius of large spheres"],
149              ["radius_sm", "Ang", 100, [0, inf], "",
150               "radius of small spheres"],
151              ["penetration", "Ang", 0, [-1, 1], "",
152               "fractional penetration depth of small spheres into large sphere"],
153             ]
154
155source = ["lib/sas_3j1x_x.c", "raspberry.c"]
156
157def random():
158    # Limit volume fraction to 20% each
159    volfraction_lg = 10**np.random.uniform(-3, -0.3)
160    volfraction_sm = 10**np.random.uniform(-3, -0.3)
161    # Prefer most particles attached (peak near 60%), but not all or none
162    surface_fraction = np.random.beta(6, 4)
163    radius_lg = 10**np.random.uniform(1.7, 4.7)  # 500 - 50000 A
164    radius_sm = 10**np.random.uniform(-3, -0.3)*radius_lg  # 0.1% - 20%
165    penetration = np.random.beta(1, 10) # up to 20% pen. for 90% of examples
166    pars = dict(
167        volfraction_lg=volfraction_lg,
168        volfraction_sm=volfraction_sm,
169        surface_fraction=surface_fraction,
170        radius_lg=radius_lg,
171        radius_sm=radius_sm,
172        penetration=penetration,
173    )
174    return pars
175
176# parameters for demo
177demo = dict(scale=1, background=0.001,
178            sld_lg=-0.4, sld_sm=3.5, sld_solvent=6.36,
179            volfraction_lg=0.05, volfraction_sm=0.005, surface_fraction=0.4,
180            radius_lg=5000, radius_sm=100, penetration=0.0,
181            radius_lg_pd=.2, radius_lg_pd_n=10)
182
183# TODO: update tests so the parameters correspond to SasView parameters
184# The model was re-parameterized so the results have changed.
185# NOTE: test results taken from values returned by SasView 3.1.2, with
186# 0.001 added for a non-zero default background.
187#tests = [[{}, 0.0412755102041, 0.286669115234],
188#         [{}, 0.5, 0.00103818393658],
189#        ]
Note: See TracBrowser for help on using the repository browser.