Changeset 904cd9c in sasmodels for sasmodels/models/core_shell_parallelepiped.c
- Timestamp:
- Oct 30, 2017 3:21:00 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:
- bcb5594
- Parents:
- 5b5ea20 (diff), ef969d9 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/core_shell_parallelepiped.c
rbecded3 r904cd9c 26 26 // Code converted from functions CSPPKernel and CSParallelepiped in libCylinder.c_scaled 27 27 // Did not understand the code completely, it should be rechecked (Miguel Gonzalez) 28 //Code is rewritten,the code is compliant with Diva Singhs thesis now (Dirk Honecker) 28 29 29 30 const double mu = 0.5 * q * length_b; … … 40 41 const double c_scaled = length_c / length_b; 41 42 42 // ta and tb correspond to the definitions in CSPPKernel, but they don't make sense to me (MG) 43 // the a_scaled in the definition of tb was present in CSPPKernel in libCylinder.c, 44 // while in cspkernel in csparallelepiped.cpp (used for the 2D), all the definitions 45 // for ta, tb, tc use also A + 2*rim_thickness (but not scaled by B!!!) 46 double ta = (a_scaled + 2.0*thick_rim_a)/length_b; 47 double tb = (a_scaled + 2.0*thick_rim_b)/length_b; 43 double ta = a_scaled + 2.0*thick_rim_a/length_b; // incorrect ta = (a_scaled + 2.0*thick_rim_a)/length_b; 44 double tb = 1+ 2.0*thick_rim_b/length_b; // incorrect tb = (a_scaled + 2.0*thick_rim_b)/length_b; 45 double tc = c_scaled + 2.0*thick_rim_c/length_b; //not present 48 46 49 47 double Vin = length_a * length_b * length_c; … … 54 52 double V1 = (2.0 * thick_rim_a * length_b * length_c); // incorrect V1 (aa*bb*cc+2*ta*bb*cc) 55 53 double V2 = (2.0 * length_a * thick_rim_b * length_c); // incorrect V2(aa*bb*cc+2*aa*tb*cc) 54 double V3 = (2.0 * length_a * length_b * thick_rim_c); //not present 56 55 57 56 // Scale factors (note that drC is not used later) … … 59 58 const double drhoA = (arim_sld-solvent_sld); 60 59 const double drhoB = (brim_sld-solvent_sld); 61 //const double drC_Vot = (crim_sld-solvent_sld)*Vot; 60 const double drhoC = (crim_sld-solvent_sld); // incorrect const double drC_Vot = (crim_sld-solvent_sld)*Vot; 61 62 62 63 63 // Precompute scale factors for combining cross terms from the shape 64 64 const double scale23 = drhoA*V1; 65 65 const double scale14 = drhoB*V2; 66 const double scale12 = drho0*Vin - scale23 - scale14; 66 const double scale24 = drhoC*V3; 67 const double scale11 = drho0*Vin; 68 const double scale12 = drho0*Vin - scale23 - scale14 - scale24; 67 69 68 70 // outer integral (with gauss points), integration limits = 0, 1 … … 75 77 // inner integral (with gauss points), integration limits = 0, 1 76 78 double inner_total = 0.0; 79 double inner_total_crim = 0.0; 77 80 for(int j=0; j<76; j++) { 78 81 const double uu = 0.5 * ( Gauss76Z[j] + 1.0 ); … … 80 83 SINCOS(M_PI_2*uu, sin_uu, cos_uu); 81 84 const double si1 = sas_sinx_x(mu_proj * sin_uu * a_scaled); 82 const double si2 = sas_sinx_x(mu_proj * cos_uu );85 const double si2 = sas_sinx_x(mu_proj * cos_uu ); 83 86 const double si3 = sas_sinx_x(mu_proj * sin_uu * ta); 84 87 const double si4 = sas_sinx_x(mu_proj * cos_uu * tb); … … 86 89 // Expression in libCylinder.c (neither drC nor Vot are used) 87 90 const double form = scale12*si1*si2 + scale23*si2*si3 + scale14*si1*si4; 88 89 // To note also that in csparallelepiped.cpp, there is a function called 90 // cspkernel, which seems to make more sense and has the following comment: 91 // This expression is different from NIST/IGOR package (I strongly believe the IGOR is wrong!!!). 10/15/2010. 92 // tmp =( dr0*tmp1*tmp2*tmp3*Vin + drA*(tmpt1-tmp1)*tmp2*tmp3*V1+ drB*tmp1*(tmpt2-tmp2)*tmp3*V2 + drC*tmp1*tmp2*(tmpt3-tmp3)*V3)* 93 // ( dr0*tmp1*tmp2*tmp3*Vin + drA*(tmpt1-tmp1)*tmp2*tmp3*V1+ drB*tmp1*(tmpt2-tmp2)*tmp3*V2 + drC*tmp1*tmp2*(tmpt3-tmp3)*V3); // correct FF : square of sum of phase factors 94 // This is the function called by csparallelepiped_analytical_2D_scaled, 95 // while CSParallelepipedModel calls CSParallelepiped in libCylinder.c 91 const double form_crim = scale11*si1*si2; 96 92 97 93 // correct FF : sum of square of phase factors 98 94 inner_total += Gauss76Wt[j] * form * form; 95 inner_total_crim += Gauss76Wt[j] * form_crim * form_crim; 99 96 } 100 97 inner_total *= 0.5; 101 98 inner_total_crim *= 0.5; 102 99 // now sum up the outer integral 103 100 const double si = sas_sinx_x(mu * c_scaled * sigma); 104 outer_total += Gauss76Wt[i] * inner_total * si * si; 101 const double si_crim = sas_sinx_x(mu * tc * sigma); 102 outer_total += Gauss76Wt[i] * (inner_total * si * si + inner_total_crim * si_crim * si_crim); 105 103 } 106 104 outer_total *= 0.5; … … 141 139 142 140 // The definitions of ta, tb, tc are not the same as in the 1D case because there is no 143 // the scaling by B. The use of length_a for the 3 of them seems clearly a mistake to me, 144 // but for the moment I let it like this until understanding better the code. 141 // the scaling by B. 145 142 double ta = length_a + 2.0*thick_rim_a; 146 double tb = length_ a+ 2.0*thick_rim_b;147 double tc = length_ a+ 2.0*thick_rim_c;143 double tb = length_b + 2.0*thick_rim_b; 144 double tc = length_c + 2.0*thick_rim_c; 148 145 //handle arg=0 separately, as sin(t)/t -> 1 as t->0 149 146 double siA = sas_sinx_x(0.5*length_a*qa); … … 160 157 + drA*(siAt-siA)*siB*siC*V1 161 158 + drB*siA*(siBt-siB)*siC*V2 162 + drC*siA*siB*(siCt *siCt-siC)*V3);159 + drC*siA*siB*(siCt-siC)*V3); 163 160 164 161 return 1.0e-4 * f * f;
Note: See TracChangeset
for help on using the changeset viewer.