# source:sasmodels/sasmodels/models/sc_paracrystal.py@b297ba9

core_shell_microgelsmagnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since b297ba9 was b297ba9, checked in by Paul Kienzle <pkienzle@…>, 23 months ago

lint

• Property mode set to 100644
File size: 6.6 KB
Line
1r"""
2.. warning:: This model and this model description are under review following
3             concerns raised by SasView users. If you need to use this model,
4             please email help@sasview.org for the latest situation. *The
5             SasView Developers. September 2018.*
6
7Definition
8----------
9
10Calculates the scattering from a **simple cubic lattice** with
11paracrystalline distortion. Thermal vibrations are considered to be
12negligible, and the size of the paracrystal is infinitely large.
13Paracrystalline distortion is assumed to be isotropic and characterized
14by a Gaussian distribution.
15
16The scattering intensity $I(q)$ is calculated as
17
18.. math::
19
20    I(q) = \text{scale}\frac{V_\text{lattice}P(q)Z(q)}{V_p} + \text{background}
21
22where scale is the volume fraction of spheres, $V_p$ is the volume of
23the primary particle, $V_\text{lattice}$ is a volume correction for the crystal
24structure, $P(q)$ is the form factor of the sphere (normalized), and
25$Z(q)$ is the paracrystalline structure factor for a simple cubic structure.
26
27Equation (16) of the 1987 reference\ [#CIT1987]_ is used to calculate $Z(q)$,
28using equations (13)-(15) from the 1987 paper\ [#CIT1987]_ for $Z1$, $Z2$, and
29$Z3$.
30
31The lattice correction (the occupied volume of the lattice) for a simple cubic
32structure of particles of radius *R* and nearest neighbor separation *D* is
33
34.. math::
35
36    V_\text{lattice}=\frac{4\pi}{3}\frac{R^3}{D^3}
37
38The distortion factor (one standard deviation) of the paracrystal is included
39in the calculation of $Z(q)$
40
41.. math::
42
43    \Delta a = gD
44
45where *g* is a fractional distortion based on the nearest neighbor distance.
46
47The simple cubic lattice is
48
49.. figure:: img/sc_crystal_geometry.jpg
50
51For a crystal, diffraction peaks appear at reduced q-values given by
52
53.. math::
54
55    \frac{qD}{2\pi} = \sqrt{h^2+k^2+l^2}
56
57where for a simple cubic lattice any h, k, l are allowed and none are
58forbidden. Thus the peak positions correspond to (just the first 5)
59
60.. math::
61    :nowrap:
62
63    \begin{align*}
74    \end{align*}
75
76.. note::
77
78    The calculation of *Z(q)* is a double numerical integral that must be
79    carried out with a high density of points to properly capture the sharp
80    peaks of the paracrystalline scattering.
81    So be warned that the calculation is slow. Fitting of any experimental data
82    must be resolution smeared for any meaningful fit. This makes a triple
83    integral which may be very slow.
84
85The 2D (Anisotropic model) is based on the reference below where *I(q)* is
86approximated for 1d scattering. Thus the scattering pattern for 2D may not
87be accurate particularly at low $q$. For general details of the calculation
88and angular dispersions for oriented particles see :ref:orientation .
89Note that we are not responsible for any incorrectness of the
902D model computation.
91
92.. figure:: img/parallelepiped_angle_definition.png
93
94    Orientation of the crystal with respect to the scattering plane, when
95    $\theta = \phi = 0$ the $c$ axis is along the beam direction (the $z$ axis).
96
97Reference
98---------
99
100.. [#CIT1987] Hideki Matsuoka et. al. *Physical Review B*, 36 (1987) 1754-1765
101   (Original Paper)
102.. [#CIT1990] Hideki Matsuoka et. al. *Physical Review B*, 41 (1990) 3854 -3856
103   (Corrections to FCC and BCC lattice structure calculation)
104
105Authorship and Verification
106---------------------------
107
108* **Author:** NIST IGOR/DANSE **Date:** pre 2010
110* **Last Reviewed by:** Richard Heenan **Date:** March 21, 2016
111"""
112
113import numpy as np
114from numpy import inf
115
116name = "sc_paracrystal"
117title = "Simple cubic lattice with paracrystalline distortion"
118description = """
119        P(q)=(scale/Vp)*V_lattice*P(q)*Z(q)+bkg where scale is the volume
120        fraction of sphere,
121        Vp = volume of the primary particle,
122        V_lattice = volume correction for
123        for the crystal structure,
124        P(q)= form factor of the sphere (normalized),
125        Z(q)= paracrystalline structure factor
126        for a simple cubic structure.
127        [Simple Cubic ParaCrystal Model]
128        Parameters;
129        scale: volume fraction of spheres
130        bkg:background, R: radius of sphere
131        dnn: Nearest neighbor distance
132        d_factor: Paracrystal distortion factor
134        sldSph: SLD of the sphere
135        sldSolv: SLD of the solvent
136        """
137category = "shape:paracrystal"
138single = False
140#             ["name", "units", default, [lower, upper], "type","description"],
141parameters = [["dnn",         "Ang",       220.0, [0.0, inf],  "",            "Nearest neighbor distance"],
142              ["d_factor",    "",           0.06, [-inf, inf], "",            "Paracrystal distortion factor"],
144              ["sld",  "1e-6/Ang^2",         3.0, [0.0, inf],  "sld",         "Sphere scattering length density"],
145              ["sld_solvent", "1e-6/Ang^2",  6.3, [0.0, inf],  "sld",         "Solvent scattering length density"],
146              ["theta",       "degrees",    0,    [-360, 360], "orientation", "c axis to beam angle"],
147              ["phi",         "degrees",    0,    [-360, 360], "orientation", "rotation about beam"],
148              ["psi",         "degrees",    0,    [-360, 360], "orientation", "rotation about c axis"]
149             ]
151
152source = ["lib/sas_3j1x_x.c", "lib/sphere_form.c", "lib/gauss150.c", "sc_paracrystal.c"]
153
154def random():
155    """Return a random parameter set for the model."""
156    # copied from bcc_paracrystal
158    d_factor = 10**np.random.uniform(-2, -0.7)  # sigma_d in 0.01-0.7
159    dnn_fraction = np.random.beta(a=10, b=1)
161    pars = dict(
162        #sld=1, sld_solvent=0, scale=1, background=1e-32,
163        dnn=dnn,
164        d_factor=d_factor,