[edc9f8d] | 1 | r""" |
---|
[55b2b232] | 2 | .. _core_shell_sphere: |
---|
| 3 | |
---|
[40a87fa] | 4 | This model provides the form factor, $P(q)$, for a spherical particle with |
---|
| 5 | a core-shell structure. The form factor is normalized by the particle volume. |
---|
[edc9f8d] | 6 | |
---|
[9f60c06] | 7 | For information about polarised and magnetic scattering, see |
---|
[9a4811a] | 8 | the :ref:`magnetism` documentation. |
---|
[9f60c06] | 9 | |
---|
[edc9f8d] | 10 | Definition |
---|
| 11 | ---------- |
---|
| 12 | |
---|
| 13 | The 1D scattering intensity is calculated in the following way (Guinier, 1955) |
---|
| 14 | |
---|
| 15 | .. math:: |
---|
| 16 | |
---|
| 17 | P(q) = \frac{\text{scale}}{V} F^2(q) + \text{background} |
---|
| 18 | |
---|
| 19 | where |
---|
| 20 | |
---|
| 21 | .. math:: |
---|
[fa8011eb] | 22 | |
---|
[dc76240] | 23 | F(q) = \frac{3}{V_s}\left[ |
---|
[40a87fa] | 24 | V_c(\rho_c-\rho_s)\frac{\sin(qr_c)-qr_c\cos(qr_c)}{(qr_c)^3} + |
---|
| 25 | V_s(\rho_s-\rho_\text{solv})\frac{\sin(qr_s)-qr_s\cos(qr_s)}{(qr_s)^3} |
---|
| 26 | \right] |
---|
[8c9dbc9] | 27 | |
---|
[40a87fa] | 28 | where $V_s$ is the volume of the whole particle, $V_c$ is the volume of the |
---|
| 29 | core, $r_s$ = $radius$ + $thickness$ is the radius of the particle, $r_c$ |
---|
| 30 | is the radius of the core, $\rho_c$ is the scattering length density of the |
---|
| 31 | core, $\rho_s$ is the scattering length density of the shell, |
---|
| 32 | $\rho_\text{solv}$, is the scattering length density of the solvent. |
---|
[edc9f8d] | 33 | |
---|
| 34 | The 2D scattering intensity is the same as $P(q)$ above, regardless of the |
---|
| 35 | orientation of the $q$ vector. |
---|
| 36 | |
---|
| 37 | NB: The outer most radius (ie, = radius + thickness) is used as the |
---|
| 38 | effective radius for $S(Q)$ when $P(Q) \cdot S(Q)$ is applied. |
---|
| 39 | |
---|
| 40 | Validation |
---|
| 41 | ---------- |
---|
| 42 | |
---|
[40a87fa] | 43 | Validation of our code was done by comparing the output of the 1D model to |
---|
| 44 | the output of the software provided by NIST (Kline, 2006). Figure 1 shows a |
---|
| 45 | comparison of the output of our model and the output of the NIST software. |
---|
[0507e09] | 46 | |
---|
| 47 | References |
---|
| 48 | ---------- |
---|
| 49 | |
---|
| 50 | .. [#] A Guinier and G Fournet, *Small-Angle Scattering of X-Rays*, John Wiley and Sons, New York, (1955) |
---|
| 51 | |
---|
| 52 | Source |
---|
| 53 | ------ |
---|
| 54 | |
---|
| 55 | `core_shell_sphere.py <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/core_shell_sphere.py>`_ |
---|
| 56 | |
---|
| 57 | `core_shell_sphere.c <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/core_shell_sphere.c>`_ |
---|
| 58 | |
---|
| 59 | Authorship and Verification |
---|
| 60 | ---------------------------- |
---|
| 61 | |
---|
[a34b811] | 62 | * **Author:** |
---|
| 63 | * **Last Modified by:** |
---|
| 64 | * **Last Reviewed by:** |
---|
[0507e09] | 65 | * **Source added by :** Steve King **Date:** March 25, 2019 |
---|
[edc9f8d] | 66 | """ |
---|
| 67 | |
---|
[2d81cfe] | 68 | import numpy as np |
---|
[edc9f8d] | 69 | from numpy import pi, inf |
---|
| 70 | |
---|
| 71 | name = "core_shell_sphere" |
---|
| 72 | title = "Form factor for a monodisperse spherical particle with particle with a core-shell structure." |
---|
| 73 | description = """ |
---|
[c036ddb] | 74 | F(q) = [V_c (sld_core-sld_shell) 3 (sin(q*radius)-q*radius*cos(q*radius))/(q*radius)^3 |
---|
| 75 | + V_s (sld_shell-sld_solvent) 3 (sin(q*r_s)-q*r_s*cos(q*r_s))/(q*r_s)^3] |
---|
[edc9f8d] | 76 | |
---|
| 77 | V_s: Volume of the sphere shell |
---|
| 78 | V_c: Volume of the sphere core |
---|
| 79 | r_s: Shell radius = radius + thickness |
---|
| 80 | """ |
---|
| 81 | category = "shape:sphere" |
---|
| 82 | |
---|
| 83 | # pylint: disable=bad-whitespace, line-too-long |
---|
| 84 | # ["name", "units", default, [lower, upper], "type","description"], |
---|
| 85 | parameters = [["radius", "Ang", 60.0, [0, inf], "volume", "Sphere core radius"], |
---|
| 86 | ["thickness", "Ang", 10.0, [0, inf], "volume", "Sphere shell thickness"], |
---|
[42356c8] | 87 | ["sld_core", "1e-6/Ang^2", 1.0, [-inf, inf], "sld", "core scattering length density"], |
---|
| 88 | ["sld_shell", "1e-6/Ang^2", 2.0, [-inf, inf], "sld", "shell scattering length density"], |
---|
| 89 | ["sld_solvent", "1e-6/Ang^2", 3.0, [-inf, inf], "sld", "Solvent scattering length density"]] |
---|
[edc9f8d] | 90 | # pylint: enable=bad-whitespace, line-too-long |
---|
| 91 | |
---|
[925ad6e] | 92 | source = ["lib/sas_3j1x_x.c", "lib/core_shell.c", "core_shell_sphere.c"] |
---|
[71b751d] | 93 | have_Fq = True |
---|
[a34b811] | 94 | radius_effective_modes = ["outer radius", "core radius"] |
---|
[edc9f8d] | 95 | |
---|
| 96 | demo = dict(scale=1, background=0, radius=60, thickness=10, |
---|
[3556ad7] | 97 | sld_core=1.0, sld_shell=2.0, sld_solvent=0.0) |
---|
[edc9f8d] | 98 | |
---|
[d49ca5c] | 99 | def random(): |
---|
[b297ba9] | 100 | """Return a random parameter set for the model.""" |
---|
[8f04da4] | 101 | outer_radius = 10**np.random.uniform(1.3, 4.3) |
---|
| 102 | # Use a distribution with a preference for thin shell or thin core |
---|
| 103 | # Avoid core,shell radii < 1 |
---|
| 104 | radius = np.random.beta(0.5, 0.5)*(outer_radius-2) + 1 |
---|
[9f6823b] | 105 | thickness = outer_radius - radius |
---|
[d49ca5c] | 106 | pars = dict( |
---|
| 107 | radius=radius, |
---|
| 108 | thickness=thickness, |
---|
| 109 | ) |
---|
| 110 | return pars |
---|
| 111 | |
---|
[40a87fa] | 112 | tests = [ |
---|
[304c775] | 113 | [{'radius': 20.0, 'thickness': 10.0}, 0.1, None, None, 30.0, 4.*pi/3*30**3, 1.0], |
---|
[8f04da4] | 114 | |
---|
| 115 | # The SasView test result was 0.00169, with a background of 0.001 |
---|
| 116 | [{'radius': 60.0, 'thickness': 10.0, 'sld_core': 1.0, 'sld_shell': 2.0, |
---|
| 117 | 'sld_solvent': 3.0, 'background': 0.0}, 0.4, 0.000698838], |
---|
[40a87fa] | 118 | ] |
---|