source: sasmodels/sasmodels/models/pearl_necklace.py @ c1e44e5

Last change on this file since c1e44e5 was c1e44e5, checked in by Paul Kienzle <pkienzle@…>, 5 years ago

Add local link to source files. Refs #1263.

  • Property mode set to 100644
File size: 5.0 KB
RevLine 
[cf404cb]1r"""
[841753c]2This model provides the form factor for a pearl necklace composed of two
3elements: *N* pearls (homogeneous spheres of radius *R*) freely jointed by *M*
[cf404cb]4rods (like strings - with a total mass *Mw* = *M* \* *m*\ :sub:`r` + *N* \* *m*\
[841753c]5:sub:`s`, and the string segment length (or edge separation) *l*
[cf404cb]6(= *A* - 2\ *R*)). *A* is the center-to-center pearl separation distance.
7
[2f0c07d]8.. figure:: img/pearl_necklace_geometry.jpg
[cf404cb]9
10    Pearl Necklace schematic
11
12Definition
13----------
14
[a2f9aa2]15The output of the scattering intensity function for the pearl_necklace is
[cf404cb]16given by (Schweins, 2004)
17
18.. math::
19
20    I(q)=\frac{ \text{scale} }{V} \cdot \frac{(S_{ss}(q)+S_{ff}(q)+S_{fs}(q))}
21        {(M \cdot m_f + N \cdot m_s)^2} + \text{bkg}
22
23where
24
25.. math::
26
[708bc7a]27    S_{ss}(q) &= 2m_s^2\psi^2(q)\left[\frac{N}{1-sin(qA)/qA}-\frac{N}{2}-
28        \frac{1-(sin(qA)/qA)^N}{(1-sin(qA)/qA)^2}\cdot\frac{sin(qA)}{qA}\right] \\
29    S_{ff}(q) &= m_r^2\left[M\left\{2\Lambda(q)-\left(\frac{sin(ql/2)}{ql/2}\right)\right\}+
[cf404cb]30        \frac{2M\beta^2(q)}{1-sin(qA)/qA}-2\beta^2(q)\cdot
[708bc7a]31        \frac{1-(sin(qA)/qA)^M}{(1-sin(qA)/qA)^2}\right] \\
32    S_{fs}(q) &= m_r \beta (q) \cdot m_s \psi (q) \cdot 4\left[
[cf404cb]33        \frac{N-1}{1-sin(qA)/qA}-\frac{1-(sin(qA)/qA)^{N-1}}{(1-sin(qA)/qA)^2}
[708bc7a]34        \cdot \frac{sin(qA)}{qA}\right] \\
[cf404cb]35    \psi(q) &= 3 \cdot \frac{sin(qR)-(qR)\cdot cos(qR)}{(qR)^3} \\
36    \Lambda(q) &= \frac{\int_0^{ql}\frac{sin(t)}{t}dt}{ql} \\
37    \beta(q) &= \frac{\int_{qR}^{q(A-R)}\frac{sin(t)}{t}dt}{ql}
38
[841753c]39where the mass *m*\ :sub:`i` is (SLD\ :sub:`i` - SLD\ :sub:`solvent`) \*
[cf404cb]40(volume of the *N* pearls/rods). *V* is the total volume of the necklace.
41
[c0136c72]42.. note::
[cf404cb]43
[c0136c72]44   *num_pearls* must be an integer.
[cf404cb]45
[c0136c72]46The 2D scattering intensity is the same as $P(q)$ above, regardless of the
47orientation of the *q* vector.
[cf404cb]48
[2f0c07d]49References
50----------
[cf404cb]51
[0507e09]52.. [#] R Schweins and K Huber, *Particle Scattering Factor of Pearl Necklace Chains*,
[c0136c72]53       *Macromol. Symp.* 211 (2004) 25-42 2004
54
[0507e09]55.. [#] L. Onsager, *Ann. New York Acad. Sci.*, 51 (1949) 627-659
56
57Authorship and Verification
58----------------------------
59
[708bc7a]60* **Author:**
[c0136c72]61* **Last Modified by:** Andrew Jackson **Date:** March 28, 2019
62* **Last Reviewed by:** Steve King **Date:** March 28, 2019
[cf404cb]63"""
64
[2d81cfe]65import numpy as np
[b297ba9]66from numpy import inf
[cf404cb]67
68name = "pearl_necklace"
[a2f9aa2]69title = "Colloidal spheres chained together with no preferential orientation"
[cf404cb]70description = """
71Calculate form factor for Pearl Necklace Model
72[Macromol. Symp. 2004, 211, 25-42]
73Parameters:
74background:background
75scale: scale factor
76sld: the SLD of the pearl spheres
77sld_string: the SLD of the strings
78sld_solvent: the SLD of the solvent
[a807206]79num_pearls: number of the pearls
[cf404cb]80radius: the radius of a pearl
[a807206]81edge_sep: the length of string segment; surface to surface
82thick_string: thickness (ie, diameter) of the string
[cf404cb]83"""
84category = "shape:cylinder"
85
86#             ["name", "units", default, [lower, upper], "type","description"],
[a2f9aa2]87parameters = [["radius", "Ang", 80.0, [0, inf], "volume",
[cf404cb]88               "Mean radius of the chained spheres"],
[a807206]89              ["edge_sep", "Ang", 350.0, [0, inf], "volume",
[cf404cb]90               "Mean separation of chained particles"],
[a807206]91              ["thick_string", "Ang", 2.5, [0, inf], "volume",
[cf404cb]92               "Thickness of the chain linkage"],
[1bd1ea2]93              ["num_pearls", "none", 3, [1, inf], "volume",
[a2f9aa2]94               "Number of pearls in the necklace (must be integer)"],
[42356c8]95              ["sld", "1e-6/Ang^2", 1.0, [-inf, inf], "sld",
[cf404cb]96               "Scattering length density of the chained spheres"],
[42356c8]97              ["sld_string", "1e-6/Ang^2", 1.0, [-inf, inf], "sld",
[cf404cb]98               "Scattering length density of the chain linkage"],
[42356c8]99              ["sld_solvent", "1e-6/Ang^2", 6.3, [-inf, inf], "sld",
[cf404cb]100               "Scattering length density of the solvent"],
[841753c]101             ]
[cf404cb]102
[4b541ac]103source = ["lib/sas_Si.c", "lib/sas_3j1x_x.c", "pearl_necklace.c"]
[d18582e]104single = False  # use double precision unless told otherwise
[b297ba9]105effective_radius_type = ["equivalent volume sphere"]
106
[8f04da4]107def random():
[b297ba9]108    """Return a random parameter set for the model."""
[8f04da4]109    radius = 10**np.random.uniform(1, 3) # 1 - 1000
110    thick_string = 10**np.random.uniform(0, np.log10(radius)-1) # 1 - radius/10
111    edge_sep = 10**np.random.uniform(0, 3)  # 1 - 1000
112    num_pearls = np.round(10**np.random.uniform(0.3, 3)) # 2 - 1000
113    pars = dict(
114        radius=radius,
115        edge_sep=edge_sep,
116        thick_string=thick_string,
117        num_pearls=num_pearls,
118    )
119    return pars
120
[cf404cb]121# parameters for demo
[a807206]122demo = dict(scale=1, background=0, radius=80.0, edge_sep=350.0,
123            num_pearls=3, sld=1, sld_solvent=6.3, sld_string=1,
124            thick_string=2.5,
[cf404cb]125            radius_pd=.2, radius_pd_n=5,
[a807206]126            edge_sep_pd=25.0, edge_sep_pd_n=5,
127            num_pearls_pd=0, num_pearls_pd_n=0,
128            thick_string_pd=0.2, thick_string_pd_n=5,
[cf404cb]129           )
[b297ba9]130# ER function is not being used here, not that it is likely very sensible to
131# include an S(Q) with this model, the default in sasview 5.0 would be to the
[2cc8aa2]132# "unconstrained" radius_effective.
133#tests = [[{}, 0.001, 17380.245], [{}, 'ER', 115.39502]]
134tests = [[{}, 0.001, 17380.245]]
Note: See TracBrowser for help on using the repository browser.