core_shell_microgelscostrafo411magnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 925ad6e was 925ad6e, checked in by wojciech, 6 years ago

sph_j1c translated to sas_3j1x_x

• Property mode set to 100644
File size: 5.6 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) = \text{scale}\frac{V_\text{lattice}P(q)Z(q)}{V_p} + \text{background}
16
17where scale is the volume fraction of spheres, $V_p$ is the volume of
18the primary particle, $V_\text{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_\text{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_geometry.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    :nowrap:
56
57    \begin{align*}
68    \end{align*}
69
70.. note::
71
72    The calculation of *Z(q)* is a double numerical integral that must be
73    carried out with a high density of points to properly capture the sharp
74    peaks of the paracrystalline scattering.
75    So be warned that the calculation is SLOW. Go get some coffee.
76    Fitting of any experimental data must be resolution smeared for any
77    meaningful fit. This makes a triple integral. Very, very slow.
78    Go get lunch!
79
80The 2D (Anisotropic model) is based on the reference below where *I(q)* is
81approximated for 1d scattering. Thus the scattering pattern for 2D may not
82be accurate. Note that we are not responsible for any incorrectness of the 2D
83model computation.
84
85.. figure:: img/sc_crystal_angle_definition.jpg
86
87Reference
88---------
89Hideki Matsuoka et. al. *Physical Review B,* 36 (1987) 1754-1765
90(Original Paper)
91
92Hideki Matsuoka et. al. *Physical Review B,* 41 (1990) 3854 -3856
93(Corrections to FCC and BCC lattice structure calculation)
94
95"""
96
97from numpy import inf
98
99name = "sc_paracrystal"
100title = "Simple cubic lattice with paracrystalline distortion"
101description = """
102        P(q)=(scale/Vp)*V_lattice*P(q)*Z(q)+bkg where scale is the volume
103        fraction of sphere,
104        Vp = volume of the primary particle,
105        V_lattice = volume correction for
106        for the crystal structure,
107        P(q)= form factor of the sphere (normalized),
108        Z(q)= paracrystalline structure factor
109        for a simple cubic structure.
110        [Simple Cubic ParaCrystal Model]
111        Parameters;
112        scale: volume fraction of spheres
113        bkg:background, R: radius of sphere
114        dnn: Nearest neighbor distance
115        d_factor: Paracrystal distortion factor
117        sldSph: SLD of the sphere
118        sldSolv: SLD of the solvent
119        """
120category = "shape:paracrystal"
121single = False
123#             ["name", "units", default, [lower, upper], "type","description"],
124parameters = [["dnn",         "Ang",       220.0, [0.0, inf],  "",            "Nearest neighbor distance"],
125              ["d_factor",    "",           0.06, [-inf, inf], "",            "Paracrystal distortion factor"],
127              ["sld",  "1e-6/Ang^2",         3.0, [0.0, inf],  "sld",         "Sphere scattering length density"],
128              ["sld_solvent", "1e-6/Ang^2",  6.3, [0.0, inf],  "sld",         "Solvent scattering length density"],
129              ["theta",       "degrees",     0.0, [-inf, inf], "orientation", "Orientation of the a1 axis w/respect incoming beam"],
130              ["phi",         "degrees",     0.0, [-inf, inf], "orientation", "Orientation of the a2 in the plane of the detector"],
131              ["psi",         "degrees",     0.0, [-inf, inf], "orientation", "Orientation of the a3 in the plane of the detector"],
132             ]
134
135source = ["lib/sas_3j1x_x.c", "lib/sphere_form.c", "lib/gauss150.c", "sc_paracrystal.c"]
136
137demo = dict(scale=1, background=0,
138            dnn=220.0,
139            d_factor=0.06,
141            sld=3.0,
142            sld_solvent=6.3,
143            theta=0.0,
144            phi=0.0,
145            psi=0.0)
146
147tests = [
148    # Accuracy tests based on content in test/utest_extra_models.py
149    [{}, 0.001, 10.3048],
150    [{}, 0.215268, 0.00814889],
151    [{}, (0.414467), 0.001313289]
152    ]
153
154
Note: See TracBrowser for help on using the repository browser.