Changes in sasmodels/models/hollow_cylinder.py [aea2e2a:a807206] in sasmodels
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified sasmodels/models/hollow_cylinder.py ¶
raea2e2a ra807206 1 1 r""" 2 2 This model provides the form factor, $P(q)$, for a monodisperse hollow right 3 angle circular cylinder ( rigidtube) where the form factor is normalized by the4 volume of the tube (i.e. not by the external volume).3 angle circular cylinder (tube) where the form factor is normalized by the 4 volume of the tube 5 5 6 6 .. math:: … … 21 21 P(q) &= (\text{scale})V_\text{shell}\Delta\rho^2 22 22 \int_0^{1}\Psi^2 23 \left[q_z, R_\text{ outer}(1-x^2)^{1/2},23 \left[q_z, R_\text{shell}(1-x^2)^{1/2}, 24 24 R_\text{core}(1-x^2)^{1/2}\right] 25 25 \left[\frac{\sin(qHx)}{qHx}\right]^2 dx \\ … … 27 27 \left[ \Lambda(qy) - \gamma^2\Lambda(qz) \right] \\ 28 28 \Lambda(a) &= 2 J_1(a) / a \\ 29 \gamma &= R_\text{core} / R_\text{ outer} \\30 V_\text{shell} &= \pi \left(R_\text{ outer}^2 - R_\text{core}^2 \right)L \\29 \gamma &= R_\text{core} / R_\text{shell} \\ 30 V_\text{shell} &= \pi \left(R_\text{shell}^2 - R_\text{core}^2 \right)L \\ 31 31 J_1(x) &= (\sin(x)-x\cdot \cos(x)) / x^2 32 32 … … 35 35 36 36 **NB**: The 2nd virial coefficient of the cylinder is calculated 37 based on the outer radius and full length, which give anthe effective radius38 for structure factor$S(q)$ when $P(q) \cdot S(q)$ is applied.37 based on the radius and 2 length values, and used as the effective radius 38 for $S(q)$ when $P(q) \cdot S(q)$ is applied. 39 39 40 In the parameters,the *radius* is $R_\text{core}$ while *thickness* is $R_\text{outer} - R_\text{core}$. 40 In the parameters, the contrast represents SLD :sub:`shell` - SLD :sub:`solvent` 41 and the *radius* is $R_\text{shell}$ while *radius_core* is $R_\text{core}$. 41 42 42 43 To provide easy access to the orientation of the core-shell cylinder, we define … … 49 50 L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and 50 51 Neutron Scattering*, Plenum Press, New York, (1987) 51 52 Authorship and Verification53 ----------------------------54 55 * **Author:** NIST IGOR/DANSE **Date:** pre 201056 * **Last Modified by:** Richard Heenan **Date:** October 06, 201657 (reparametrised to use thickness, not outer radius)58 * **Last Reviewed by:** Richard Heenan **Date:** October 06, 201659 60 52 """ 61 53 … … 66 58 description = """ 67 59 P(q) = scale*<f*f>/Vol + background, where f is the scattering amplitude. 68 radius = the radius of core69 thickness = the thickness of shell60 radius_core = the radius of core 61 radius = the radius of shell 70 62 length = the total length of the cylinder 71 63 sld = SLD of the shell … … 77 69 # ["name", "units", default, [lower, upper], "type","description"], 78 70 parameters = [ 79 ["radius", "Ang", 20.0, [0, inf], "volume", "Cylinder coreradius"],80 [" thickness", "Ang", 10.0, [0, inf], "volume", "Cylinder wall thickness"],81 ["length", "Ang", 400.0, [0, inf], "volume", "Cylinder totallength"],71 ["radius", "Ang", 30.0, [0, inf], "volume", "Cylinder radius"], 72 ["radius_core", "Ang", 20.0, [0, inf], "volume", "Hollow core radius"], 73 ["length", "Ang", 400.0, [0, inf], "volume", "Cylinder length"], 82 74 ["sld", "1/Ang^2", 6.3, [-inf, inf], "sld", "Cylinder sld"], 83 75 ["sld_solvent", "1/Ang^2", 1, [-inf, inf], "sld", "Solvent sld"], … … 90 82 91 83 # pylint: disable=W0613 92 def ER(radius, thickness, length):84 def ER(radius, radius_core, length): 93 85 """ 94 :param radius: Cylinder coreradius95 :param thickness: Cylinder wall thickness86 :param radius: Cylinder radius 87 :param radius_core: Hollow core radius, UNUSED 96 88 :param length: Cylinder length 97 89 :return: Effective radius 98 90 """ 99 router = radius + thickness 100 if router == 0 or length == 0: 91 if radius == 0 or length == 0: 101 92 return 0.0 102 len1 = r outer93 len1 = radius 103 94 len2 = length/2.0 104 95 term1 = len1*len1*2.0*len2/2.0 … … 108 99 return diam 109 100 110 def VR(radius, thickness, length):101 def VR(radius, radius_core, length): 111 102 """ 112 103 :param radius: Cylinder radius 113 :param thickness: Cylinder wall thickness104 :param radius_core: Hollow core radius 114 105 :param length: Cylinder length 115 106 :return: Volf ratio for P(q)*S(q) 116 107 """ 117 router = radius + thickness 118 vol_core = pi*radius*radius*length 119 vol_total = pi*router*router*length 108 vol_core = pi*radius_core*radius_core*length 109 vol_total = pi*radius*radius*length 120 110 vol_shell = vol_total - vol_core 121 111 return vol_shell, vol_total 122 112 123 113 # parameters for demo 124 demo = dict(scale=1.0, background=0.0, length=400.0, radius= 20.0,125 thickness=10, sld=6.3, sld_solvent=1, theta=90, phi=0,126 thickness_pd=0.2, thickness_pd_n=9,114 demo = dict(scale=1.0, background=0.0, length=400.0, radius=30.0, 115 radius_core=20.0, sld=6.3, sld_solvent=1, theta=90, phi=0, 116 radius_pd=.2, radius_pd_n=9, 127 117 length_pd=.2, length_pd_n=10, 128 radius_ pd=.2, radius_pd_n=9,118 radius_core_pd=.2, radius_core_pd_n=9, 129 119 theta_pd=10, theta_pd_n=5, 130 120 ) … … 132 122 # Parameters for unit tests 133 123 tests = [ 134 [{ }, 0.00005, 1764.926],124 [{"radius": 30.0}, 0.00005, 1764.926], 135 125 [{}, 'VR', 1.8], 136 126 [{}, 0.001, 1756.76]
Note: See TracChangeset
for help on using the changeset viewer.