Changes in / [1a3c0c6:475ff58] in sasmodels
- Location:
- sasmodels/models
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/core_shell_cylinder.py
re31b19a r2d81cfe 5 5 The output of the 2D scattering intensity function for oriented core-shell 6 6 cylinders is given by (Kline, 2006 [#kline]_). The form factor is normalized 7 by the particle volume. Note that in this model the shell envelops the entire 8 core so that besides a "sleeve" around the core, the shell also provides two 9 flat end caps of thickness = shell thickness. In other words the length of the 10 total cyclinder is the length of the core cylinder plus twice the thickness of 11 the shell. If no end caps are desired one should use the 12 :ref:`core-shell-bicelle` and set the thickness of the end caps (in this case 13 the "thick_face") to zero. 7 by the particle volume. 14 8 15 9 .. math:: … … 39 33 40 34 and $\alpha$ is the angle between the axis of the cylinder and $\vec q$, 41 $V_s$ is the total volume (i.e. including both the core and the outer shell),42 $V_c$ is the volume of the core, $L$ is the length of the core,35 $V_s$ is the volume of the outer shell (i.e. the total volume, including 36 the shell), $V_c$ is the volume of the core, $L$ is the length of the core, 43 37 $R$ is the radius of the core, $T$ is the thickness of the shell, $\rho_c$ 44 38 is the scattering length density of the core, $\rho_s$ is the scattering … … 141 135 return 0.5 * (ddd) ** (1. / 3.) 142 136 137 def VR(radius, thickness, length): 138 """ 139 Returns volume ratio 140 """ 141 whole = pi * (radius + thickness) ** 2 * (length + 2 * thickness) 142 core = pi * radius ** 2 * length 143 return whole, whole - core 144 143 145 def random(): 144 146 outer_radius = 10**np.random.uniform(1, 4.7) -
sasmodels/models/core_shell_sphere.py
rda1c8d1 rdc76240 89 89 return radius + thickness 90 90 91 def VR(radius, thickness): 92 """ 93 Volume ratio 94 @param radius: core radius 95 @param thickness: shell thickness 96 """ 97 return (1, 1) 98 whole = 4.0/3.0 * pi * (radius + thickness)**3 99 core = 4.0/3.0 * pi * radius**3 100 return whole, whole - core 101 91 102 def random(): 92 103 outer_radius = 10**np.random.uniform(1.3, 4.3) … … 103 114 tests = [ 104 115 [{'radius': 20.0, 'thickness': 10.0}, 'ER', 30.0], 116 # TODO: VR test suppressed until we sort out new product model 117 # and determine what to do with volume ratio. 118 #[{'radius': 20.0, 'thickness': 10.0}, 'VR', 0.703703704], 105 119 106 120 # The SasView test result was 0.00169, with a background of 0.001 -
sasmodels/models/fractal_core_shell.py
reb3eb38 ref07e95 88 88 ["sld_shell", "1e-6/Ang^2", 2.0, [-inf, inf], "sld", "Sphere shell scattering length density"], 89 89 ["sld_solvent", "1e-6/Ang^2", 3.0, [-inf, inf], "sld", "Solvent scattering length density"], 90 ["volfraction", "", 0.05, [0.0, inf], "", "Volume fraction of building block spheres"],90 ["volfraction", "", 1.0, [0.0, inf], "", "Volume fraction of building block spheres"], 91 91 ["fractal_dim", "", 2.0, [0.0, 6.0], "", "Fractal dimension"], 92 92 ["cor_length", "Ang", 100.0, [0.0, inf], "", "Correlation length of fractal-like aggregates"], … … 134 134 return radius + thickness 135 135 136 def VR(radius, thickness): 137 """ 138 Volume ratio 139 @param radius: core radius 140 @param thickness: shell thickness 141 """ 142 whole = 4.0/3.0 * pi * (radius + thickness)**3 143 core = 4.0/3.0 * pi * radius**3 144 return whole, whole-core 145 136 146 tests = [[{'radius': 20.0, 'thickness': 10.0}, 'ER', 30.0], 147 [{'radius': 20.0, 'thickness': 10.0}, 'VR', 0.703703704]] 137 148 138 # # At some point the SasView 3.x test result was deemed incorrect. The 139 #following tests were verified against NIST IGOR macros ver 7.850. 140 #NOTE: NIST macros do only provide for a polydispers core (no option 141 #for a poly shell or for a monodisperse core. The results seemed 142 #extremely sensitive to the core PD, varying non monotonically all 143 #the way to a PD of 1e-6. From 1e-6 to 1e-9 no changes in the 144 #results were observed and the values below were taken using PD=1e-9. 145 #Non-monotonically = I(0.001)=188 to 140 to 177 back to 160 etc. 146 [{'radius': 20.0, 147 'thickness': 5.0, 148 'sld_core': 3.5, 149 'sld_shell': 1.0, 150 'sld_solvent': 6.35, 151 'volfraction': 0.05, 152 'background': 0.0}, 153 [0.001,0.00291,0.0107944,0.029923,0.100726,0.476304], 154 [177.146,165.151,84.1596,20.1466,1.40906,0.00622666]]] 149 # # The SasView test result was 0.00169, with a background of 0.001 150 # # They are however wrong as we now know. IGOR might be a more 151 # # appropriate source. Otherwise will just have to assume this is now 152 # # correct and self generate a correct answer for the future. Until we 153 # # figure it out leave the tests commented out 154 # [{'radius': 60.0, 155 # 'thickness': 10.0, 156 # 'sld_core': 1.0, 157 # 'sld_shell': 2.0, 158 # 'sld_solvent': 3.0, 159 # 'background': 0.0 160 # }, 0.015211, 692.84]] -
sasmodels/models/hollow_cylinder.py
r455aaa1 r2d81cfe 1 1 r""" 2 Definition3 ----------4 5 2 This model provides the form factor, $P(q)$, for a monodisperse hollow right 6 angle circular cylinder (rigid tube) where the The inside and outside of the 7 hollow cylinder are assumed to have the same SLD and the form factor is thus 8 normalized by the volume of the tube (i.e. not by the total cylinder volume). 3 angle circular cylinder (rigid tube) where the form factor is normalized by the 4 volume of the tube (i.e. not by the external volume). 9 5 10 6 .. math:: … … 12 8 P(q) = \text{scale} \left<F^2\right>/V_\text{shell} + \text{background} 13 9 14 where the averaging $\left<\ldots\right>$ is applied only for the 1D 15 calculation. If Intensity is given on an absolute scale, the scale factor here 16 is the volume fraction of the shell. This differs from 17 the :ref:`core-shell-cylinder` in that, in that case, scale is the volume 18 fraction of the entire cylinder (core+shell). The application might be for a 19 bilayer which wraps into a hollow tube and the volume fraction of material is 20 all in the shell, whereas the :ref:`core-shell-cylinder` model might be used for 21 a cylindrical micelle where the tails in the core have a different SLD than the 22 headgroups (in the shell) and the volume fraction of material comes fromm the 23 whole cyclinder. NOTE: the hollow_cylinder represents a tube whereas the 24 core_shell_cylinder includes a shell layer covering the ends (end caps) as well. 10 where the averaging $\left<\ldots\right>$ is applied only for the 1D calculation. 25 11 12 The inside and outside of the hollow cylinder are assumed have the same SLD. 13 14 Definition 15 ---------- 26 16 27 17 The 1D scattering intensity is calculated in the following way (Guinier, 1955) … … 58 48 ---------- 59 49 60 .. [#]L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and61 50 L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and 51 Neutron Scattering*, Plenum Press, New York, (1987) 62 52 63 53 Authorship and Verification … … 65 55 66 56 * **Author:** NIST IGOR/DANSE **Date:** pre 2010 67 * **Last Modified by:** Paul Butler **Date:** September 06, 201868 ( corrected VR calculation)69 * **Last Reviewed by:** Paul Butler **Date:** September 06, 201857 * **Last Modified by:** Richard Heenan **Date:** October 06, 2016 58 (reparametrised to use thickness, not outer radius) 59 * **Last Reviewed by:** Richard Heenan **Date:** October 06, 2016 70 60 """ 71 61 … … 130 120 vol_total = pi*router*router*length 131 121 vol_shell = vol_total - vol_core 132 return vol_ total, vol_shell122 return vol_shell, vol_total 133 123 134 124 def random(): … … 161 151 tests = [ 162 152 [{}, 0.00005, 1764.926], 163 [{}, 'VR', 0.55555556],153 [{}, 'VR', 1.8], 164 154 [{}, 0.001, 1756.76], 165 155 [{}, (qx, qy), 2.36885476192], -
sasmodels/models/hollow_rectangular_prism.py
r455aaa1 r2d81cfe 2 2 # Note: model title and parameter table are inserted automatically 3 3 r""" 4 5 This model provides the form factor, $P(q)$, for a hollow rectangular 6 parallelepiped with a wall of thickness $\Delta$. 7 8 4 9 Definition 5 10 ---------- 6 11 7 This model provides the form factor, $P(q)$, for a hollow rectangular 8 parallelepiped with a wall of thickness $\Delta$. The 1D scattering intensity 9 for this model is calculated by forming the difference of the amplitudes of two 10 massive parallelepipeds differing in their outermost dimensions in each 11 direction by the same length increment $2\Delta$ (\ [#Nayuk2012]_ Nayuk, 2012). 12 The 1D scattering intensity for this model is calculated by forming 13 the difference of the amplitudes of two massive parallelepipeds 14 differing in their outermost dimensions in each direction by the 15 same length increment $2\Delta$ (Nayuk, 2012). 12 16 13 17 As in the case of the massive parallelepiped model (:ref:`rectangular-prism`), … … 57 61 \rho_\text{solvent})^2 \times P(q) + \text{background} 58 62 59 where $\rho_\text{p}$ is the scattering length densityof the parallelepiped,60 $\rho_\text{solvent}$ is the scattering length densityof the solvent,63 where $\rho_\text{p}$ is the scattering length of the parallelepiped, 64 $\rho_\text{solvent}$ is the scattering length of the solvent, 61 65 and (if the data are in absolute units) *scale* represents the volume fraction 62 (which is unitless) of the rectangular shell of material (i.e. not including 63 the volume of the solvent filled core). 66 (which is unitless). 64 67 65 68 For 2d data the orientation of the particle is required, described using … … 70 73 71 74 For 2d, constraints must be applied during fitting to ensure that the inequality 72 $A < B < C$ is not violated, and hence the correct definition of angles is 73 preserved. The calculation will not report an error if the inequality is *not* 74 preserved, but the results may be not correct. 75 $A < B < C$ is not violated, and hence the correct definition of angles is preserved. The calculation will not report an error, 76 but the results may be not correct. 75 77 76 78 .. figure:: img/parallelepiped_angle_definition.png … … 97 99 ---------- 98 100 99 .. [#Nayuk2012] R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854 100 101 102 Authorship and Verification 103 ---------------------------- 104 105 * **Author:** Miguel Gonzales **Date:** February 26, 2016 106 * **Last Modified by:** Paul Kienzle **Date:** December 14, 2017 107 * **Last Reviewed by:** Paul Butler **Date:** September 06, 2018 101 R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854 108 102 """ 109 103 -
sasmodels/models/hollow_rectangular_prism_thin_walls.py
r6e7d7b6 r2d81cfe 2 2 # Note: model title and parameter table are inserted automatically 3 3 r""" 4 5 This model provides the form factor, $P(q)$, for a hollow rectangular 6 prism with infinitely thin walls. It computes only the 1D scattering, not the 2D. 7 8 4 9 Definition 5 10 ---------- 6 11 7 8 This model provides the form factor, $P(q)$, for a hollow rectangular9 prism with infinitely thin walls. It computes only the 1D scattering, not the 2D.10 12 The 1D scattering intensity for this model is calculated according to the 11 equations given by Nayuk and Huber \ [#Nayuk2012]_.13 equations given by Nayuk and Huber (Nayuk, 2012). 12 14 13 15 Assuming a hollow parallelepiped with infinitely thin walls, edge lengths … … 53 55 I(q) = \text{scale} \times V \times (\rho_\text{p} - \rho_\text{solvent})^2 \times P(q) 54 56 55 where $V$ is the surface areaof the rectangular prism, $\rho_\text{p}$56 is the scattering length densityof the parallelepiped, $\rho_\text{solvent}$57 is the scattering length density of the solvent, and (if the data are in58 absolute units) *scale* is related to the total surface area.57 where $V$ is the volume of the rectangular prism, $\rho_\text{p}$ 58 is the scattering length of the parallelepiped, $\rho_\text{solvent}$ 59 is the scattering length of the solvent, and (if the data are in absolute 60 units) *scale* represents the volume fraction (which is unitless). 59 61 60 62 **The 2D scattering intensity is not computed by this model.** … … 65 67 66 68 Validation of the code was conducted by qualitatively comparing the output 67 of the 1D model to the curves shown in (Nayuk, 2012 \ [#Nayuk2012]_).69 of the 1D model to the curves shown in (Nayuk, 2012). 68 70 69 71 … … 71 73 ---------- 72 74 73 .. [#Nayuk2012] R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854 74 75 76 Authorship and Verification 77 ---------------------------- 78 79 * **Author:** Miguel Gonzales **Date:** February 26, 2016 80 * **Last Modified by:** Paul Kienzle **Date:** October 15, 2016 81 * **Last Reviewed by:** Paul Butler **Date:** September 07, 2018 75 R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854 82 76 """ 83 77 -
sasmodels/models/spherical_sld.py
r5601947 r2d81cfe 1 1 r""" 2 Definition3 ----------4 5 2 Similarly to the onion, this model provides the form factor, $P(q)$, for 6 3 a multi-shell sphere, where the interface between the each neighboring … … 19 16 interface. The form factor is normalized by the total volume of the sphere. 20 17 21 Interface shapes are as follows: 18 Interface shapes are as follows:: 22 19 23 20 0: erf($\nu z$) 24 25 21 1: Rpow($z^\nu$) 26 27 22 2: Lpow($z^\nu$) 28 29 23 3: Rexp($-\nu z$) 30 31 24 4: Lexp($-\nu z$) 25 26 Definition 27 ---------- 32 28 33 29 The form factor $P(q)$ in 1D is calculated by: … … 178 174 when $P(Q) * S(Q)$ is applied. 179 175 180 181 176 References 182 177 ---------- 183 184 .. [#] L A Feigin and D I Svergun, Structure Analysis by Small-Angle X-Ray 185 and Neutron Scattering, Plenum Press, New York, (1987) 186 187 188 Authorship and Verification 189 ---------------------------- 190 191 * **Author:** Jae-Hie Cho **Date:** Nov 1, 2010 192 * **Last Modified by:** Paul Kienzle **Date:** Dec 20, 2016 193 * **Last Reviewed by:** Paul Butler **Date:** September 8, 2018 178 L A Feigin and D I Svergun, Structure Analysis by Small-Angle X-Ray 179 and Neutron Scattering, Plenum Press, New York, (1987) 194 180 """ 195 181 -
sasmodels/models/vesicle.py
rb477605 ref07e95 3 3 ---------- 4 4 5 This model provides the form factor, *P(q)*, for an unilamellar vesicle and is 6 effectively identical to the hollow sphere reparameterized to be 7 more intuitive for a vesicle and normalizing the form factor by the volume of 8 the shell. The 1D scattering intensity is calculated in the following way 9 (Guinier,1955\ [#Guinier1955]_) 5 The 1D scattering intensity is calculated in the following way (Guinier, 1955) 10 6 11 7 .. math:: … … 57 53 ---------- 58 54 59 .. [#Guinier1955] A Guinier and G. Fournet, *Small-Angle Scattering of X-Rays*, John Wiley and 60 Sons, New York, (1955) 61 62 63 Authorship and Verification 64 ---------------------------- 55 A Guinier and G. Fournet, *Small-Angle Scattering of X-Rays*, John Wiley and 56 Sons, New York, (1955) 65 57 66 58 * **Author:** NIST IGOR/DANSE **Date:** pre 2010 67 59 * **Last Modified by:** Paul Butler **Date:** March 20, 2016 68 * **Last Reviewed by:** Paul Butler **Date:** September 7, 201860 * **Last Reviewed by:** Paul Butler **Date:** March 20, 2016 69 61 """ 70 62 … … 73 65 74 66 name = "vesicle" 75 title = "Vesicle model representing a hollow sphere" 67 title = "This model provides the form factor, *P(q)*, for an unilamellar \ 68 vesicle. This is model is effectively identical to the hollow sphere \ 69 reparameterized to be more intuitive for a vesicle and normalizing the \ 70 form factor by the volume of the shell." 76 71 description = """ 77 72 Model parameters:
Note: See TracChangeset
for help on using the changeset viewer.