Changes in / [475ff58:1a3c0c6] in sasmodels
- Location:
- sasmodels/models
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/core_shell_cylinder.py
r2d81cfe re31b19a 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. 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. 8 14 9 15 .. math:: … … 33 39 34 40 and $\alpha$ is the angle between the axis of the cylinder and $\vec q$, 35 $V_s$ is the volume of the outer shell (i.e. the total volume, including36 the shell),$V_c$ is the volume of the core, $L$ is the length of the core,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, 37 43 $R$ is the radius of the core, $T$ is the thickness of the shell, $\rho_c$ 38 44 is the scattering length density of the core, $\rho_s$ is the scattering … … 135 141 return 0.5 * (ddd) ** (1. / 3.) 136 142 137 def VR(radius, thickness, length):138 """139 Returns volume ratio140 """141 whole = pi * (radius + thickness) ** 2 * (length + 2 * thickness)142 core = pi * radius ** 2 * length143 return whole, whole - core144 145 143 def random(): 146 144 outer_radius = 10**np.random.uniform(1, 4.7) -
sasmodels/models/core_shell_sphere.py
rdc76240 rda1c8d1 89 89 return radius + thickness 90 90 91 def VR(radius, thickness):92 """93 Volume ratio94 @param radius: core radius95 @param thickness: shell thickness96 """97 return (1, 1)98 whole = 4.0/3.0 * pi * (radius + thickness)**399 core = 4.0/3.0 * pi * radius**3100 return whole, whole - core101 102 91 def random(): 103 92 outer_radius = 10**np.random.uniform(1.3, 4.3) … … 114 103 tests = [ 115 104 [{'radius': 20.0, 'thickness': 10.0}, 'ER', 30.0], 116 # TODO: VR test suppressed until we sort out new product model117 # and determine what to do with volume ratio.118 #[{'radius': 20.0, 'thickness': 10.0}, 'VR', 0.703703704],119 105 120 106 # The SasView test result was 0.00169, with a background of 0.001 -
sasmodels/models/fractal_core_shell.py
ref07e95 reb3eb38 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", "", 1.0, [0.0, inf], "", "Volume fraction of building block spheres"],90 ["volfraction", "", 0.05, [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 136 tests = [[{'radius': 20.0, 'thickness': 10.0}, 'ER', 30.0], 145 137 146 tests = [[{'radius': 20.0, 'thickness': 10.0}, 'ER', 30.0], 147 [{'radius': 20.0, 'thickness': 10.0}, 'VR', 0.703703704]] 148 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]] 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]]] -
sasmodels/models/hollow_cylinder.py
r2d81cfe r455aaa1 1 1 r""" 2 Definition 3 ---------- 4 2 5 This model provides the form factor, $P(q)$, for a monodisperse hollow right 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). 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). 5 9 6 10 .. math:: … … 8 12 P(q) = \text{scale} \left<F^2\right>/V_\text{shell} + \text{background} 9 13 10 where the averaging $\left<\ldots\right>$ is applied only for the 1D calculation. 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. 11 25 12 The inside and outside of the hollow cylinder are assumed have the same SLD.13 14 Definition15 ----------16 26 17 27 The 1D scattering intensity is calculated in the following way (Guinier, 1955) … … 48 58 ---------- 49 59 50 L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and51 Neutron Scattering*, Plenum Press, New York, (1987)60 .. [#] L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and 61 Neutron Scattering*, Plenum Press, New York, (1987) 52 62 53 63 Authorship and Verification … … 55 65 56 66 * **Author:** NIST IGOR/DANSE **Date:** pre 2010 57 * **Last Modified by:** Richard Heenan **Date:** October 06, 201658 ( reparametrised to use thickness, not outer radius)59 * **Last Reviewed by:** Richard Heenan **Date:** October 06, 201667 * **Last Modified by:** Paul Butler **Date:** September 06, 2018 68 (corrected VR calculation) 69 * **Last Reviewed by:** Paul Butler **Date:** September 06, 2018 60 70 """ 61 71 … … 120 130 vol_total = pi*router*router*length 121 131 vol_shell = vol_total - vol_core 122 return vol_ shell, vol_total132 return vol_total, vol_shell 123 133 124 134 def random(): … … 151 161 tests = [ 152 162 [{}, 0.00005, 1764.926], 153 [{}, 'VR', 1.8],163 [{}, 'VR', 0.55555556], 154 164 [{}, 0.001, 1756.76], 155 165 [{}, (qx, qy), 2.36885476192], -
sasmodels/models/hollow_rectangular_prism.py
r2d81cfe r455aaa1 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 rectangular6 parallelepiped with a wall of thickness $\Delta$.7 8 9 4 Definition 10 5 ---------- 11 6 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). 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). 16 12 17 13 As in the case of the massive parallelepiped model (:ref:`rectangular-prism`), … … 61 57 \rho_\text{solvent})^2 \times P(q) + \text{background} 62 58 63 where $\rho_\text{p}$ is the scattering length of the parallelepiped,64 $\rho_\text{solvent}$ is the scattering length of the solvent,59 where $\rho_\text{p}$ is the scattering length density of the parallelepiped, 60 $\rho_\text{solvent}$ is the scattering length density of the solvent, 65 61 and (if the data are in absolute units) *scale* represents the volume fraction 66 (which is unitless). 62 (which is unitless) of the rectangular shell of material (i.e. not including 63 the volume of the solvent filled core). 67 64 68 65 For 2d data the orientation of the particle is required, described using … … 73 70 74 71 For 2d, constraints must be applied during fitting to ensure that the inequality 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. 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. 77 75 78 76 .. figure:: img/parallelepiped_angle_definition.png … … 99 97 ---------- 100 98 101 R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854 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 102 108 """ 103 109 -
sasmodels/models/hollow_rectangular_prism_thin_walls.py
r2d81cfe r6e7d7b6 2 2 # Note: model title and parameter table are inserted automatically 3 3 r""" 4 Definition 5 ---------- 6 4 7 5 8 This model provides the form factor, $P(q)$, for a hollow rectangular 6 9 prism with infinitely thin walls. It computes only the 1D scattering, not the 2D. 7 8 9 Definition10 ----------11 12 10 The 1D scattering intensity for this model is calculated according to the 13 equations given by Nayuk and Huber (Nayuk, 2012).11 equations given by Nayuk and Huber\ [#Nayuk2012]_. 14 12 15 13 Assuming a hollow parallelepiped with infinitely thin walls, edge lengths … … 55 53 I(q) = \text{scale} \times V \times (\rho_\text{p} - \rho_\text{solvent})^2 \times P(q) 56 54 57 where $V$ is the volumeof 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 absolute60 units) *scale* represents the volume fraction (which is unitless).55 where $V$ is the surface area of the rectangular prism, $\rho_\text{p}$ 56 is the scattering length density of the parallelepiped, $\rho_\text{solvent}$ 57 is the scattering length density of the solvent, and (if the data are in 58 absolute units) *scale* is related to the total surface area. 61 59 62 60 **The 2D scattering intensity is not computed by this model.** … … 67 65 68 66 Validation of the code was conducted by qualitatively comparing the output 69 of the 1D model to the curves shown in (Nayuk, 2012 ).67 of the 1D model to the curves shown in (Nayuk, 2012\ [#Nayuk2012]_). 70 68 71 69 … … 73 71 ---------- 74 72 75 R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854 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 76 82 """ 77 83 -
sasmodels/models/spherical_sld.py
r2d81cfe r5601947 1 1 r""" 2 Definition 3 ---------- 4 2 5 Similarly to the onion, this model provides the form factor, $P(q)$, for 3 6 a multi-shell sphere, where the interface between the each neighboring … … 16 19 interface. The form factor is normalized by the total volume of the sphere. 17 20 18 Interface shapes are as follows: :21 Interface shapes are as follows: 19 22 20 23 0: erf($\nu z$) 24 21 25 1: Rpow($z^\nu$) 26 22 27 2: Lpow($z^\nu$) 28 23 29 3: Rexp($-\nu z$) 30 24 31 4: Lexp($-\nu z$) 25 26 Definition27 ----------28 32 29 33 The form factor $P(q)$ in 1D is calculated by: … … 174 178 when $P(Q) * S(Q)$ is applied. 175 179 180 176 181 References 177 182 ---------- 178 L A Feigin and D I Svergun, Structure Analysis by Small-Angle X-Ray 179 and Neutron Scattering, Plenum Press, New York, (1987) 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 180 194 """ 181 195 -
sasmodels/models/vesicle.py
ref07e95 rb477605 3 3 ---------- 4 4 5 The 1D scattering intensity is calculated in the following way (Guinier, 1955) 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]_) 6 10 7 11 .. math:: … … 53 57 ---------- 54 58 55 A Guinier and G. Fournet, *Small-Angle Scattering of X-Rays*, John Wiley and 56 Sons, New York, (1955) 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 ---------------------------- 57 65 58 66 * **Author:** NIST IGOR/DANSE **Date:** pre 2010 59 67 * **Last Modified by:** Paul Butler **Date:** March 20, 2016 60 * **Last Reviewed by:** Paul Butler **Date:** March 20, 201668 * **Last Reviewed by:** Paul Butler **Date:** September 7, 2018 61 69 """ 62 70 … … 65 73 66 74 name = "vesicle" 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." 75 title = "Vesicle model representing a hollow sphere" 71 76 description = """ 72 77 Model parameters:
Note: See TracChangeset
for help on using the changeset viewer.