Changes in / [3a8d205:8b10fdf] in sasmodels
- Location:
- sasmodels
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/compare.py
rbb2d187 r050c2c8 312 312 name = name.split('*')[0] 313 313 314 if name == 'capped_cylinder' and pars[' radius_cap'] < pars['radius']:315 pars['radius'], pars[' radius_cap'] = pars['radius_cap'], pars['radius']316 if name == 'barbell' and pars[' radius_bell'] < pars['radius']:317 pars['radius'], pars[' radius_bell'] = pars['radius_bell'], pars['radius']314 if name == 'capped_cylinder' and pars['cap_radius'] < pars['radius']: 315 pars['radius'], pars['cap_radius'] = pars['cap_radius'], pars['radius'] 316 if name == 'barbell' and pars['bell_radius'] < pars['radius']: 317 pars['radius'], pars['bell_radius'] = pars['bell_radius'], pars['radius'] 318 318 319 319 # Limit guinier to an Rg such that Iq > 1e-30 (single precision cutoff) -
sasmodels/models/adsorbed_layer.py
rb0c4271 r52ec91e 1 #adsorbed_layer model 2 #conversion of Core2ndMomentModel.py 3 #converted by Steve King, Mar 2016 4 1 5 r""" 2 Definition3 ----------4 5 6 This model describes the scattering from a layer of surfactant or polymer 6 7 adsorbed on large, smooth, notionally spherical particles under the conditions … … 18 19 the mean of the density distribution (ie, the distance of the centre-of-mass 19 20 of the distribution from the interface), $\sigma = \sqrt{t^2/12}$. 21 22 Definition 23 ---------- 20 24 21 25 .. math:: … … 40 44 calculation is exact). 41 45 42 The code for this model is based originally on a a fortran implementation by43 Steve King at ISIS in the SANDRA package c. 1990.44 45 46 References 46 47 ---------- 47 48 48 .. [#] S King, P Griffiths, J Hone, and T Cosgrove, *SANS from Adsorbed Polymer 49 Layers*, *Macromol. Symp.*, 190 (2002) 33-42. 50 51 Authorship and Verification 52 ---------------------------- 53 54 * **Author:** Jae-Hi Cho **Date:** pre 2010 55 * **Last Modified by:** Paul Kienzle **Date:** April 14, 2016 56 * **Last Reviewed by:** Steve King **Date:** March 18, 2016 49 S King, P Griffiths, J Hone, and T Cosgrove, 50 *SANS from Adsorbed Polymer Layers*, *Macromol. Symp.*, 190 (2002) 33-42. 57 51 """ 58 52 … … 86 80 def Iq(q, second_moment, adsorbed_amount, density_shell, radius, 87 81 volfraction, sld_shell, sld_solvent): 82 # pylint: disable = missing-docstring 83 #deltarhosqrd = (sld_shell - sld_solvent) * (sld_shell - sld_solvent) 84 #numerator = 6.0 * pi * volfraction * (adsorbed_amount * adsorbed_amount) 85 #denominator = (q * q) * (density_shell * density_shell) * radius 86 #eterm = exp(-1.0 * (q * q) * (second_moment * second_moment)) 87 ##scale by 10^-2 for units conversion to cm^-1 88 #inten = 1.0e-02 * deltarhosqrd * ((numerator / denominator) * eterm) 88 89 with errstate(divide='ignore'): 89 90 aa = ((sld_shell - sld_solvent)/density_shell * adsorbed_amount) / q -
sasmodels/models/barbell.py
rb0c4271 r2222134 1 #barbell model 2 # Note: model title and parameter table are inserted automatically 1 3 r""" 2 Definition3 ----------4 5 4 Calculates the scattering from a barbell-shaped cylinder. Like 6 5 :ref:`capped-cylinder`, this is a sphereocylinder with spherical end … … 8 7 of the end cap radius lying outside of the cylinder. See the diagram for 9 8 the details of the geometry and restrictions on parameter values. 9 10 Definition 11 ---------- 10 12 11 13 .. figure:: img/barbell_geometry.jpg … … 73 75 74 76 .. figure:: img/cylinder_angle_projection.jpg 75 :width: 600px76 77 77 78 Examples of the angles for oriented pp against the detector plane. … … 80 81 ---------- 81 82 82 .. [#] H Kaya, *J. Appl. Cryst.*, 37 (2004) 37 223-230 83 .. [#] H Kaya and N R deSouza, *J. Appl. Cryst.*, 37 (2004) 508-509 (addenda 84 and errata) 83 H Kaya, *J. Appl. Cryst.*, 37 (2004) 37 223-230 85 84 86 Authorship and Verification 87 ---------------------------- 88 89 * **Author:** NIST IGOR/DANSE **Date:** pre 2010 90 * **Last Modified by:** Paul Butler **Date:** March 20, 2016 91 * **Last Reviewed by:** Paul Butler **Date:** March 20, 2016 85 H Kaya and N R deSouza, *J. Appl. Cryst.*, 37 (2004) 508-509 (addenda and errata) 92 86 """ 93 87 from numpy import inf -
sasmodels/models/bcc_paracrystal.py
rb0c4271 r0bef47b 1 #bcc paracrystal model 2 #note model title and parameter table are automatically inserted 3 #note - calculation requires double precision 1 4 r""" 2 Definition3 ----------4 5 5 Calculates the scattering from a **body-centered cubic lattice** with 6 6 paracrystalline distortion. Thermal vibrations are considered to be negligible, 7 7 and the size of the paracrystal is infinitely large. Paracrystalline distortion 8 8 is assumed to be isotropic and characterized by a Gaussian distribution. 9 10 Definition 11 ---------- 9 12 10 13 The scattering intensity $I(q)$ is calculated as … … 20 23 is the paracrystalline structure factor for a body-centered cubic structure. 21 24 22 Equation (1) of the 1990 reference\ [#CIT1990]_ is used to calculate $Z(q)$, 23 using equations (29)-(31) from the 1987 paper\ [#CIT1987]_ for $Z1$, $Z2$, and 24 $Z3$. 25 Equation (1) of the 1990 reference is used to calculate $Z(q)$, using 26 equations (29)-(31) from the 1987 paper for $Z1$, $Z2$, and $Z3$. 25 27 26 28 The lattice correction (the occupied volume of the lattice) for a … … 77 79 The 2D (Anisotropic model) is based on the reference below where $I(q)$ is 78 80 approximated for 1d scattering. Thus the scattering pattern for 2D may not 79 be accurate. 81 be accurate. Note that we are not responsible for any incorrectness of the 2D 82 model computation. 80 83 81 84 .. figure:: img/bcc_angle_definition.png … … 86 89 ---------- 87 90 88 .. [#CIT1987] Hideki Matsuoka et. al. *Physical Review B*, 36 (1987) 1754-1765 89 (Original Paper) 90 .. [#CIT1990] Hideki Matsuoka et. al. *Physical Review B*, 41 (1990) 3854 -3856 91 (Corrections to FCC and BCC lattice structure calculation) 91 Hideki Matsuoka et. al. *Physical Review B*, 36 (1987) 1754-1765 92 (Original Paper) 92 93 93 Authorship and Verification 94 ---------------------------- 95 96 * **Author:** NIST IGOR/DANSE **Date:** pre 2010 97 * **Last Modified by:** Paul Butler **Date:** September 29, 2016 98 * **Last Reviewed by:** Richard Heenan **Date:** March 21, 2016 94 Hideki Matsuoka et. al. *Physical Review B*, 41 (1990) 3854 -3856 95 (Corrections to FCC and BCC lattice structure calculation) 99 96 """ 100 97 … … 112 109 category = "shape:paracrystal" 113 110 114 #note - calculation requires double precision115 111 single = False 116 112 -
sasmodels/models/be_polyelectrolyte.py
rb0c4271 r2c74c11 1 1 r""" 2 This model calculates the structure factor of a polyelectrolyte solution with 3 the RPA expression derived by Borue and Erukhimovich. 4 2 5 Definition 3 6 ---------- 4 This model calculates the structure factor of a polyelectrolyte solution with 5 the RPA expression derived by Borue and Erukhimovich\ [#Borue]_. The scattering intensity 6 $I(q)$ is calculated as 7 8 The scattering intensity $I(q)$ is calculated as 7 9 8 10 .. math:: … … 34 36 ---------- 35 37 36 .. [#Borue] V Y Borue, I Y Erukhimovich, *Macromolecules*, 21 (1988) 3240 37 .. [#] J F Joanny, L Leibler, *Journal de Physique*, 51 (1990) 545 38 .. [#] A Moussaid, F Schosseler, J P Munch, S Candau, *J. Journal de Physique 39 II France*, 3 (1993) 573 40 .. [#] E Raphael, J F Joanny, *Europhysics Letters*, 11 (1990) 179 38 V Y Borue, I Y Erukhimovich, *Macromolecules*, 21 (1988) 3240 41 39 42 Authorship and Verification 43 ---------------------------- 40 J F Joanny, L Leibler, *Journal de Physique*, 51 (1990) 545 44 41 45 * **Author:** NIST IGOR/DANSE **Date:** pre 2010 46 * **Last Modified by:** Paul Kienzle **Date:** July 24, 2016 47 * **Last Reviewed by:** Piotr rozyczko **Date:** January 27, 2016 42 A Moussaid, F Schosseler, J P Munch, S Candau, 43 *J. Journal de Physique II France*, 3 (1993) 573 44 45 E Raphael, J F Joanny, *Europhysics Letters*, 11 (1990) 179 46 48 47 """ 49 48 -
sasmodels/models/binary_hard_sphere.py
rb0c4271 r63c6a08 1 1 r""" 2 2 3 Definition 3 4 ---------- 4 5 5 The binary hard sphere model provides the scattering intensity, for binary 6 6 mixture of hard spheres including hard sphere interaction between those … … 61 61 ---------- 62 62 63 .. [#] N W Ashcroft and D C Langreth, *Physical Review*, 156 (1967) 685-692 64 [Errata found in *Phys. Rev.* 166 (1968) 934] 65 .. [#] S R Kline, *J Appl. Cryst.*, 39 (2006) 895 63 N W Ashcroft and D C Langreth, *Physical Review*, 156 (1967) 685-692 64 [Errata found in *Phys. Rev.* 166 (1968) 934] 66 65 67 Authorship and Verification 68 ---------------------------- 66 S R Kline, *J Appl. Cryst.*, 39 (2006) 895 69 67 70 * **Author:** NIST IGOR/DANSE **Date:** pre 2010 71 * **Last Modified by:** Paul Butler **Date:** March 20, 2016 72 * **Last Reviewed by:** Paul Butler **Date:** March 20, 2016 68 **Author:** NIST IGOR/DANSE **on:** pre 2010 69 70 **Last Modified by:** Paul Butler **on:** March 20, 2016 71 72 **Last Reviewed by:** Paul Butler **on:** March 20, 2016 73 73 """ 74 74 -
sasmodels/models/broad_peak.py
rb0c4271 r40a87fa 1 1 r""" 2 Definition3 ----------4 5 2 This model calculates an empirical functional form for SAS data characterized 6 3 by a broad scattering peak. Many SAS spectra are characterized by a broad peak … … 12 9 between the scattering inhomogeneities (such as in lamellar, cylindrical, or 13 10 spherical morphologies, or for bicontinuous structures). 11 12 Definition 13 ---------- 14 14 15 15 The scattering intensity $I(q)$ is calculated as … … 33 33 None. 34 34 35 Authorship and Verification 36 ---------------------------- 37 38 * **Author:** NIST IGOR/DANSE **Date:** pre 2010 39 * **Last Modified by:** Paul kienle **Date:** July 24, 2016 40 * **Last Reviewed by:** Richard Heenan **Date:** March 21, 2016 35 *2013/09/09 - Description reviewed by King, S and Parker, P.* 41 36 """ 42 37 -
sasmodels/models/capped_cylinder.py
rb0c4271 r2222134 1 1 r""" 2 Definitions3 -----------4 5 2 Calculates the scattering from a cylinder with spherical section end-caps. 6 3 Like :ref:`barbell`, this is a sphereocylinder with end caps that have a … … 9 6 lens when the length of the cylinder $L=0$. See the diagram for the details 10 7 of the geometry and restrictions on parameter values. 8 9 Definitions 10 ----------- 11 11 12 12 .. figure:: img/capped_cylinder_geometry.jpg … … 76 76 77 77 .. figure:: img/cylinder_angle_projection.jpg 78 :width: 600px79 78 80 79 Examples of the angles for oriented 2D cylinders against the detector plane. … … 83 82 ---------- 84 83 85 .. [#] H Kaya, *J. Appl. Cryst.*, 37 (2004) 223-230 86 .. [#] H Kaya and N-R deSouza, *J. Appl. Cryst.*, 37 (2004) 508-509 (addenda 87 and errata) 84 H Kaya, *J. Appl. Cryst.*, 37 (2004) 223-230 88 85 89 Authorship and Verification 90 ---------------------------- 91 92 * **Author:** NIST IGOR/DANSE **Date:** pre 2010 93 * **Last Modified by:** Paul Butler **Date:** September 30, 2016 94 * **Last Reviewed by:** Richard Heenan **Date:** March 19, 2016 86 H Kaya and N-R deSouza, *J. Appl. Cryst.*, 37 (2004) 508-509 (addenda and errata) 95 87 """ 96 88 from numpy import inf -
sasmodels/models/core_multi_shell.py
rb0c4271 r7b68dc5 33 33 References 34 34 ---------- 35 See the :ref:`core-shell-sphere` model documentation. 35 36 36 .. [#] See the :ref:`core-shell-sphere` model documentation. 37 .. [#] L A Feigin and D I Svergun,*Structure Analysis by Small-Angle X-Ray and Neutron Scattering*,38 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. 39 40 40 Authorship and Verification 41 ---------------------------- 41 **Author:** NIST IGOR/DANSE **on:** pre 2010 42 42 43 * **Author:** NIST IGOR/DANSE **Date:** pre 201044 * **Last Modified by:** Paul Kienzle **Date:** September 12, 2016 45 * **Last Reviewed by:** Under Review **Date:** as of October 5, 201643 **Last Modified by:** in progress **on:** March 20, 2016 44 45 **Last Reviewed by:** in progress **on:** March 20, 2016 46 46 """ 47 47 -
sasmodels/models/core_shell_bicelle.py
rb0c4271 r2222134 1 1 r""" 2 2 3 Definition 3 4 ---------- … … 12 13 .. figure:: img/core_shell_bicelle_geometry.png 13 14 14 Core shell geometry (Graphic from ref [#Matusmori]_).15 Note however that the model here calculates for rectangular, not curved, rims.15 (Graphic from DOI: 10.1039/C0NP00002G, note however that the model here 16 calculates for rectangular, not curved, rims.) 16 17 17 18 The output of the 1D scattering intensity function for randomly oriented … … 27 28 28 29 .. figure:: img/cylinder_angle_projection.jpg 29 :width: 600px30 30 31 31 Examples of the angles for oriented pp against the detector plane. … … 34 34 ---------- 35 35 36 .. [#Matusmori] `N Matsumori and M Murata <http://dx.doi.org/10.1039/C0NP0000 37 2G>`_, *Nat. Prod. Rep.* 27 (2010) 1480-1492 38 .. [#] L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and 39 Neutron Scattering,* Plenum Press, New York, (1987) 40 41 Authorship and Verification 42 ---------------------------- 43 44 * **Author:** NIST IGOR/DANSE **Date:** pre 2010 45 * **Last Modified by:** Paul Butler **Date:** Septmber 30, 2016 46 * **Last Reviewed by:** Under Review **Date:** October 5, 2016 36 L A Feigin and D I Svergun, 37 *Structure Analysis by Small-Angle X-Ray and Neutron Scattering,* 38 Plenum Press, New York, (1987) 47 39 48 40 """ -
sasmodels/models/hollow_cylinder.c
raea2e2a ra807206 1 double form_volume(double radius, double thickness, double length);1 double form_volume(double radius, double radius_core, double length); 2 2 3 double Iq(double q, double radius, double thickness, double length, double sld,3 double Iq(double q, double radius, double radius_core, double length, double sld, 4 4 double solvent_sld); 5 double Iqxy(double qx, double qy, double radius, double thickness, double length, double sld,5 double Iqxy(double qx, double qy, double radius, double radius_core, double length, double sld, 6 6 double solvent_sld, double theta, double phi); 7 7 8 //#define INVALID(v) (v.radius_core >= v.radius)8 #define INVALID(v) (v.radius_core >= v.radius) 9 9 10 10 // From Igor library … … 27 27 28 28 static double _hollow_cylinder_kernel( 29 double q, double radius , double thickness, double length, double dum)29 double q, double radius_core, double radius, double length, double dum) 30 30 { 31 31 const double qs = q*sqrt(1.0-dum*dum); 32 const double lam1 = sas_J1c( (radius+thickness)*qs);33 const double lam2 = sas_J1c(radius *qs);34 const double gamma_sq = square(radius /(radius+thickness));32 const double lam1 = sas_J1c(radius*qs); 33 const double lam2 = sas_J1c(radius_core*qs); 34 const double gamma_sq = square(radius_core/radius); 35 35 //Note: lim_{r -> r_c} psi = J0(radius_core*qs) 36 36 const double psi = (lam1 - gamma_sq*lam2)/(1.0 - gamma_sq); //SRK 10/19/00 … … 41 41 42 42 static double hollow_cylinder_analytical_2D_scaled( 43 double q, double q_x, double q_y, double radius, double thickness,43 double q, double q_x, double q_y, double radius, double radius_core, 44 44 double length, double sld, double solvent_sld, double theta, double phi) 45 45 { … … 65 65 cos_val = cyl_x*q_x + cyl_y*q_y;// + cyl_z*q_z; 66 66 67 answer = _hollow_cylinder_kernel(q, radius , thickness, length, cos_val);67 answer = _hollow_cylinder_kernel(q, radius_core, radius, length, cos_val); 68 68 69 vol = form_volume(radius, thickness, length);69 vol = form_volume(radius, radius_core, length); 70 70 answer = hollow_cylinder_scaling(answer, delrho, vol); 71 71 … … 74 74 75 75 76 double form_volume(double radius, double thickness, double length)76 double form_volume(double radius, double radius_core, double length) 77 77 { 78 double v_shell = M_PI*length*( (radius+thickness)*(radius+thickness)-radius*radius);78 double v_shell = M_PI*length*(radius*radius-radius_core*radius_core); 79 79 return(v_shell); 80 80 } 81 81 82 82 83 double Iq(double q, double radius, double thickness, double length,83 double Iq(double q, double radius, double radius_core, double length, 84 84 double sld, double solvent_sld) 85 85 { … … 95 95 for (i=0;i<76;i++) { 96 96 zi = ( Gauss76Z[i] * (upper-lower) + lower + upper )/2.0; 97 inter = Gauss76Wt[i] * _hollow_cylinder_kernel(q, radius , thickness, length, zi);97 inter = Gauss76Wt[i] * _hollow_cylinder_kernel(q, radius_core, radius, length, zi); 98 98 summ += inter; 99 99 } 100 100 101 101 norm = summ*(upper-lower)/2.0; 102 volume = form_volume(radius, thickness, length);102 volume = form_volume(radius, radius_core, length); 103 103 delrho = solvent_sld - sld; 104 104 answer = hollow_cylinder_scaling(norm, delrho, volume); … … 108 108 109 109 110 double Iqxy(double qx, double qy, double radius, double thickness,110 double Iqxy(double qx, double qy, double radius, double radius_core, 111 111 double length, double sld, double solvent_sld, double theta, double phi) 112 112 { 113 113 const double q = sqrt(qx*qx+qy*qy); 114 return hollow_cylinder_analytical_2D_scaled(q, qx/q, qy/q, radius, thickness, length, sld, solvent_sld, theta, phi);114 return hollow_cylinder_analytical_2D_scaled(q, qx/q, qy/q, radius, radius_core, length, sld, solvent_sld, theta, phi); 115 115 } -
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.