source: sasmodels/sasmodels/models/fcc_paracrystal.py @ eda8b30

core_shell_microgelsmagnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since eda8b30 was eda8b30, checked in by richardh, 6 years ago

further changes to model docs for orientation calcs

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