source: sasmodels/sasmodels/models/core_multi_shell.py @ b0c4271

core_shell_microgelscostrafo411magnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since b0c4271 was b0c4271, checked in by butler, 7 years ago

model documentation final format through core_shell_bicelle re: #646

  • Property mode set to 100644
File size: 4.4 KB
Line 
1r"""
2Definition
3----------
4
5This model is a trivial extension of the CoreShell function to a larger number
6of shells. The scattering length density profile for the default sld values
7(w/ 4 shells).
8
9.. figure:: img/core_multi_shell_sld_default_profile.jpg
10
11    SLD profile of the core_multi_shell object from the center of sphere out
12    for the default SLDs.*
13
14The 2D scattering intensity is the same as $P(q)$ above, regardless of the
15orientation of the $q$ vector which is defined as
16
17.. math::
18
19    q = \sqrt{q_x^2 + q_y^2}
20
21.. note:: **Be careful!** The SLDs and scale can be highly correlated. Hold as
22         many of these parameters fixed as possible.
23
24.. note:: The outer most radius (= *radius* + *thickness*) is used as the
25          effective radius for $S(Q)$ when $P(Q)*S(Q)$ is applied.
26
27For information about polarised and magnetic scattering, see
28the :ref:`magnetism` documentation.
29
30Our model uses the form factor calculations implemented in a c-library provided
31by the NIST Center for Neutron Research (Kline, 2006).
32
33References
34----------
35
36.. [#] See the :ref:`core-shell-sphere` model documentation.
37.. [#] L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and Neutron Scattering*,
38   Plenum Press, New York, 1987.
39
40Authorship and Verification
41----------------------------
42
43* **Author:** NIST IGOR/DANSE **Date:** pre 2010
44* **Last Modified by:** Paul Kienzle **Date:** September 12, 2016
45* **Last Reviewed by:** Under Review **Date:** as of October 5, 2016
46"""
47
48
49
50from __future__ import division
51
52import numpy as np
53from numpy import inf
54
55name = "core_multi_shell"
56title = "This model provides the scattering from a spherical core with 1 to 4 \
57 concentric shell structures. The SLDs of the core and each shell are \
58 individually specified."
59
60description = """\
61Form factor for a core muti-shell (up to 4) sphere normalized by the volume.
62Each shell can have a unique thickness and sld.
63
64        background:background,
65        rad_core0: radius of sphere(core)
66        thick_shell#:the thickness of the shell#
67        sld_core0: the SLD of the sphere
68        sld_solv: the SLD of the solvent
69        sld_shell: the SLD of the shell#
70        A_shell#: the coefficient in the exponential function
71       
72       
73    scale: 1.0 if data is on absolute scale
74    volfraction: volume fraction of spheres
75    radius: the radius of the core
76    sld: the SLD of the core
77    thick_shelli: the thickness of the i'th shell from the core
78    sld_shelli: the SLD of the i'th shell from the core
79    sld_solvent: the SLD of the solvent
80    background: incoherent background
81
82"""
83
84category = "shape:sphere"
85
86
87#             ["name", "units", default, [lower, upper], "type","description"],
88parameters = [["sld_core", "1e-6/Ang^2", 1.0, [-inf, inf], "sld",
89               "Core scattering length density"],
90              ["radius", "Ang", 200., [0, inf], "volume",
91               "Radius of the core"],
92              ["sld_solvent", "1e-6/Ang^2", 6.4, [-inf, inf], "sld",
93               "Solvent scattering length density"],
94              ["n", "", 1, [0, 10], "volume",
95               "number of shells"],
96              ["sld[n]", "1e-6/Ang^2", 1.7, [-inf, inf], "sld",
97               "scattering length density of shell k"],
98              ["thickness[n]", "Ang", 40., [0, inf], "volume",
99               "Thickness of shell k"],
100             ]
101
102source = ["lib/sph_j1c.c", "core_multi_shell.c"]
103
104def profile(sld_core, radius, sld_solvent, n, sld, thickness):
105    """
106    Returns the SLD profile *r* (Ang), and *rho* (1e-6/Ang^2).
107    """
108    z = []
109    rho = []
110
111    # add in the core
112    z.append(0)
113    rho.append(sld_core)
114    z.append(radius)
115    rho.append(sld_core)
116
117    # add in the shells
118    for k in range(int(n)):
119        # Left side of each shells
120        z.append(z[-1])
121        rho.append(sld[k])
122        z.append(z[-1] + thickness[k])
123        rho.append(sld[k])
124    # add in the solvent
125    z.append(z[-1])
126    rho.append(sld_solvent)
127    z.append(z[-1]*1.25)
128    rho.append(sld_solvent)
129
130    return np.asarray(z), np.asarray(rho)
131
132def ER(radius, n, thickness):
133    """Effective radius"""
134    n = int(n[0])  # n cannot be polydisperse
135    return np.sum(thickness[:n], axis=0) + radius
136
137demo = dict(sld_core=6.4,
138            radius=60,
139            sld_solvent=6.4,
140            n=2,
141            sld=[2.0, 3.0],
142            thickness=20,
143            thickness1_pd=0.3,
144            thickness2_pd=0.3,
145            thickness1_pd_n=10,
146            thickness2_pd_n=10,
147            )
Note: See TracBrowser for help on using the repository browser.