Changeset 99658f6 in sasmodels for sasmodels/models/core_shell_parallelepiped.c
- Timestamp:
- Nov 6, 2018 2:10:43 PM (5 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.