Changeset 99658f6 in sasmodels
- Timestamp:
- Nov 6, 2018 4:10:43 PM (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:
- cf3d0ce
- Parents:
- 5024a56
- Location:
- sasmodels
- Files:
-
- 39 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/barbell.c
rd42dd4a r99658f6 63 63 64 64 static double 65 radius_from_excluded_volume(double radius_bell, double radius, double length) 66 { 67 const double hdist = sqrt(square(radius_bell) - square(radius)); 68 const double length_tot = length + 2.0*(hdist+ radius); 69 return 0.5*cbrt(0.75*radius_bell*(2.0*radius_bell*length_tot + (radius_bell + length_tot)*(M_PI*radius_bell + length_tot))); 70 } 71 72 static double 65 73 radius_from_volume(double radius_bell, double radius, double length) 66 74 { … … 81 89 switch (mode) { 82 90 default: 83 case 1: // equivalent sphere 91 case 1: // equivalent cylinder excluded volume 92 return radius_from_excluded_volume(radius_bell, radius , length); 93 case 2: // equivalent volume sphere 84 94 return radius_from_volume(radius_bell, radius , length); 85 case 2: // radius95 case 3: // radius 86 96 return radius; 87 case 3: // half length97 case 4: // half length 88 98 return 0.5*length; 89 case 4: // half total length99 case 5: // half total length 90 100 return radius_from_totallength(radius_bell,radius,length); 91 101 } -
sasmodels/models/barbell.py
ree60aa7 r99658f6 79 79 .. [#] H Kaya and N R deSouza, *J. Appl. Cryst.*, 37 (2004) 508-509 (addenda 80 80 and errata) 81 L. Onsager, Ann. New York Acad. Sci. 51, 627-659 (1949). 81 82 82 83 Authorship and Verification … … 116 117 117 118 source = ["lib/polevl.c", "lib/sas_J1.c", "lib/gauss76.c", "barbell.c"] 118 have_Fq = True 119 have_Fq = True 119 120 effective_radius_type = [ 120 "equivalent sphere", "radius", "half length", "half total length",121 "equivalent cylinder excluded volume","equivalent volume sphere", "radius", "half length", "half total length", 121 122 ] 122 123 -
sasmodels/models/capped_cylinder.c
rd42dd4a r99658f6 85 85 86 86 static double 87 radius_from_excluded_volume(double radius, double radius_cap, double length) 88 { 89 const double hc = radius_cap - sqrt(radius_cap*radius_cap - radius*radius); 90 const double length_tot = length + 2.0*hc; 91 return 0.5*cbrt(0.75*radius*(2.0*radius*length_tot + (radius + length_tot)*(M_PI*radius + length_tot))); 92 } 93 94 static double 87 95 radius_from_volume(double radius, double radius_cap, double length) 88 96 { … … 103 111 switch (mode) { 104 112 default: 105 case 1: // equivalent sphere 113 case 1: // equivalent cylinder excluded volume 114 return radius_from_excluded_volume(radius, radius_cap, length); 115 case 2: // equivalent volume sphere 106 116 return radius_from_volume(radius, radius_cap, length); 107 case 2: // radius117 case 3: // radius 108 118 return radius; 109 case 3: // half length119 case 4: // half length 110 120 return 0.5*length; 111 case 4: // half total length121 case 5: // half total length 112 122 return radius_from_totallength(radius, radius_cap,length); 113 123 } -
sasmodels/models/capped_cylinder.py
ree60aa7 r99658f6 82 82 .. [#] H Kaya and N-R deSouza, *J. Appl. Cryst.*, 37 (2004) 508-509 (addenda 83 83 and errata) 84 L. Onsager, Ann. New York Acad. Sci. 51, 627-659 (1949). 84 85 85 86 Authorship and Verification … … 138 139 have_Fq = True 139 140 effective_radius_type = [ 140 "equivalent sphere", "radius", "half length", "half total length",141 "equivalent cylinder excluded volume", "equivalent volume sphere", "radius", "half length", "half total length", 141 142 ] 142 143 -
sasmodels/models/core_shell_bicelle.c
rd42dd4a r99658f6 37 37 38 38 static double 39 radius_from_excluded_volume(double radius, double thick_rim, double thick_face, double length) 40 { 41 const double radius_tot = radius + thick_rim; 42 const double length_tot = length + 2.0*thick_face; 43 return 0.5*cbrt(0.75*radius_tot*(2.0*radius_tot*length_tot + (radius_tot + length_tot)*(M_PI*radius_tot + length_tot))); 44 } 45 46 static double 39 47 radius_from_volume(double radius, double thick_rim, double thick_face, double length) 40 48 { … … 56 64 switch (mode) { 57 65 default: 58 case 1: // equivalent sphere 66 case 1: // equivalent cylinder excluded volume 67 return radius_from_excluded_volume(radius, thick_rim, thick_face, length); 68 case 2: // equivalent sphere 59 69 return radius_from_volume(radius, thick_rim, thick_face, length); 60 case 2: // outer rim radius70 case 3: // outer rim radius 61 71 return radius + thick_rim; 62 case 3: // half outer thickness72 case 4: // half outer thickness 63 73 return 0.5*length + thick_face; 64 case 4: // half diagonal74 case 5: // half diagonal 65 75 return radius_from_diagonal(radius,thick_rim,thick_face,length); 66 76 } -
sasmodels/models/core_shell_bicelle.py
ree60aa7 r99658f6 89 89 from Proquest <http://search.proquest.com/docview/304915826?accountid 90 90 =26379>`_ 91 92 L. Onsager, Ann. New York Acad. Sci. 51, 627-659 (1949). 91 93 92 94 Authorship and Verification … … 156 158 have_Fq = True 157 159 effective_radius_type = [ 158 "e quivalentsphere", "outer rim radius",160 "excluded volume","equivalent volume sphere", "outer rim radius", 159 161 "half outer thickness", "half diagonal", 160 162 ] -
sasmodels/models/core_shell_bicelle_elliptical.c
rd42dd4a r99658f6 8 8 { 9 9 return M_PI*(r_minor+thick_rim)*(r_minor*x_core+thick_rim)*(length+2.0*thick_face); 10 } 11 12 static double 13 radius_from_excluded_volume(double r_minor, double x_core, double thick_rim, double thick_face, double length) 14 { 15 const double r_equiv = sqrt((r_minor + thick_rim)*(r_minor*x_core + thick_rim)); 16 const double length_tot = length + 2.0*thick_face; 17 return 0.5*cbrt(0.75*r_equiv*(2.0*r_equiv*length_tot + (r_equiv + length_tot)*(M_PI*r_equiv + length_tot))); 10 18 } 11 19 … … 31 39 switch (mode) { 32 40 default: 33 case 1: // equivalent sphere 41 case 1: // equivalent cylinder excluded volume 42 return radius_from_excluded_volume(r_minor, x_core, thick_rim, thick_face, length); 43 case 2: // equivalent volume sphere 34 44 return radius_from_volume(r_minor, x_core, thick_rim, thick_face, length); 35 case 2: // outer rim average radius45 case 3: // outer rim average radius 36 46 return 0.5*r_minor*(1.0 + x_core) + thick_rim; 37 case 3: // outer rim min radius47 case 4: // outer rim min radius 38 48 return (x_core < 1.0 ? x_core*r_minor+thick_rim : r_minor+thick_rim); 39 case 4: // outer max radius49 case 5: // outer max radius 40 50 return (x_core > 1.0 ? x_core*r_minor+thick_rim : r_minor+thick_rim); 41 case 5: // half outer thickness51 case 6: // half outer thickness 42 52 return 0.5*length + thick_face; 43 case 6: // half diagonal53 case 7: // half diagonal 44 54 return radius_from_diagonal(r_minor,x_core,thick_rim,thick_face,length); 45 55 } -
sasmodels/models/core_shell_bicelle_elliptical.py
r304c775 r99658f6 100 100 101 101 .. [#] 102 L. Onsager, Ann. New York Acad. Sci. 51, 627-659 (1949). 102 103 103 104 Authorship and Verification … … 148 149 have_Fq = True 149 150 effective_radius_type = [ 150 "equivalent sphere", "outer rim average radius", "outer rim min radius",151 "equivalent cylinder excluded volume", "equivalent volume sphere", "outer rim average radius", "outer rim min radius", 151 152 "outer max radius", "half outer thickness", "half diagonal", 152 153 ] -
sasmodels/models/core_shell_bicelle_elliptical_belt_rough.c
rd42dd4a r99658f6 9 9 return M_PI*( (r_minor + thick_rim)*(r_minor*x_core + thick_rim)* length + 10 10 square(r_minor)*x_core*2.0*thick_face ); 11 } 12 13 static double 14 radius_from_excluded_volume(double r_minor, double x_core, double thick_rim, double thick_face, double length) 15 { 16 const double r_equiv = sqrt((r_minor + thick_rim)*(r_minor*x_core + thick_rim)); 17 const double length_tot = length + 2.0*thick_face; 18 return 0.5*cbrt(0.75*r_equiv*(2.0*r_equiv*length_tot + (r_equiv + length_tot)*(M_PI*r_equiv + length_tot))); 11 19 } 12 20 … … 32 40 switch (mode) { 33 41 default: 34 case 1: // equivalent sphere 42 case 1: // equivalent cylinder excluded volume 43 return radius_from_excluded_volume(r_minor, x_core, thick_rim, thick_face, length); 44 case 2: // equivalent sphere 35 45 return radius_from_volume(r_minor, x_core, thick_rim, thick_face, length); 36 case 2: // outer rim average radius46 case 3: // outer rim average radius 37 47 return 0.5*r_minor*(1.0 + x_core) + thick_rim; 38 case 3: // outer rim min radius48 case 4: // outer rim min radius 39 49 return (x_core < 1.0 ? x_core*r_minor+thick_rim : r_minor+thick_rim); 40 case 4: // outer max radius50 case 5: // outer max radius 41 51 return (x_core > 1.0 ? x_core*r_minor+thick_rim : r_minor+thick_rim); 42 case 5: // half outer thickness52 case 6: // half outer thickness 43 53 return 0.5*length + thick_face; 44 case 6: // half diagonal (this ignores the missing "corners", so may give unexpected answer if thick_face54 case 7: // half diagonal (this ignores the missing "corners", so may give unexpected answer if thick_face 45 55 // or thick_rim is extremely large) 46 56 return radius_from_diagonal(r_minor,x_core,thick_rim,thick_face,length); -
sasmodels/models/core_shell_bicelle_elliptical_belt_rough.py
r304c775 r99658f6 112 112 113 113 .. [#] 114 L. Onsager, Ann. New York Acad. Sci. 51, 627-659 (1949). 114 115 115 116 Authorship and Verification … … 161 162 have_Fq = True 162 163 effective_radius_type = [ 163 "equivalent sphere", "outer rim average radius", "outer rim min radius",164 "equivalent cylinder excluded volume", "equivalent volume sphere", "outer rim average radius", "outer rim min radius", 164 165 "outer max radius", "half outer thickness", "half diagonal", 165 166 ] -
sasmodels/models/core_shell_cylinder.c
rd42dd4a r99658f6 11 11 { 12 12 return M_PI*square(radius+thickness)*(length+2.0*thickness); 13 } 14 15 static double 16 radius_from_excluded_volume(double radius, double thickness, double length) 17 { 18 const double radius_tot = radius + thickness; 19 const double length_tot = length + 2.0*thickness; 20 return 0.5*cbrt(0.75*radius_tot*(2.0*radius_tot*length_tot + (radius_tot + length_tot)*(M_PI*radius_tot + length_tot))); 13 21 } 14 22 … … 33 41 switch (mode) { 34 42 default: 35 case 1: // equivalent sphere 43 case 1: //cylinder excluded volume 44 return radius_from_excluded_volume(radius, thickness, length); 45 case 2: // equivalent volume sphere 36 46 return radius_from_volume(radius, thickness, length); 37 case 2: // outer radius47 case 3: // outer radius 38 48 return radius + thickness; 39 case 3: // half outer length49 case 4: // half outer length 40 50 return 0.5*length + thickness; 41 case 4: // half min outer length51 case 5: // half min outer length 42 52 return (radius < 0.5*length ? radius + thickness : 0.5*length + thickness); 43 case 5: // half max outer length53 case 6: // half max outer length 44 54 return (radius > 0.5*length ? radius + thickness : 0.5*length + thickness); 45 case 6: // half outer diagonal55 case 7: // half outer diagonal 46 56 return radius_from_diagonal(radius,thickness,length); 47 57 } -
sasmodels/models/core_shell_cylinder.py
ree60aa7 r99658f6 70 70 1445-1452 71 71 .. [#kline] S R Kline, *J Appl. Cryst.*, 39 (2006) 895 72 L. Onsager, Ann. New York Acad. Sci. 51, 627-659 (1949). 72 73 73 74 Authorship and Verification … … 133 134 have_Fq = True 134 135 effective_radius_type = [ 135 "equivalent sphere", "outer radius", "half outer length", 136 "half min outer dimension", "half max outer dimension", 137 "half outer diagonal", 136 "excluded volume", "equivalent volume sphere", "outer radius", "half outer length", 137 "half min outer dimension", "half max outer dimension", "half outer diagonal", 138 138 ] 139 139 -
sasmodels/models/core_shell_ellipsoid.c
rd42dd4a r99658f6 75 75 switch (mode) { 76 76 default: 77 case 1: // equivalent sphere 77 case 1: // average outer curvature 78 return radius_from_curvature(radius_equat_core, x_core, thick_shell, x_polar_shell); 79 case 2: // equivalent volume sphere 78 80 return radius_from_volume(radius_equat_core, x_core, thick_shell, x_polar_shell); 79 case 2: // average outer curvature80 return radius_from_curvature(radius_equat_core, x_core, thick_shell, x_polar_shell);81 81 case 3: // min outer radius 82 82 return (radius_polar_tot < radius_equat_tot ? radius_polar_tot : radius_equat_tot); -
sasmodels/models/core_shell_ellipsoid.py
ree60aa7 r99658f6 147 147 have_Fq = True 148 148 effective_radius_type = [ 149 " equivalent sphere", "average outer curvature",149 "average outer curvature", "equivalent volume sphere", 150 150 "min outer radius", "max outer radius", 151 151 ] -
sasmodels/models/core_shell_parallelepiped.c
rd42dd4a r99658f6 28 28 29 29 static double 30 radius_from_excluded_volume(double length_a, double length_b, double length_c, 31 double thick_rim_a, double thick_rim_b, double thick_rim_c) 32 { 33 double r_equiv, length; 34 double lengths[3] = {length_a+thick_rim_a, length_b+thick_rim_b, length_c+thick_rim_c}; 35 double lengthmax = fmax(lengths[0],fmax(lengths[1],lengths[2])); 36 double length_1 = lengthmax; 37 double length_2 = lengthmax; 38 double length_3 = lengthmax; 39 40 for(int ilen=0; ilen<3; ilen++) { 41 if (lengths[ilen] < length_1) { 42 length_2 = length_1; 43 length_1 = lengths[ilen]; 44 } else { 45 if (lengths[ilen] < length_2) { 46 length_2 = lengths[ilen]; 47 } 48 } 49 } 50 if(length_2-length_1 > length_3-length_2) { 51 r_equiv = sqrt(length_2*length_3/M_PI); 52 length = length_1; 53 } else { 54 r_equiv = sqrt(length_1*length_2/M_PI); 55 length = length_3; 56 } 57 58 return 0.5*cbrt(0.75*r_equiv*(2.0*r_equiv*length + (r_equiv + length)*(M_PI*r_equiv + length))); 59 } 60 61 static double 30 62 radius_from_volume(double length_a, double length_b, double length_c, 31 63 double thick_rim_a, double thick_rim_b, double thick_rim_c) … … 48 80 switch (mode) { 49 81 default: 50 case 1: // equivalent sphere 82 case 1: // equivalent cylinder excluded volume 83 return radius_from_excluded_volume(length_a, length_b, length_c, thick_rim_a, thick_rim_b, thick_rim_c); 84 case 2: // equivalent volume sphere 51 85 return radius_from_volume(length_a, length_b, length_c, thick_rim_a, thick_rim_b, thick_rim_c); 52 case 2: // half outer length a86 case 3: // half outer length a 53 87 return 0.5 * length_a + thick_rim_a; 54 case 3: // half outer length b88 case 4: // half outer length b 55 89 return 0.5 * length_b + thick_rim_b; 56 case 4: // half outer length c90 case 5: // half outer length c 57 91 return 0.5 * length_c + thick_rim_c; 58 case 5: // equivalent circular cross-section92 case 6: // equivalent circular cross-section 59 93 return radius_from_crosssection(length_a, length_b, thick_rim_a, thick_rim_b); 60 case 6: // half outer ab diagonal94 case 7: // half outer ab diagonal 61 95 return 0.5*sqrt(square(length_a+ 2.0*thick_rim_a) + square(length_b+ 2.0*thick_rim_b)); 62 case 7: // half outer diagonal96 case 8: // half outer diagonal 63 97 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)); 64 98 } -
sasmodels/models/core_shell_parallelepiped.py
ree60aa7 r99658f6 173 173 from Proquest <http://search.proquest.com/docview/304915826?accountid 174 174 =26379>`_ 175 L. Onsager, Ann. New York Acad. Sci. 51, 627-659 (1949). 175 176 176 177 Authorship and Verification … … 228 229 have_Fq = True 229 230 effective_radius_type = [ 230 "equivalent sphere", 231 "equivalent cylinder excluded volume", 232 "equivalent volume sphere", 231 233 "half outer length_a", "half outer length_b", "half outer length_c", 232 234 "equivalent circular cross-section", -
sasmodels/models/cylinder.c
rd42dd4a r99658f6 11 11 { 12 12 return sas_2J1x_x(qab*radius) * sas_sinx_x(qc*0.5*length); 13 } 14 15 static double 16 radius_from_excluded_volume(double radius, double length) 17 { 18 return 0.5*cbrt(0.75*radius*(2.0*radius*length + (radius + length)*(M_PI*radius + length))); 13 19 } 14 20 … … 31 37 default: 32 38 case 1: 39 return radius_from_excluded_volume(radius, length); 40 case 2: 33 41 return radius_from_volume(radius, length); 34 case 2:42 case 3: 35 43 return radius; 36 case 3:44 case 4: 37 45 return 0.5*length; 38 case 4:46 case 5: 39 47 return (radius < 0.5*length ? radius : 0.5*length); 40 case 5:48 case 6: 41 49 return (radius > 0.5*length ? radius : 0.5*length); 42 case 6:50 case 7: 43 51 return radius_from_diagonal(radius,length); 44 52 } -
sasmodels/models/cylinder.py
r5024a56 r99658f6 98 98 J. S. Pedersen, Adv. Colloid Interface Sci. 70, 171-210 (1997). 99 99 G. Fournet, Bull. Soc. Fr. Mineral. Cristallogr. 74, 39-113 (1951). 100 L. Onsager, Ann. New York Acad. Sci. 51, 627-659 (1949). 100 101 """ 101 102 … … 140 141 have_Fq = True 141 142 effective_radius_type = [ 142 "e quivalentsphere", "radius",143 "excluded volume", "equivalent volume sphere", "radius", 143 144 "half length", "half min dimension", "half max dimension", "half diagonal", 144 145 ] … … 185 186 radius, length = parameters[2][2], parameters[3][2] 186 187 tests.extend([ 187 ({'radius_effective_mode': 0}, 0.1, None, None, 0., pi*radius**2*length, 1.0), 188 ({'radius_effective_mode': 1}, 0.1, None, None, (0.75*radius**2*length)**(1./3.), None, None), 189 ({'radius_effective_mode': 2}, 0.1, None, None, radius, None, None), 190 ({'radius_effective_mode': 3}, 0.1, None, None, length/2., None, None), 191 ({'radius_effective_mode': 4}, 0.1, None, None, min(radius, length/2.), None, None), 192 ({'radius_effective_mode': 5}, 0.1, None, None, max(radius, length/2.), None, None), 193 ({'radius_effective_mode': 6}, 0.1, None, None, np.sqrt(4*radius**2 + length**2)/2., None, None), 188 ({'radius_effective_mode': 0}, 0.1, None, None, 0., pi*radius**2*length, 1.0), 189 ({'radius_effective_mode': 1}, 0.1, None, None, 0.5*(0.75*radius*(2.0*radius*length + (radius + length)*(pi*radius + length)))**(1./3.), None, None), 190 ({'radius_effective_mode': 2}, 0.1, None, None, (0.75*radius**2*length)**(1./3.), None, None), 191 ({'radius_effective_mode': 3}, 0.1, None, None, radius, None, None), 192 ({'radius_effective_mode': 4}, 0.1, None, None, length/2., None, None), 193 ({'radius_effective_mode': 5}, 0.1, None, None, min(radius, length/2.), None, None), 194 ({'radius_effective_mode': 6}, 0.1, None, None, max(radius, length/2.), None, None), 195 ({'radius_effective_mode': 7}, 0.1, None, None, np.sqrt(4*radius**2 + length**2)/2., None, None), 194 196 ]) 195 197 del radius, length -
sasmodels/models/ellipsoid.c
rd42dd4a r99658f6 36 36 switch (mode) { 37 37 default: 38 case 1: // equivalent sphere 38 case 1: // average curvature 39 return radius_from_curvature(radius_polar, radius_equatorial); 40 case 2: // equivalent volume sphere 39 41 return radius_from_volume(radius_polar, radius_equatorial); 40 case 2: // average curvature41 return radius_from_curvature(radius_polar, radius_equatorial);42 42 case 3: // min radius 43 43 return (radius_polar < radius_equatorial ? radius_polar : radius_equatorial); -
sasmodels/models/ellipsoid.py
ree60aa7 r99658f6 170 170 have_Fq = True 171 171 effective_radius_type = [ 172 " equivalent sphere", "average curvature", "min radius", "max radius",172 "average curvature", "equivalent volume sphere", "min radius", "max radius", 173 173 ] 174 174 -
sasmodels/models/elliptical_cylinder.c
rd42dd4a r99658f6 3 3 { 4 4 return M_PI * radius_minor * radius_minor * r_ratio * length; 5 } 6 7 static double 8 radius_from_excluded_volume(double radius_minor, double r_ratio, double length) 9 { 10 const double r_equiv = sqrt(radius_minor*radius_minor*r_ratio); 11 return 0.5*cbrt(0.75*r_equiv*(2.0*r_equiv*length + (r_equiv + length)*(M_PI*r_equiv + length))); 5 12 } 6 13 … … 38 45 switch (mode) { 39 46 default: 40 case 1: // equivalent sphere 47 case 1: // equivalent cylinder excluded volume 48 return radius_from_excluded_volume(radius_minor, r_ratio, length); 49 case 2: // equivalent volume sphere 41 50 return radius_from_volume(radius_minor, r_ratio, length); 42 case 2: // average radius51 case 3: // average radius 43 52 return 0.5*radius_minor*(1.0 + r_ratio); 44 case 3: // min radius53 case 4: // min radius 45 54 return (r_ratio > 1.0 ? radius_minor : r_ratio*radius_minor); 46 case 4: // max radius55 case 5: // max radius 47 56 return (r_ratio < 1.0 ? radius_minor : r_ratio*radius_minor); 48 case 5: // equivalent circular cross-section57 case 6: // equivalent circular cross-section 49 58 return sqrt(radius_minor*radius_minor*r_ratio); 50 case 6: // half length59 case 7: // half length 51 60 return 0.5*length; 52 case 7: // half min dimension61 case 8: // half min dimension 53 62 return radius_from_min_dimension(radius_minor,r_ratio,0.5*length); 54 case 8: // half max dimension63 case 9: // half max dimension 55 64 return radius_from_max_dimension(radius_minor,r_ratio,0.5*length); 56 case 9: // half diagonal65 case 10: // half diagonal 57 66 return radius_from_diagonal(radius_minor,r_ratio,length); 58 67 } -
sasmodels/models/elliptical_cylinder.py
ree60aa7 r99658f6 88 88 L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and 89 89 Neutron Scattering*, Plenum, New York, (1987) [see table 3.4] 90 L. Onsager, Ann. New York Acad. Sci. 51, 627-659 (1949). 90 91 91 92 Authorship and Verification … … 124 125 have_Fq = True 125 126 effective_radius_type = [ 126 "equivalent sphere", "average radius", "min radius", "max radius",127 "equivalent cylinder excluded volume", "equivalent volume sphere", "average radius", "min radius", "max radius", 127 128 "equivalent circular cross-section", 128 129 "half length", "half min dimension", "half max dimension", "half diagonal", -
sasmodels/models/hollow_cylinder.c
rd42dd4a r99658f6 11 11 { 12 12 return M_PI*length*square(radius+thickness); 13 } 14 15 static double 16 radius_from_excluded_volume(double radius, double thickness, double length) 17 { 18 const double radius_tot = radius + thickness; 19 return 0.5*cbrt(0.75*radius_tot*(2.0*radius_tot*length + (radius_tot + length)*(M_PI*radius_tot + length))); 13 20 } 14 21 … … 31 38 switch (mode) { 32 39 default: 33 case 1: // equivalent sphere 40 case 1: // excluded volume 41 return radius_from_excluded_volume(radius, thickness, length); 42 case 2: // equivalent volume sphere 34 43 return radius_from_volume(radius, thickness, length); 35 case 2: // outer radius44 case 3: // outer radius 36 45 return radius + thickness; 37 case 3: // half length46 case 4: // half length 38 47 return 0.5*length; 39 case 4: // half outer min dimension48 case 5: // half outer min dimension 40 49 return (radius + thickness < 0.5*length ? radius + thickness : 0.5*length); 41 case 5: // half outer max dimension50 case 6: // half outer max dimension 42 51 return (radius + thickness > 0.5*length ? radius + thickness : 0.5*length); 43 case 6: // half outer diagonal52 case 7: // half outer diagonal 44 53 return radius_from_diagonal(radius,thickness,length); 45 54 } -
sasmodels/models/hollow_cylinder.py
r304c775 r99658f6 60 60 .. [#] L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and 61 61 Neutron Scattering*, Plenum Press, New York, (1987) 62 L. Onsager, Ann. New York Acad. Sci. 51, 627-659 (1949). 62 63 63 64 Authorship and Verification … … 102 103 have_Fq = True 103 104 effective_radius_type = [ 104 "e quivalentsphere", "outer radius", "half length",105 "excluded volume", "equivalent outer volume sphere", "outer radius", "half length", 105 106 "half outer min dimension", "half outer max dimension", 106 107 "half outer diagonal", … … 140 141 [{}, 0.00005, 1764.926], 141 142 [{}, 0.1, None, None, 142 (3./4*(radius+thickness)**2*length)**(1./3), # R_eff fromvolume143 0.5*(0.75*(radius+thickness)*(2.0*(radius+thickness)*length + ((radius+thickness) + length)*(pi*(radius+thickness) + length)))**(1./3.), # R_eff from excluded volume 143 144 pi*((radius+thickness)**2-radius**2)*length, # shell volume 144 145 (radius+thickness)**2/((radius+thickness)**2 - radius**2), # form:shell ratio -
sasmodels/models/hollow_rectangular_prism.c
rd42dd4a r99658f6 22 22 23 23 static double 24 radius_from_excluded_volume(double length_a, double b2a_ratio, double c2a_ratio) 25 { 26 const double r_equiv = sqrt(length_a*length_a*b2a_ratio/M_PI); 27 const double length_c = length_a*c2a_ratio; 28 return 0.5*cbrt(0.75*r_equiv*(2.0*r_equiv*length_c + (r_equiv + length_c)*(M_PI*r_equiv + length_c))); 29 } 30 31 static double 24 32 effective_radius(int mode, double length_a, double b2a_ratio, double c2a_ratio, double thickness) 25 33 // NOTE length_a is external dimension! … … 27 35 switch (mode) { 28 36 default: 29 case 1: // equivalent sphere 37 case 1: // equivalent cylinder excluded volume 38 return radius_from_excluded_volume(length_a, b2a_ratio, c2a_ratio); 39 case 2: // equivalent outer volume sphere 30 40 return cbrt(cube(length_a)*b2a_ratio*c2a_ratio/M_4PI_3); 31 case 2: // half length_a41 case 3: // half length_a 32 42 return 0.5 * length_a; 33 case 3: // half length_b43 case 4: // half length_b 34 44 return 0.5 * length_a*b2a_ratio; 35 case 4: // half length_c45 case 5: // half length_c 36 46 return 0.5 * length_a*c2a_ratio; 37 case 5: // equivalent outer circular cross-section47 case 6: // equivalent outer circular cross-section 38 48 return length_a*sqrt(b2a_ratio/M_PI); 39 case 6: // half ab diagonal49 case 7: // half ab diagonal 40 50 return 0.5*sqrt(square(length_a) * (1.0 + square(b2a_ratio))); 41 case 7: // half diagonal51 case 8: // half diagonal 42 52 return 0.5*sqrt(square(length_a) * (1.0 + square(b2a_ratio) + square(c2a_ratio))); 43 53 } -
sasmodels/models/hollow_rectangular_prism.py
ree60aa7 r99658f6 98 98 99 99 .. [#Nayuk2012] R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854 100 L. Onsager, Ann. New York Acad. Sci. 51, 627-659 (1949). 100 101 101 102 … … 150 151 have_Fq = True 151 152 effective_radius_type = [ 152 "equivalent sphere", "half length_a", "half length_b", "half length_c", 153 "equivalent cylinder excluded volume", "equivalent outer volume sphere", 154 "half length_a", "half length_b", "half length_c", 153 155 "equivalent outer circular cross-section", 154 156 "half ab diagonal", "half diagonal", -
sasmodels/models/hollow_rectangular_prism_thin_walls.c
rd42dd4a r99658f6 18 18 19 19 static double 20 radius_from_excluded_volume(double length_a, double b2a_ratio, double c2a_ratio) 21 { 22 const double r_equiv = sqrt(length_a*length_a*b2a_ratio/M_PI); 23 const double length_c = length_a*c2a_ratio; 24 return 0.5*cbrt(0.75*r_equiv*(2.0*r_equiv*length_c + (r_equiv + length_c)*(M_PI*r_equiv + length_c))); 25 } 26 27 static double 20 28 effective_radius(int mode, double length_a, double b2a_ratio, double c2a_ratio) 21 29 { 22 30 switch (mode) { 23 31 default: 24 case 1: // equivalent sphere 32 case 1: // equivalent cylinder excluded volume 33 return radius_from_excluded_volume(length_a, b2a_ratio, c2a_ratio); 34 case 2: // equivalent outer volume sphere 25 35 return cbrt(cube(length_a)*b2a_ratio*c2a_ratio/M_4PI_3); 26 case 2: // half length_a36 case 3: // half length_a 27 37 return 0.5 * length_a; 28 case 3: // half length_b38 case 4: // half length_b 29 39 return 0.5 * length_a*b2a_ratio; 30 case 4: // half length_c40 case 5: // half length_c 31 41 return 0.5 * length_a*c2a_ratio; 32 case 5: // equivalent outer circular cross-section42 case 6: // equivalent outer circular cross-section 33 43 return length_a*sqrt(b2a_ratio/M_PI); 34 case 6: // half ab diagonal44 case 7: // half ab diagonal 35 45 return 0.5*sqrt(square(length_a) * (1.0 + square(b2a_ratio))); 36 case 7: // half diagonal46 case 8: // half diagonal 37 47 return 0.5*sqrt(square(length_a) * (1.0 + square(b2a_ratio) + square(c2a_ratio))); 38 48 } -
sasmodels/models/hollow_rectangular_prism_thin_walls.py
ree60aa7 r99658f6 72 72 73 73 .. [#Nayuk2012] R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854 74 L. Onsager, Ann. New York Acad. Sci. 51, 627-659 (1949). 74 75 75 76 … … 110 111 have_Fq = True 111 112 effective_radius_type = [ 112 "equivalent sphere", "half length_a", "half length_b", "half length_c", 113 "equivalent cylinder excluded volume", "equivalent outer volume sphere", 114 "half length_a", "half length_b", "half length_c", 113 115 "equivalent outer circular cross-section", 114 116 "half ab diagonal", "half diagonal", -
sasmodels/models/parallelepiped.c
rd42dd4a r99658f6 6 6 7 7 static double 8 radius_from_excluded_volume(double length_a, double length_b, double length_c) 9 { 10 double r_equiv, length; 11 double lengths[3] = {length_a, length_b, length_c}; 12 double lengthmax = fmax(lengths[0],fmax(lengths[1],lengths[2])); 13 double length_1 = lengthmax; 14 double length_2 = lengthmax; 15 double length_3 = lengthmax; 16 17 for(int ilen=0; ilen<3; ilen++) { 18 if (lengths[ilen] < length_1) { 19 length_2 = length_1; 20 length_1 = lengths[ilen]; 21 } else { 22 if (lengths[ilen] < length_2) { 23 length_2 = lengths[ilen]; 24 } 25 } 26 } 27 if(length_2-length_1 > length_3-length_2) { 28 r_equiv = sqrt(length_2*length_3/M_PI); 29 length = length_1; 30 } else { 31 r_equiv = sqrt(length_1*length_2/M_PI); 32 length = length_3; 33 } 34 35 return 0.5*cbrt(0.75*r_equiv*(2.0*r_equiv*length + (r_equiv + length)*(M_PI*r_equiv + length))); 36 } 37 38 static double 8 39 effective_radius(int mode, double length_a, double length_b, double length_c) 9 40 { 10 41 switch (mode) { 11 42 default: 12 case 1: // equivalent sphere 43 case 1: // equivalent cylinder excluded volume 44 return radius_from_excluded_volume(length_a,length_b,length_c); 45 case 2: // equivalent volume sphere 13 46 return cbrt(length_a*length_b*length_c/M_4PI_3); 14 case 2: // half length_a47 case 3: // half length_a 15 48 return 0.5 * length_a; 16 case 3: // half length_b49 case 4: // half length_b 17 50 return 0.5 * length_b; 18 case 4: // half length_c51 case 5: // half length_c 19 52 return 0.5 * length_c; 20 case 5: // equivalent circular cross-section53 case 6: // equivalent circular cross-section 21 54 return sqrt(length_a*length_b/M_PI); 22 case 6: // half ab diagonal55 case 7: // half ab diagonal 23 56 return 0.5*sqrt(length_a*length_a + length_b*length_b); 24 case 7: // half diagonal57 case 8: // half diagonal 25 58 return 0.5*sqrt(length_a*length_a + length_b*length_b + length_c*length_c); 26 59 } -
sasmodels/models/parallelepiped.py
ree60aa7 r99658f6 180 180 14 (1961) 185-211 181 181 .. [#] R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854 182 L. Onsager, Ann. New York Acad. Sci. 51, 627-659 (1949). 182 183 183 184 Authorship and Verification … … 232 233 have_Fq = True 233 234 effective_radius_type = [ 234 "equivalent sphere", "half length_a", "half length_b", "half length_c", 235 "equivalent cylinder excluded volume", "equivalent volume sphere", 236 "half length_a", "half length_b", "half length_c", 235 237 "equivalent circular cross-section", "half ab diagonal", "half diagonal", 236 238 ] -
sasmodels/models/pearl_necklace.c
r3f853beb r99658f6 67 67 } 68 68 69 double form_volume(double radius, double edge_sep, 70 double thick_string, double fp_num_pearls) 69 double form_volume(double radius, double edge_sep, double thick_string, double fp_num_pearls) 71 70 { 72 71 const int num_pearls = (int)(fp_num_pearls + 0.5); //Force integer number of pearls … … 77 76 78 77 return volume; 78 } 79 80 static double 81 radius_from_volume(double radius, double edge_sep, double thick_string, double fp_num_pearls) 82 { 83 const int num_pearls = (int) fp_num_pearls +0.5; 84 const double vol_tot = form_volume(radius, edge_sep, thick_string, fp_num_pearls); 85 return cbrt(vol_tot/M_4PI_3); 86 } 87 88 static double 89 effective_radius(int mode, double radius, double edge_sep, double thick_string, double fp_num_pearls) 90 { 91 switch (mode) { 92 default: 93 case 1: 94 return radius_from_volume(radius, edge_sep, thick_string, fp_num_pearls); 95 } 79 96 } 80 97 -
sasmodels/models/pearl_necklace.py
r2cc8aa2 r99658f6 53 53 R Schweins and K Huber, *Particle Scattering Factor of Pearl Necklace Chains*, 54 54 *Macromol. Symp.* 211 (2004) 25-42 2004 55 L. Onsager, Ann. New York Acad. Sci. 51, 627-659 (1949). 55 56 """ 56 57 … … 95 96 source = ["lib/sas_Si.c", "lib/sas_3j1x_x.c", "pearl_necklace.c"] 96 97 single = False # use double precision unless told otherwise 97 98 def volume(radius, edge_sep, thick_string, num_pearls): 99 """ 100 Calculates the total particle volume of the necklace. 101 Redundant with form_volume. 102 """ 103 num_pearls = int(num_pearls + 0.5) 104 number_of_strings = num_pearls - 1.0 105 string_vol = edge_sep * pi * pow((thick_string / 2.0), 2.0) 106 pearl_vol = 4.0 /3.0 * pi * pow(radius, 3.0) 107 total_vol = number_of_strings * string_vol 108 total_vol += num_pearls * pearl_vol 109 return total_vol 110 111 def ER(radius, edge_sep, thick_string, num_pearls): 112 """ 113 Calculation for effective radius. 114 """ 115 num_pearls = int(num_pearls + 0.5) 116 tot_vol = volume(radius, edge_sep, thick_string, num_pearls) 117 rad_out = (tot_vol/(4.0/3.0*pi)) ** (1./3.) 118 return rad_out 98 effective_radius_type = [ 99 "equivalent volume sphere", 100 ] 101 102 #def volume(radius, edge_sep, thick_string, num_pearls): 103 # """ 104 # Calculates the total particle volume of the necklace. 105 # Redundant with form_volume. 106 # """ 107 # num_pearls = int(num_pearls + 0.5) 108 # number_of_strings = num_pearls - 1.0 109 # string_vol = edge_sep * pi * pow((thick_string / 2.0), 2.0) 110 # pearl_vol = 4.0 /3.0 * pi * pow(radius, 3.0) 111 # total_vol = number_of_strings * string_vol 112 # total_vol += num_pearls * pearl_vol 113 # return total_vol 114 # 115 #def ER(radius, edge_sep, thick_string, num_pearls): 116 # """ 117 # Calculation for effective radius. 118 # """ 119 # num_pearls = int(num_pearls + 0.5) 120 # tot_vol = volume(radius, edge_sep, thick_string, num_pearls) 121 # rad_out = (tot_vol/(4.0/3.0*pi)) ** (1./3.) 122 # return rad_out 119 123 120 124 def random(): -
sasmodels/models/pringle.c
rd42dd4a r99658f6 105 105 106 106 static double 107 radius_from_excluded_volume(double radius, double thickness) 108 { 109 return 0.5*cbrt(0.75*radius*(2.0*radius*thickness + (radius + thickness)*(M_PI*radius + thickness))); 110 } 111 112 static double 107 113 effective_radius(int mode, double radius, double thickness, double alpha, double beta) 108 114 { 109 115 switch (mode) { 110 116 default: 111 case 1: // equivalent sphere 117 case 1: // equivalent cylinder excluded volume 118 return radius_from_excluded_volume(radius, thickness); 119 case 2: // equivalent volume sphere 112 120 return cbrt(M_PI*radius*radius*thickness/M_4PI_3); 113 case 2: // radius121 case 3: // radius 114 122 return radius; 115 123 } -
sasmodels/models/pringle.py
ree60aa7 r99658f6 42 42 Karen Edler, Universtiy of Bath, Private Communication. 2012. 43 43 Derivation by Stefan Alexandru Rautu. 44 L. Onsager, Ann. New York Acad. Sci. 51, 627-659 (1949). 44 45 45 46 * **Author:** Andrew Jackson **Date:** 2008 … … 74 75 source = ["lib/polevl.c", "lib/sas_J0.c", "lib/sas_J1.c", 75 76 "lib/sas_JN.c", "lib/gauss76.c", "pringle.c"] 76 effective_radius_type = ["equivalent sphere", "radius"]77 effective_radius_type = ["equivalent cylinder excluded volume", "equivalent volume sphere", "radius"] 77 78 78 79 def random(): -
sasmodels/models/rectangular_prism.c
rd42dd4a r99658f6 6 6 7 7 static double 8 radius_from_excluded_volume(double length_a, double b2a_ratio, double c2a_ratio) 9 { 10 double const r_equiv = sqrt(length_a*length_a*b2a_ratio/M_PI); 11 double const length_c = c2a_ratio*length_a; 12 return 0.5*cbrt(0.75*r_equiv*(2.0*r_equiv*length_c + (r_equiv + length_c)*(M_PI*r_equiv + length_c))); 13 } 14 15 static double 8 16 effective_radius(int mode, double length_a, double b2a_ratio, double c2a_ratio) 9 17 { 10 18 switch (mode) { 11 19 default: 12 case 1: // equivalent sphere 20 case 1: // equivalent cylinder excluded volume 21 return radius_from_excluded_volume(length_a,b2a_ratio,c2a_ratio); 22 case 2: // equivalent volume sphere 13 23 return cbrt(cube(length_a)*b2a_ratio*c2a_ratio/M_4PI_3); 14 case 2: // half length_a24 case 3: // half length_a 15 25 return 0.5 * length_a; 16 case 3: // half length_b26 case 4: // half length_b 17 27 return 0.5 * length_a*b2a_ratio; 18 case 4: // half length_c28 case 5: // half length_c 19 29 return 0.5 * length_a*c2a_ratio; 20 case 5: // equivalent circular cross-section30 case 6: // equivalent circular cross-section 21 31 return length_a*sqrt(b2a_ratio/M_PI); 22 case 6: // half ab diagonal32 case 7: // half ab diagonal 23 33 return 0.5*sqrt(square(length_a) * (1.0 + square(b2a_ratio))); 24 case 7: // half diagonal34 case 8: // half diagonal 25 35 return 0.5*sqrt(square(length_a) * (1.0 + square(b2a_ratio) + square(c2a_ratio))); 26 36 } -
sasmodels/models/rectangular_prism.py
ree60aa7 r99658f6 99 99 100 100 R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854 101 102 L. Onsager, Ann. New York Acad. Sci. 51, 627-659 (1949). 103 101 104 """ 102 105 … … 137 140 have_Fq = True 138 141 effective_radius_type = [ 139 "equivalent sphere", "half length_a", "half length_b", "half length_c", 142 "equivalent cylinder excluded volume", "equivalent volume sphere", 143 "half length_a", "half length_b", "half length_c", 140 144 "equivalent circular cross-section", "half ab diagonal", "half diagonal", 141 145 ] -
sasmodels/models/triaxial_ellipsoid.c
rd42dd4a r99658f6 5 5 { 6 6 return M_4PI_3*radius_equat_minor*radius_equat_major*radius_polar; 7 } 8 9 static double 10 radius_from_curvature(double radius_equat_minor, double radius_equat_major, double radius_polar) 11 { 12 // Trivial cases 13 if (radius_equat_minor == radius_equat_major == radius_polar) return radius_polar; 14 if (radius_equat_minor * radius_equat_major * radius_polar == 0.) return 0.; 15 16 17 double r_equat_equiv, r_polar_equiv; 18 double radii[3] = {radius_equat_minor, radius_equat_major, radius_polar}; 19 double radmax = fmax(radii[0],fmax(radii[1],radii[2])); 20 21 double radius_1 = radmax; 22 double radius_2 = radmax; 23 double radius_3 = radmax; 24 25 for(int irad=0; irad<3; irad++) { 26 if (radii[irad] < radius_1) { 27 radius_3 = radius_2; 28 radius_2 = radius_1; 29 radius_1 = radii[irad]; 30 } else { 31 if (radii[irad] < radius_2) { 32 radius_2 = radii[irad]; 33 } 34 } 35 } 36 if(radius_2-radius_1 > radius_3-radius_2) { 37 r_equat_equiv = sqrt(radius_2*radius_3); 38 r_polar_equiv = radius_1; 39 } else { 40 r_equat_equiv = sqrt(radius_1*radius_2); 41 r_polar_equiv = radius_3; 42 } 43 44 // see equation (26) in A.Isihara, J.Chem.Phys. 18(1950)1446-1449 45 const double ratio = (r_polar_equiv < r_equat_equiv 46 ? r_polar_equiv / r_equat_equiv 47 : r_equat_equiv / r_polar_equiv); 48 const double e1 = sqrt(1.0 - ratio*ratio); 49 const double b1 = 1.0 + asin(e1) / (e1 * ratio); 50 const double bL = (1.0 + e1) / (1.0 - e1); 51 const double b2 = 1.0 + 0.5 * ratio * ratio / e1 * log(bL); 52 const double delta = 0.75 * b1 * b2; 53 const double ddd = 2.0 * (delta + 1.0) * r_polar_equiv * r_equat_equiv * r_equat_equiv; 54 return 0.5 * cbrt(ddd); 7 55 } 8 56 … … 32 80 switch (mode) { 33 81 default: 34 case 1: // equivalent sphere 82 case 1: // equivalent biaxial ellipsoid average curvature 83 return radius_from_curvature(radius_equat_minor,radius_equat_major, radius_polar); 84 case 2: // equivalent volume sphere 35 85 return radius_from_volume(radius_equat_minor,radius_equat_major, radius_polar); 36 case 2: // min radius86 case 3: // min radius 37 87 return radius_from_min_dimension(radius_equat_minor,radius_equat_major, radius_polar); 38 case 3: // max radius88 case 4: // max radius 39 89 return radius_from_max_dimension(radius_equat_minor,radius_equat_major, radius_polar); 40 90 } -
sasmodels/models/triaxial_ellipsoid.py
ree60aa7 r99658f6 158 158 source = ["lib/sas_3j1x_x.c", "lib/gauss76.c", "triaxial_ellipsoid.c"] 159 159 have_Fq = True 160 effective_radius_type = ["equivalent sphere", "min radius", "max radius"]160 effective_radius_type = ["equivalent biaxial ellipsoid average curvature", "equivalent volume sphere", "min radius", "max radius"] 161 161 162 162 def random(): -
sasmodels/product.py
r5024a56 r99658f6 56 56 RADIUS_MODE_ID, 57 57 "", 58 0,58 1, 59 59 [["unconstrained"] + p_info.effective_radius_type], 60 60 "",
Note: See TracChangeset
for help on using the changeset viewer.