Ignore:
Timestamp:
Oct 30, 2017 3:21:00 PM (6 years ago)
Author:
Paul Kienzle <pkienzle@…>
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.
Message:

Merge branch 'master' into ticket-776-orientation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/core_shell_parallelepiped.c

    rbecded3 r904cd9c  
    2626    // Code converted from functions CSPPKernel and CSParallelepiped in libCylinder.c_scaled 
    2727    // 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) 
    2829 
    2930    const double mu = 0.5 * q * length_b; 
     
    4041    const double c_scaled = length_c / length_b; 
    4142 
    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 
    4846 
    4947    double Vin = length_a * length_b * length_c; 
     
    5452    double V1 = (2.0 * thick_rim_a * length_b * length_c);    // incorrect V1 (aa*bb*cc+2*ta*bb*cc) 
    5553    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 
    5655 
    5756    // Scale factors (note that drC is not used later) 
     
    5958    const double drhoA = (arim_sld-solvent_sld); 
    6059    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 
    6262 
    6363    // Precompute scale factors for combining cross terms from the shape 
    6464    const double scale23 = drhoA*V1; 
    6565    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; 
    6769 
    6870    // outer integral (with gauss points), integration limits = 0, 1 
     
    7577        // inner integral (with gauss points), integration limits = 0, 1 
    7678        double inner_total = 0.0; 
     79        double inner_total_crim = 0.0; 
    7780        for(int j=0; j<76; j++) { 
    7881            const double uu = 0.5 * ( Gauss76Z[j] + 1.0 ); 
     
    8083            SINCOS(M_PI_2*uu, sin_uu, cos_uu); 
    8184            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 ); 
    8386            const double si3 = sas_sinx_x(mu_proj * sin_uu * ta); 
    8487            const double si4 = sas_sinx_x(mu_proj * cos_uu * tb); 
     
    8689            // Expression in libCylinder.c (neither drC nor Vot are used) 
    8790            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; 
    9692 
    9793            //  correct FF : sum of square of phase factors 
    9894            inner_total += Gauss76Wt[j] * form * form; 
     95            inner_total_crim += Gauss76Wt[j] * form_crim * form_crim; 
    9996        } 
    10097        inner_total *= 0.5; 
    101  
     98        inner_total_crim *= 0.5; 
    10299        // now sum up the outer integral 
    103100        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); 
    105103    } 
    106104    outer_total *= 0.5; 
     
    141139 
    142140    // 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. 
    145142    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; 
    148145    //handle arg=0 separately, as sin(t)/t -> 1 as t->0 
    149146    double siA = sas_sinx_x(0.5*length_a*qa); 
     
    160157               + drA*(siAt-siA)*siB*siC*V1 
    161158               + drB*siA*(siBt-siB)*siC*V2 
    162                + drC*siA*siB*(siCt*siCt-siC)*V3); 
     159               + drC*siA*siB*(siCt-siC)*V3); 
    163160 
    164161    return 1.0e-4 * f * f; 
Note: See TracChangeset for help on using the changeset viewer.