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

core_shell_microgelscostrafo411magnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since e2d6e3b was e2d6e3b, checked in by richardh, 7 years ago

tests for bcc_ and fcc_paracrystal

  • Property mode set to 100644
File size: 5.0 KB
Line 
1#fcc paracrystal model
2#note model title and parameter table are automatically inserted
3#note - calculation requires double precision
4r"""
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.
10
11Definition
12----------
13
14The scattering intensity $I(q)$ is calculated as
15
16.. math::
17
18    I(q) = \frac{\text{scale}}{V_p} V_\text{lattice} P(q) Z(q)
19
20where *scale* is the volume fraction of spheres, $V_p$ is the volume of
21the primary particle, $V_\text{lattice}$ is a volume correction for the crystal
22structure, $P(q)$ is the form factor of the sphere (normalized), and $Z(q)$
23is the paracrystalline structure factor for a face-centered cubic structure.
24
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$.
27
28The lattice correction (the occupied volume of the lattice) for a
29face-centered cubic structure of particles of radius $R$ and nearest
30neighbor separation $D$ is
31
32.. math::
33
34   V_\text{lattice} = \frac{16\pi}{3}\frac{R^3}{\left(D\sqrt{2}\right)^3}
35
36The distortion factor (one standard deviation) of the paracrystal is
37included in the calculation of $Z(q)$
38
39.. math::
40
41    \Delta a = gD
42
43where $g$ is a fractional distortion based on the nearest neighbor distance.
44
45.. figure:: img/fcc_geometry.jpg
46
47    Face-centered cubic lattice.
48
49For a crystal, diffraction peaks appear at reduced q-values given by
50
51.. math::
52
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
57are forbidden. Thus the peak positions correspond to (just the first 5)
58
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}
65
66**NB**: The calculation of $Z(q)$ is a double numerical integral that
67must be carried out with a high density of points to properly capture
68the sharp peaks of the paracrystalline scattering. So be warned that the
69calculation is SLOW. Go get some coffee. Fitting of any experimental data
70must be resolution smeared for any meaningful fit. This makes a triple
71integral. Very, very slow. Go get lunch!
72
73The 2D (Anisotropic model) is based on the reference below where $I(q)$ is
74approximated for 1d scattering. Thus the scattering pattern for 2D may not
75be accurate. Note that we are not responsible for any incorrectness of the
762D model computation.
77
78.. figure:: img/bcc_angle_definition.png
79
80    Orientation of the crystal with respect to the scattering plane.
81
82References
83----------
84
85Hideki Matsuoka et. al. *Physical Review B*, 36 (1987) 1754-1765
86(Original Paper)
87
88Hideki Matsuoka et. al. *Physical Review B*, 41 (1990) 3854 -3856
89(Corrections to FCC and BCC lattice structure calculation)
90"""
91
92from numpy import inf, pi
93
94name = "fcc_paracrystal"
95title = "Face-centred cubic lattic with paracrystalline distortion"
96description = """
97    Calculates the scattering from a **face-centered cubic lattice** with paracrystalline distortion. Thermal vibrations
98    are considered to be negligible, and the size of the paracrystal is infinitely large. Paracrystalline distortion is
99    assumed to be isotropic and characterized by a Gaussian distribution.
100    """
101category = "shape:paracrystal"
102
103single = False
104
105# pylint: disable=bad-whitespace, line-too-long
106#             ["name", "units", default, [lower, upper], "type","description"],
107parameters = [["dnn", "Ang", 220, [-inf, inf], "", "Nearest neighbour distance"],
108              ["d_factor", "", 0.06, [-inf, inf], "", "Paracrystal distortion factor"],
109              ["radius", "Ang", 40, [0, inf], "volume", "Particle radius"],
110              ["sld", "1e-6/Ang^2", 4, [-inf, inf], "sld", "Particle scattering length density"],
111              ["sld_solvent", "1e-6/Ang^2", 1, [-inf, inf], "sld", "Solvent scattering length density"],
112              ["theta", "degrees", 60, [-inf, inf], "orientation", "In plane angle"],
113              ["phi", "degrees", 60, [-inf, inf], "orientation", "Out of plane angle"],
114              ["psi", "degrees", 60, [-inf, inf], "orientation", "Out of plane angle"]
115             ]
116# pylint: enable=bad-whitespace, line-too-long
117
118source = ["lib/sas_3j1x_x.c", "lib/gauss150.c", "lib/sphere_form.c", "fcc_paracrystal.c"]
119
120# parameters for demo
121demo = dict(scale=1, background=0,
122            dnn=220, d_factor=0.06, sld=4, sld_solvent=1,
123            radius=40,
124            theta=60, phi=60, psi=60,
125            radius_pd=.2, radius_pd_n=0.2,
126            theta_pd=15, theta_pd_n=0,
127            phi_pd=15, phi_pd_n=0,
128            psi_pd=15, psi_pd_n=0,
129           )
130# april 6 2017, rkh add unit tests, NOT compared with any other calc method, assume correct!
131# add 2d test later
132q =4.*pi/220.
133tests = [
134    [{ },
135     [0.001, q, 0.215268], [0.275164706668, 5.7776842567, 0.00958167119232]],
136]
Note: See TracBrowser for help on using the repository browser.