Changeset ba51e00 in sasmodels for sasmodels/models
- Timestamp:
- Sep 8, 2018 10:30:57 AM (6 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- c44b611
- Parents:
- 2773c66 (diff), fbaef04 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- sasmodels/models
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/core_multi_shell.c
rd277229 ra94046f 32 32 static double 33 33 effective_radius(int mode, double core_radius, double fp_n, double thickness[]) 34 // this seems regardless to always give the result for outer radius for n=1 shells; why?? 35 // printf shows fp_n is always 1, not 0,1,2 34 36 { 35 if (mode == 1) { 37 // printf("fp_n =%g \n",fp_n); 38 if (mode == 1) { 36 39 double r = core_radius; 37 40 int n = (int)(fp_n+0.5); 38 for (int i=0; i < n; i++) { 39 r += thickness[i]; 41 if ( n > 0) { 42 for (int i=0; i < n; i++) { 43 r += thickness[i]; 44 } 40 45 } 41 46 return r; -
sasmodels/models/core_shell_cylinder.c
rd277229 ra94046f 24 24 { 25 25 const double radius_outer = radius + thickness; 26 const double length_outer = length + thickness;26 const double length_outer = length + 2.0*thickness; 27 27 return sqrt(radius_outer*radius_outer + 0.25*length_outer*length_outer); 28 28 } … … 30 30 static double 31 31 effective_radius(int mode, double radius, double thickness, double length) 32 //effective_radius_type = ["equivalent sphere","outer radius","half outer length","half min outer dimension", 33 // "half max outer dimension","half outer diagonal"] 32 34 { 33 35 if (mode == 1) { -
sasmodels/models/core_shell_parallelepiped.c
rd277229 ra94046f 45 45 effective_radius(int mode, double length_a, double length_b, double length_c, 46 46 double thick_rim_a, double thick_rim_b, double thick_rim_c) 47 //effective_radius_type = ["equivalent sphere","half outer length_a", "half outer length_b", "half outer length_c", 48 // "equivalent circular cross-section","half outer ab diagonal","half outer diagonal"] 49 // note the core box is A*B*C with slabs ta, tb & tc on each face but missing the corners, though that fact is ignored here 50 // in the equvalent sphere option 47 51 { 48 52 if (mode == 1) { 49 53 return radius_from_volume(length_a, length_b, length_c, thick_rim_a, thick_rim_b, thick_rim_c); 50 54 } else if (mode == 2) { 51 return 0.5 * (length_a + thick_rim_a);55 return 0.5 * length_a + thick_rim_a; 52 56 } else if (mode == 3) { 53 return 0.5 * (length_b + thick_rim_b);57 return 0.5 * length_b + thick_rim_b; 54 58 } else if (mode == 4) { 55 return 0.5 * (length_c + thick_rim_c);59 return 0.5 * length_c + thick_rim_c; 56 60 } else if (mode == 5) { 57 61 return radius_from_crosssection(length_a, length_b, thick_rim_a, thick_rim_b); 58 62 } else if (mode == 6) { 59 return 0.5*sqrt(square(length_a+ thick_rim_a) + square(length_b+thick_rim_b));63 return 0.5*sqrt(square(length_a+ 2.0*thick_rim_a) + square(length_b+ 2.0*thick_rim_b)); 60 64 } else { 61 return 0.5*sqrt(square(length_a+ thick_rim_a) + square(length_b+thick_rim_b) + square(length_c+thick_rim_c));65 return 0.5*sqrt(square(length_a+ 2.0*thick_rim_a) + square(length_b+ 2.0*thick_rim_b) + square(length_c+ 2.0*thick_rim_c)); 62 66 } 63 67 } -
sasmodels/models/elliptical_cylinder.c
rd277229 rfbaef04 13 13 14 14 static double 15 radius_from_min_dimension(double radius_minor, double r_ratio, double length)15 radius_from_min_dimension(double radius_minor, double r_ratio, double hlength) 16 16 { 17 17 const double rad_min = (r_ratio > 1.0 ? radius_minor : r_ratio*radius_minor); 18 return (rad_min < length ? rad_min :length);18 return (rad_min < hlength ? rad_min : hlength); 19 19 } 20 20 21 21 static double 22 radius_from_max_dimension(double radius_minor, double r_ratio, double length)22 radius_from_max_dimension(double radius_minor, double r_ratio, double hlength) 23 23 { 24 24 const double rad_max = (r_ratio < 1.0 ? radius_minor : r_ratio*radius_minor); 25 return (rad_max > length ? rad_max :length);25 return (rad_max > hlength ? rad_max : hlength); 26 26 } 27 27 … … 35 35 static double 36 36 effective_radius(int mode, double radius_minor, double r_ratio, double length) 37 //effective_radius_type = ["equivalent sphere","average radius","min radius","max radius", 38 // "equivalent circular cross-section","half length","half min dimension","half max dimension","half diagonal"] 37 39 { 38 40 if (mode == 1) { … … 49 51 return 0.5*length; 50 52 } else if (mode == 7) { 51 return radius_from_min_dimension(radius_minor,r_ratio, length);53 return radius_from_min_dimension(radius_minor,r_ratio,0.5*length); 52 54 } else if (mode == 8) { 53 return radius_from_max_dimension(radius_minor,r_ratio, length);55 return radius_from_max_dimension(radius_minor,r_ratio,0.5*length); 54 56 } else { 55 57 return radius_from_diagonal(radius_minor,r_ratio,length); -
sasmodels/models/hollow_rectangular_prism.c
rd277229 ra94046f 15 15 static double 16 16 effective_radius(int mode, double length_a, double b2a_ratio, double c2a_ratio, double thickness) 17 //effective_radius_type = ["equivalent sphere","half length_a", "half length_b", "half length_c", 18 // "equivalent outer circular cross-section","half ab diagonal","half diagonal"] 19 // NOTE length_a is external dimension! 17 20 { 18 21 if (mode == 1) { -
sasmodels/models/hollow_rectangular_prism.py
rd277229 ra94046f 126 126 "Solvent scattering length density"], 127 127 ["length_a", "Ang", 35, [0, inf], "volume", 128 "Shorte r side of the parallelepiped"],128 "Shortest, external, size of the parallelepiped"], 129 129 ["b2a_ratio", "Ang", 1, [0, inf], "volume", 130 130 "Ratio sides b/a"], -
sasmodels/models/ellipsoid.py
rd277229 r2773c66 125 125 import numpy as np 126 126 from numpy import inf, sin, cos, pi 127 128 try: 129 from numpy import cbrt 130 except ImportError: 131 def cbrt(x): return x ** (1.0/3.0) 127 132 128 133 name = "ellipsoid" -
sasmodels/models/spinodal.py
r71b751d rc88f983 3 3 ---------- 4 4 5 This model calculates the SAS signal of a phase separating solution 6 under spinodal decomposition. The scattering intensity $I(q)$ is calculated as 5 This model calculates the SAS signal of a phase separating system 6 undergoing spinodal decomposition. The scattering intensity $I(q)$ is calculated 7 as 7 8 8 9 .. math:: 9 10 I(q) = I_{max}\frac{(1+\gamma/2)x^2}{\gamma/2+x^{2+\gamma}}+B 10 11 11 where $x=q/q_0$ and $B$ is a flat background. The characteristic structure 12 length scales with the correlation peak at $q_0$. The exponent $\gamma$ is 13 equal to $d+1$ with d the dimensionality of the off-critical concentration 14 mixtures. A transition to $\gamma=2d$ is seen near the percolation threshold 15 into the critical concentration regime. 12 where $x=q/q_0$, $q_0$ is the peak position, $I_{max}$ is the intensity 13 at $q_0$ (parameterised as the $scale$ parameter), and $B$ is a flat 14 background. The spinodal wavelength is given by $2\pi/q_0$. 15 16 The exponent $\gamma$ is equal to $d+1$ for off-critical concentration 17 mixtures (smooth interfaces) and $2d$ for critical concentration mixtures 18 (entangled interfaces), where $d$ is the dimensionality (ie, 1, 2, 3) of the 19 system. Thus 2 <= $\gamma$ <= 6. A transition from $\gamma=d+1$ to $\gamma=2d$ 20 is expected near the percolation threshold. 21 22 As this function tends to zero as $q$ tends to zero, in practice it may be 23 necessary to combine it with another function describing the low-angle 24 scattering, or to simply omit the low-angle scattering from the fit. 16 25 17 26 References … … 22 31 Physica A 123,497 (1984). 23 32 24 Authorship and Verification 25 ---------------- ------------33 Revision History 34 ---------------- 26 35 27 * **Author:** Dirk Honecker **Date:** Oct 7, 2016 36 * **Author:** Dirk Honecker **Date:** Oct 7, 2016 37 * **Revised:** Steve King **Date:** Sep 7, 2018 28 38 """ 29 39 … … 34 44 title = "Spinodal decomposition model" 35 45 description = """\ 36 I(q) = scale ((1+gamma/2)x^2)/(gamma/2+x^(2+gamma))+background46 I(q) = Imax ((1+gamma/2)x^2)/(gamma/2+x^(2+gamma)) + background 37 47 38 48 List of default parameters: 39 scale = scaling 40 gamma = exponent 41 x = q/q_0 49 50 Imax = correlation peak intensity at q_0 51 background = incoherent background 52 gamma = exponent (see model documentation) 42 53 q_0 = correlation peak position [1/A] 43 background = Incoherent background""" 54 x = q/q_0""" 55 44 56 category = "shape-independent" 45 57
Note: See TracChangeset
for help on using the changeset viewer.