source: sasmodels/sasmodels/models/sc_crystal.py @ 9aac25d

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 9aac25d was 9aac25d, checked in by piotr, 8 years ago

Converted SCCrystalModel

  • Property mode set to 100644
File size: 5.8 KB
Line 
1r"""
2Calculates the scattering from a **simple cubic lattice** with
3paracrystalline distortion. Thermal vibrations are considered to be
4negligible, and the size of the paracrystal is infinitely large.
5Paracrystalline distortion is assumed to be isotropic and characterized
6by a Gaussian distribution.
7
8Definition
9----------
10
11The scattering intensity $I(q)$ is calculated as
12
13.. math::
14
15    I(q) = \frac{scale}{V_p}V_{lattice}P(q)Z(q)
16
17where scale is the volume fraction of spheres, $V_p$ is the volume of
18the primary particle, $V_{lattice}$ is a volume correction for the crystal
19structure, $P(q)$ is the form factor of the sphere (normalized), and
20$Z(q)$ is the paracrystalline structure factor for a simple cubic structure.
21
22Equation (16) of the 1987 reference is used to calculate $Z(q)$, using
23equations (13)-(15) from the 1987 paper for Z1, Z2, and Z3.
24
25The lattice correction (the occupied volume of the lattice) for a simple
26cubic structure of particles of radius *R* and nearest neighbor separation *D* is
27
28.. math::
29
30    V_{lattice}=\frac{4\pi}{3}\frac{R^3}{D^3}
31
32The distortion factor (one standard deviation) of the paracrystal is included
33in the calculation of $Z(q)$
34
35.. math::
36
37    \Delta a = gD
38
39where *g* is a fractional distortion based on the nearest neighbor distance.
40
41The simple cubic lattice is
42
43.. figure:: img/sc_crystal_fig1.jpg
44
45For a crystal, diffraction peaks appear at reduced q-values given by
46
47.. math::
48
49    \frac{qD}{2\pi} = \sqrt{h^2+k^2+l^2}
50
51where for a simple cubic lattice any h, k, l are allowed and none are
52forbidden. Thus the peak positions correspond to (just the first 5)
53
54.. math::
55
56    \begin{align*}
57    q/q_0 \quad & \quad 1
58                & \sqrt{2} \quad
59                & \quad  \sqrt{3} \quad
60                & \sqrt{4} \quad
61                & \quad \sqrt{5}\quad \\
62    Indices \quad & (100)
63                  & \quad (110) \quad
64                  & \quad (111)
65                  & (200) \quad
66                  & \quad (210)
67    \end{align*}
68
69.. note::
70
71    The calculation of *Z(q)* is a double numerical integral that must be
72    carried out with a high density of points to properly capture the sharp
73    peaks of the paracrystalline scattering.
74    So be warned that the calculation is SLOW. Go get some coffee.
75    Fitting of any experimental data must be resolution smeared for any
76    meaningful fit. This makes a triple integral. Very, very slow.
77    Go get lunch!
78
79This example dataset is produced using 200 data points,
80$q_{min} = 0.01A^{-1}, q_{max} = 0.1A^{-1}$ and the above default values.
81
82.. figure:: img/sc_crystal_1d.jpg
83
84    1D plot in the linear scale using the default values (w/200 data point).
85
86The 2D (Anisotropic model) is based on the reference below where *I(q)* is
87approximated for 1d scattering. Thus the scattering pattern for 2D may not
88be accurate. Note that we are not responsible for any incorrectness of the 2D
89model computation.
90
91.. figure:: img/sc_crystal_fig2.jpg
92.. figure:: img/sc_crystal_fig3.jpg
93
94    2D plot using the default values (w/200X200 pixels).
95
96Reference
97---------
98Hideki Matsuoka et. al. *Physical Review B,* 36 (1987) 1754-1765
99(Original Paper)
100
101Hideki Matsuoka et. al. *Physical Review B,* 41 (1990) 3854 -3856
102(Corrections to FCC and BCC lattice structure calculation)
103
104"""
105
106from numpy import inf
107
108name = "sc_crystal"
109title = "Simple cubic lattice with paracrystalline distortion"
110description = """
111        P(q)=(scale/Vp)*V_lattice*P(q)*Z(q)+bkg where scale is the volume
112        fraction of sphere,
113        Vp = volume of the primary particle,
114        V_lattice = volume correction for
115        for the crystal structure,
116        P(q)= form factor of the sphere (normalized),
117        Z(q)= paracrystalline structure factor
118        for a simple cubic structure.
119        [Simple Cubic ParaCrystal Model]
120        Parameters;
121        scale: volume fraction of spheres
122        bkg:background, R: radius of sphere
123        dnn: Nearest neighbor distance
124        d_factor: Paracrystal distortion factor
125        radius: radius of the spheres
126        sldSph: SLD of the sphere
127        sldSolv: SLD of the solvent
128        """
129category = "shape:paracrystal"
130single = False
131# pylint: disable=bad-whitespace, line-too-long
132#             ["name", "units", default, [lower, upper], "type","description"],
133parameters = [["dnn",         "Ang",       220.0,  [0.0, inf],  "",            "Nearest neighbor distance"],
134              ["d_factor",    "",            0.06, [-inf, inf], "",            "Paracrystal distortion factor"],
135              ["radius",      "Ang",        40.0,  [0.0, inf],  "volume",      "Radius of sphere"],
136              ["sphere_sld",  "1e-6/Ang^2",  3.0,  [0.0, inf],  "",            "Sphere scattering length density"],
137              ["solvent_sld", "1e-6/Ang^2",  6.3,  [0.0, inf],  "",            "Solvent scattering length density"],
138              ["theta",       "degrees",     0.0,  [-inf, inf], "orientation", "Orientation of the a1 axis w/respect incoming beam"],
139              ["phi",         "degrees",     0.0,  [-inf, inf], "orientation", "Orientation of the a2 in the plane of the detector"],
140              ["psi",         "degrees",     0.0,  [-inf, inf], "orientation", "Orientation of the a3 in the plane of the detector"],
141             ]
142# pylint: enable=bad-whitespace, line-too-long
143
144source = ["lib/sphere_form.c", "lib/gauss150.c", "sc_crystal.c"]
145
146demo = dict(scale=1, background=0,
147            dnn=220.0,
148            d_factor=0.06,
149            radius=40.0,
150            sphere_sld=3.0,
151            solvent_sld=6.3,
152            theta=0.0,
153            phi=0.0,
154            psi=0.0)
155
156oldname = 'SCCrystalModel'
157
158oldpars = dict(sphere_sld='sldSph',
159               solvent_sld='sldSolv')
160
161tests = [
162    # Accuracy tests based on content in test/utest_extra_models.py
163    [{}, 0.001, 10.3038],
164    [{}, 0.215268, 0.00714889],
165    [{}, (0.414467), 0.000313289]
166    ]
167
168
Note: See TracBrowser for help on using the repository browser.