[f7930be] | 1 | r""" |
---|
| 2 | Definition |
---|
| 3 | ---------- |
---|
| 4 | |
---|
| 5 | This model is a trivial extension of the CoreShell function to a larger number |
---|
| 6 | of shells. The scattering length density profile for the default sld values |
---|
| 7 | (w/ 4 shells). |
---|
| 8 | |
---|
| 9 | .. figure:: img/core_multi_shell_sld_default_profile.jpg |
---|
| 10 | |
---|
| 11 | SLD profile of the core_multi_shell object from the center of sphere out |
---|
| 12 | for the default SLDs.* |
---|
| 13 | |
---|
[263daec] | 14 | The 2D scattering intensity is the same as $P(q)$ above, regardless of the |
---|
| 15 | orientation of the $q$ vector which is defined as |
---|
[f7930be] | 16 | |
---|
| 17 | .. math:: |
---|
| 18 | |
---|
| 19 | q = \sqrt{q_x^2 + q_y^2} |
---|
| 20 | |
---|
| 21 | .. note:: **Be careful!** The SLDs and scale can be highly correlated. Hold as |
---|
| 22 | many of these parameters fixed as possible. |
---|
| 23 | |
---|
| 24 | .. note:: The outer most radius (= *radius* + *thickness*) is used as the |
---|
[263daec] | 25 | effective radius for $S(Q)$ when $P(Q)*S(Q)$ is applied. |
---|
[f7930be] | 26 | |
---|
[34edbb8] | 27 | For information about polarised and magnetic scattering, see |
---|
[b274bec] | 28 | the :doc:`magnetic help <../sasgui/perspectives/fitting/mag_help>` documentation. |
---|
[f7930be] | 29 | |
---|
| 30 | Our model uses the form factor calculations implemented in a c-library provided |
---|
| 31 | by the NIST Center for Neutron Research (Kline, 2006). |
---|
| 32 | |
---|
| 33 | References |
---|
| 34 | ---------- |
---|
[34edbb8] | 35 | See the :ref:`core_shell_sphere <core_shell_sphere>` model documentation. |
---|
[f7930be] | 36 | |
---|
| 37 | L A Feigin and D I Svergun, |
---|
| 38 | *Structure Analysis by Small-Angle X-Ray and Neutron Scattering*, |
---|
| 39 | Plenum Press, New York, 1987. |
---|
| 40 | |
---|
| 41 | **Author:** NIST IGOR/DANSE **on:** pre 2010 |
---|
| 42 | |
---|
| 43 | **Last Modified by:** in progress **on:** March 20, 2016 |
---|
| 44 | |
---|
| 45 | **Last Reviewed by:** in progress **on:** March 20, 2016 |
---|
| 46 | """ |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | |
---|
| 50 | from __future__ import division |
---|
| 51 | |
---|
| 52 | import numpy as np |
---|
| 53 | from numpy import inf, nan |
---|
| 54 | from math import fabs, exp, expm1 |
---|
| 55 | |
---|
| 56 | name = "core_multi_shell" |
---|
| 57 | title = "This model provides the scattering from a spherical core with 1 to 4 \ |
---|
| 58 | concentric shell structures. The SLDs of the core and each shell are \ |
---|
| 59 | individually specified." |
---|
| 60 | |
---|
| 61 | description = """\ |
---|
| 62 | Form factor for a core muti-shell (up to 4) sphere normalized by the volume. |
---|
| 63 | Each shell can have a unique thickness and sld. |
---|
| 64 | |
---|
| 65 | background:background, |
---|
| 66 | rad_core0: radius of sphere(core) |
---|
| 67 | thick_shell#:the thickness of the shell# |
---|
| 68 | sld_core0: the SLD of the sphere |
---|
| 69 | sld_solv: the SLD of the solvent |
---|
| 70 | sld_shell: the SLD of the shell# |
---|
| 71 | A_shell#: the coefficient in the exponential function |
---|
| 72 | |
---|
| 73 | |
---|
| 74 | scale: 1.0 if data is on absolute scale |
---|
| 75 | volfraction: volume fraction of spheres |
---|
| 76 | radius: the radius of the core |
---|
| 77 | sld: the SLD of the core |
---|
| 78 | thick_shelli: the thickness of the i'th shell from the core |
---|
| 79 | sld_shelli: the SLD of the i'th shell from the core |
---|
| 80 | sld_solvent: the SLD of the solvent |
---|
| 81 | background: incoherent background |
---|
| 82 | |
---|
| 83 | """ |
---|
| 84 | |
---|
| 85 | category = "shape:sphere" |
---|
| 86 | |
---|
| 87 | |
---|
| 88 | # ["name", "units", default, [lower, upper], "type","description"], |
---|
[c5ac2b2] | 89 | parameters = [["sld_core", "1e-6/Ang^2", 1.0, [-inf, inf], "", |
---|
[f7930be] | 90 | "Core scattering length density"], |
---|
[6f0e04f] | 91 | ["radius", "Ang", 200., [0, inf], "volume", |
---|
[f7930be] | 92 | "Radius of the core"], |
---|
| 93 | ["sld_solvent", "1e-6/Ang^2", 6.4, [-inf, inf], "", |
---|
| 94 | "Solvent scattering length density"], |
---|
[c5ac2b2] | 95 | ["n", "", 1, [0, 10], "volume", |
---|
[f7930be] | 96 | "number of shells"], |
---|
[6f0e04f] | 97 | ["sld[n]", "1e-6/Ang^2", 1.7, [-inf, inf], "", |
---|
[f7930be] | 98 | "scattering length density of shell k"], |
---|
[6f0e04f] | 99 | ["thickness[n]", "Ang", 40., [0, inf], "volume", |
---|
[f7930be] | 100 | "Thickness of shell k"], |
---|
| 101 | ] |
---|
| 102 | |
---|
[c5ac2b2] | 103 | source = ["lib/sph_j1c.c", "core_multi_shell.c"] |
---|
[f7930be] | 104 | |
---|
[c5ac2b2] | 105 | def profile(sld_core, radius, sld_solvent, n, sld, thickness): |
---|
[f7930be] | 106 | """ |
---|
| 107 | SLD profile |
---|
| 108 | |
---|
| 109 | :return: (r, beta) where r is a list of radius of the transition points\ |
---|
| 110 | and beta is a list of the corresponding SLD values. |
---|
| 111 | |
---|
| 112 | """ |
---|
[6f0e04f] | 113 | total_radius = 1.25*(sum(thickness[:n]) + radius + 1) |
---|
[f7930be] | 114 | |
---|
| 115 | r = [] |
---|
| 116 | beta = [] |
---|
| 117 | |
---|
| 118 | # add in the core |
---|
| 119 | r.append(0) |
---|
| 120 | beta.append(sld) |
---|
| 121 | r.append(radius) |
---|
| 122 | beta.append(sld) |
---|
| 123 | |
---|
| 124 | # add in the shells |
---|
| 125 | for k in range(n): |
---|
| 126 | # Left side of each shells |
---|
| 127 | r0 = r[-1] |
---|
| 128 | r.append(r0) |
---|
[6f0e04f] | 129 | beta.append(sld[k]) |
---|
[f7930be] | 130 | r.append(r0 + thickness[k]) |
---|
[6f0e04f] | 131 | beta.append(sld[k]) |
---|
[c5ac2b2] | 132 | # add in the solvent |
---|
[f7930be] | 133 | r.append(r[-1]) |
---|
[6f0e04f] | 134 | beta.append(sld_solvent) |
---|
[f7930be] | 135 | r.append(total_radius) |
---|
[6f0e04f] | 136 | beta.append(sld_solvent) |
---|
[f7930be] | 137 | |
---|
| 138 | return np.asarray(r), np.asarray(beta) |
---|
| 139 | |
---|
[6f0e04f] | 140 | def ER(radius, n, thickness): |
---|
| 141 | n = n[0] # n cannot be polydisperse |
---|
| 142 | return np.sum(thickness[:n], axis=0) + radius |
---|
[f7930be] | 143 | |
---|
[46ed760] | 144 | def VR(radius, n, thickness): |
---|
[6f0e04f] | 145 | return 1.0, 1.0 |
---|
[f7930be] | 146 | |
---|
[c5ac2b2] | 147 | demo = dict(sld_core = 6.4, |
---|
[f7930be] | 148 | radius = 60, |
---|
| 149 | sld_solvent = 6.4, |
---|
[c5ac2b2] | 150 | n = 2, |
---|
| 151 | sld = [2.0, 3.0], |
---|
| 152 | thickness = 20, |
---|
| 153 | thickness1_pd = 0.3, |
---|
| 154 | thickness2_pd = 0.3, |
---|
| 155 | thickness1_pd_n = 10, |
---|
| 156 | thickness2_pd_n = 10, |
---|
| 157 | ) |
---|