source: sasmodels/sasmodels/models/fcc_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@…>, 5 years ago

lint

  • Property mode set to 100644
File size: 6.1 KB
Line 
1#fcc paracrystal model
2#note model title and parameter table are automatically inserted
3#note - calculation requires double precision
4r"""
5.. warning:: This model and this model description are under review following
6             concerns raised by SasView users. If you need to use this model,
7             please email help@sasview.org for the latest situation. *The
8             SasView Developers. September 2018.*
9
10Definition
11----------
12
13Calculates the scattering from a **face-centered cubic lattice** with
14paracrystalline distortion. Thermal vibrations are considered to be
15negligible, and the size of the paracrystal is infinitely large.
16Paracrystalline distortion is assumed to be isotropic and characterized by
17a Gaussian distribution.
18
19The scattering intensity $I(q)$ is calculated as
20
21.. math::
22
23    I(q) = \frac{\text{scale}}{V_p} V_\text{lattice} P(q) Z(q)
24
25where *scale* is the volume fraction of spheres, $V_p$ is the volume of
26the primary particle, $V_\text{lattice}$ is a volume correction for the crystal
27structure, $P(q)$ is the form factor of the sphere (normalized), and $Z(q)$
28is the paracrystalline structure factor for a face-centered cubic structure.
29
30Equation (1) of the 1990 reference\ [#CIT1990]_ is used to calculate $Z(q)$,
31using equations (23)-(25) from the 1987 paper\ [#CIT1987]_ for $Z1$, $Z2$, and
32$Z3$.
33
34The lattice correction (the occupied volume of the lattice) for a
35face-centered cubic structure of particles of radius $R$ and nearest
36neighbor separation $D$ is
37
38.. math::
39
40   V_\text{lattice} = \frac{16\pi}{3}\frac{R^3}{\left(D\sqrt{2}\right)^3}
41
42The distortion factor (one standard deviation) of the paracrystal is
43included in the calculation of $Z(q)$
44
45.. math::
46
47    \Delta a = gD
48
49where $g$ is a fractional distortion based on the nearest neighbor distance.
50
51.. figure:: img/fcc_geometry.jpg
52
53    Face-centered cubic lattice.
54
55For a crystal, diffraction peaks appear at reduced q-values given by
56
57.. math::
58
59    \frac{qD}{2\pi} = \sqrt{h^2 + k^2 + l^2}
60
61where for a face-centered cubic lattice $h, k , l$ all odd or all
62even are allowed and reflections where $h, k, l$ are mixed odd/even
63are forbidden. Thus the peak positions correspond to (just the first 5)
64
65.. math::
66
67    \begin{array}{cccccc}
68    q/q_0 & 1 & \sqrt{4/3} & \sqrt{8/3} & \sqrt{11/3} & \sqrt{4} \\
69    \text{Indices} & (111)  & (200) & (220) & (311) & (222)
70    \end{array}
71
72.. note::
73
74  The calculation of $Z(q)$ is a double numerical integral that
75  must be carried out with a high density of points to properly capture
76  the sharp peaks of the paracrystalline scattering.
77  So be warned that the calculation is slow. Fitting of any experimental data
78  must be resolution smeared for any meaningful fit. This makes a triple integral
79  which may be very slow.
80
81The 2D (Anisotropic model) is based on the reference below where $I(q)$ is
82approximated for 1d scattering. Thus the scattering pattern for 2D may not
83be accurate particularly at low $q$. For general details of the calculation
84and angular dispersions for oriented particles see :ref:`orientation` .
85Note that we are not responsible for any incorrectness of the
862D model computation.
87
88.. figure:: img/parallelepiped_angle_definition.png
89
90    Orientation of the crystal with respect to the scattering plane, when
91    $\theta = \phi = 0$ the $c$ axis is along the beam direction (the $z$ axis).
92
93References
94----------
95
96.. [#CIT1987] Hideki Matsuoka et. al. *Physical Review B*, 36 (1987) 1754-1765
97   (Original Paper)
98.. [#CIT1990] Hideki Matsuoka et. al. *Physical Review B*, 41 (1990) 3854 -3856
99   (Corrections to FCC and BCC lattice structure calculation)
100
101Authorship and Verification
102---------------------------
103
104* **Author:** NIST IGOR/DANSE **Date:** pre 2010
105* **Last Modified by:** Paul Butler **Date:** September 29, 2016
106* **Last Reviewed by:** Richard Heenan **Date:** March 21, 2016
107"""
108
109import numpy as np
110from numpy import inf, pi
111
112name = "fcc_paracrystal"
113title = "Face-centred cubic lattic with paracrystalline distortion"
114description = """
115    Calculates the scattering from a **face-centered cubic lattice** with paracrystalline distortion. Thermal vibrations
116    are considered to be negligible, and the size of the paracrystal is infinitely large. Paracrystalline distortion is
117    assumed to be isotropic and characterized by a Gaussian distribution.
118    """
119category = "shape:paracrystal"
120
121single = False
122
123# pylint: disable=bad-whitespace, line-too-long
124#             ["name", "units", default, [lower, upper], "type","description"],
125parameters = [["dnn", "Ang", 220, [-inf, inf], "", "Nearest neighbour distance"],
126              ["d_factor", "", 0.06, [-inf, inf], "", "Paracrystal distortion factor"],
127              ["radius", "Ang", 40, [0, inf], "volume", "Particle radius"],
128              ["sld", "1e-6/Ang^2", 4, [-inf, inf], "sld", "Particle scattering length density"],
129              ["sld_solvent", "1e-6/Ang^2", 1, [-inf, inf], "sld", "Solvent scattering length density"],
130              ["theta",       "degrees",    60,    [-360, 360], "orientation", "c axis to beam angle"],
131              ["phi",         "degrees",    60,    [-360, 360], "orientation", "rotation about beam"],
132              ["psi",         "degrees",    60,    [-360, 360], "orientation", "rotation about c axis"]
133             ]
134# pylint: enable=bad-whitespace, line-too-long
135
136source = ["lib/sas_3j1x_x.c", "lib/gauss150.c", "lib/sphere_form.c", "fcc_paracrystal.c"]
137
138def random():
139    """Return a random parameter set for the model."""
140    # copied from bcc_paracrystal
141    radius = 10**np.random.uniform(1.3, 4)
142    d_factor = 10**np.random.uniform(-2, -0.7)  # sigma_d in 0.01-0.7
143    dnn_fraction = np.random.beta(a=10, b=1)
144    dnn = radius*4/np.sqrt(2)/dnn_fraction
145    pars = dict(
146        #sld=1, sld_solvent=0, scale=1, background=1e-32,
147        dnn=dnn,
148        d_factor=d_factor,
149        radius=radius,
150    )
151    return pars
152
153# april 10 2017, rkh add unit tests, NOT compared with any other calc method, assume correct!
154# TODO: fix the 2d tests
155q = 4.*pi/220.
156tests = [
157    [{}, [0.001, q, 0.215268], [0.275164706668, 5.7776842567, 0.00958167119232]],
158    #[{}, (-0.047, -0.007), 238.103096286],
159    #[{}, (0.053, 0.063), 0.863609587796],
160]
Note: See TracBrowser for help on using the repository browser.