source: sasmodels/sasmodels/models/fcc_paracrystal.py @ 0507e09

core_shell_microgelsmagnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 0507e09 was 0507e09, checked in by smk78, 5 years ago

Added link to source code to each model. Closes #883

  • Property mode set to 100644
File size: 6.4 KB
RevLine 
[e7b3d7b]1#fcc paracrystal model
[3271e20]2#note model title and parameter table are automatically inserted
3#note - calculation requires double precision
[e7b3d7b]4r"""
[b297ba9]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
[da7b26b]8             SasView Developers. September 2018.*
9
10Definition
11----------
12
[3c56da87]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.
[3271e20]18
[d138d43]19The scattering intensity $I(q)$ is calculated as
20
21.. math::
[3271e20]22
[eb69cce]23    I(q) = \frac{\text{scale}}{V_p} V_\text{lattice} P(q) Z(q)
[3271e20]24
[d138d43]25where *scale* is the volume fraction of spheres, $V_p$ is the volume of
[eb69cce]26the primary particle, $V_\text{lattice}$ is a volume correction for the crystal
[d138d43]27structure, $P(q)$ is the form factor of the sphere (normalized), and $Z(q)$
[3c56da87]28is the paracrystalline structure factor for a face-centered cubic structure.
[3271e20]29
[da7b26b]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$.
[3271e20]33
[3c56da87]34The lattice correction (the occupied volume of the lattice) for a
[eb69cce]35face-centered cubic structure of particles of radius $R$ and nearest
[d138d43]36neighbor separation $D$ is
[3271e20]37
[d138d43]38.. math::
39
40   V_\text{lattice} = \frac{16\pi}{3}\frac{R^3}{\left(D\sqrt{2}\right)^3}
[3271e20]41
[3c56da87]42The distortion factor (one standard deviation) of the paracrystal is
[d138d43]43included in the calculation of $Z(q)$
44
45.. math::
[3271e20]46
[d138d43]47    \Delta a = gD
[3271e20]48
[d138d43]49where $g$ is a fractional distortion based on the nearest neighbor distance.
[3271e20]50
[2f0c07d]51.. figure:: img/fcc_geometry.jpg
[3271e20]52
[d138d43]53    Face-centered cubic lattice.
[3271e20]54
55For a crystal, diffraction peaks appear at reduced q-values given by
56
[d138d43]57.. math::
[3271e20]58
[d138d43]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
[3c56da87]63are forbidden. Thus the peak positions correspond to (just the first 5)
[3271e20]64
[d138d43]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}
[3271e20]71
[eda8b30]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
[1f159bd]76  the sharp peaks of the paracrystalline scattering.
77  So be warned that the calculation is slow. Fitting of any experimental data
[eda8b30]78  must be resolution smeared for any meaningful fit. This makes a triple integral
79  which may be very slow.
[3271e20]80
[eb69cce]81The 2D (Anisotropic model) is based on the reference below where $I(q)$ is
[3c56da87]82approximated for 1d scattering. Thus the scattering pattern for 2D may not
[1f159bd]83be accurate particularly at low $q$. For general details of the calculation
[eda8b30]84and angular dispersions for oriented particles see :ref:`orientation` .
85Note that we are not responsible for any incorrectness of the
[3c56da87]862D model computation.
[3271e20]87
[1f65db5]88.. figure:: img/parallelepiped_angle_definition.png
[d138d43]89
[404ebbd]90    Orientation of the crystal with respect to the scattering plane, when
[1f65db5]91    $\theta = \phi = 0$ the $c$ axis is along the beam direction (the $z$ axis).
[3271e20]92
[eb69cce]93References
94----------
[3271e20]95
[da7b26b]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
[0507e09]101Source
102------
103
104`fcc_paracrystal.py <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/fcc_paracrystal.py>`_
105
106`fcc_paracrystal.c <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/fcc_paracrystal.c>`_
107
[da7b26b]108Authorship and Verification
109---------------------------
[3271e20]110
[da7b26b]111* **Author:** NIST IGOR/DANSE **Date:** pre 2010
112* **Last Modified by:** Paul Butler **Date:** September 29, 2016
113* **Last Reviewed by:** Richard Heenan **Date:** March 21, 2016
[0507e09]114* **Source added by :** Steve King **Date:** March 25, 2019
[3271e20]115"""
116
[2d81cfe]117import numpy as np
[e2d6e3b]118from numpy import inf, pi
[3271e20]119
[e7b3d7b]120name = "fcc_paracrystal"
121title = "Face-centred cubic lattic with paracrystalline distortion"
[3271e20]122description = """
[e7b3d7b]123    Calculates the scattering from a **face-centered cubic lattice** with paracrystalline distortion. Thermal vibrations
[3271e20]124    are considered to be negligible, and the size of the paracrystal is infinitely large. Paracrystalline distortion is
125    assumed to be isotropic and characterized by a Gaussian distribution.
126    """
[a5d0d00]127category = "shape:paracrystal"
[3271e20]128
[13ed84c]129single = False
130
[c0ccea8]131# pylint: disable=bad-whitespace, line-too-long
[3e428ec]132#             ["name", "units", default, [lower, upper], "type","description"],
133parameters = [["dnn", "Ang", 220, [-inf, inf], "", "Nearest neighbour distance"],
134              ["d_factor", "", 0.06, [-inf, inf], "", "Paracrystal distortion factor"],
135              ["radius", "Ang", 40, [0, inf], "volume", "Particle radius"],
[42356c8]136              ["sld", "1e-6/Ang^2", 4, [-inf, inf], "sld", "Particle scattering length density"],
137              ["sld_solvent", "1e-6/Ang^2", 1, [-inf, inf], "sld", "Solvent scattering length density"],
[9b79f29]138              ["theta",       "degrees",    60,    [-360, 360], "orientation", "c axis to beam angle"],
139              ["phi",         "degrees",    60,    [-360, 360], "orientation", "rotation about beam"],
140              ["psi",         "degrees",    60,    [-360, 360], "orientation", "rotation about c axis"]
[3e428ec]141             ]
[c0ccea8]142# pylint: enable=bad-whitespace, line-too-long
[3e428ec]143
[925ad6e]144source = ["lib/sas_3j1x_x.c", "lib/gauss150.c", "lib/sphere_form.c", "fcc_paracrystal.c"]
[3271e20]145
[404ebbd]146def random():
[b297ba9]147    """Return a random parameter set for the model."""
[1511c37c]148    # copied from bcc_paracrystal
149    radius = 10**np.random.uniform(1.3, 4)
150    d_factor = 10**np.random.uniform(-2, -0.7)  # sigma_d in 0.01-0.7
[404ebbd]151    dnn_fraction = np.random.beta(a=10, b=1)
[8f04da4]152    dnn = radius*4/np.sqrt(2)/dnn_fraction
[404ebbd]153    pars = dict(
154        #sld=1, sld_solvent=0, scale=1, background=1e-32,
[1511c37c]155        dnn=dnn,
156        d_factor=d_factor,
157        radius=radius,
[404ebbd]158    )
159    return pars
160
[69e1afc]161# april 10 2017, rkh add unit tests, NOT compared with any other calc method, assume correct!
[1f159bd]162# TODO: fix the 2d tests
[8f04da4]163q = 4.*pi/220.
[e2d6e3b]164tests = [
[8f04da4]165    [{}, [0.001, q, 0.215268], [0.275164706668, 5.7776842567, 0.00958167119232]],
[1f159bd]166    #[{}, (-0.047, -0.007), 238.103096286],
167    #[{}, (0.053, 0.063), 0.863609587796],
[e2d6e3b]168]
Note: See TracBrowser for help on using the repository browser.