Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/core_shell_bicelle_elliptical.c

    r592343f rdedcf34  
    1 double form_volume(double radius, double x_core, double thick_rim, double thick_face, double length); 
    2 double Iq(double q, 
    3           double radius, 
    4           double x_core, 
    5           double thick_rim, 
    6           double thick_face, 
    7           double length, 
    8           double core_sld, 
    9           double face_sld, 
    10           double rim_sld, 
    11           double solvent_sld); 
    12  
    13  
    14 double Iqxy(double qx, double qy, 
    15           double radius, 
    16           double x_core, 
    17           double thick_rim, 
    18           double thick_face, 
    19           double length, 
    20           double core_sld, 
    21           double face_sld, 
    22           double rim_sld, 
    23           double solvent_sld, 
    24           double theta, 
    25           double phi, 
    26           double psi); 
    27  
    281// NOTE that "length" here is the full height of the core! 
    29 double form_volume(double radius, double x_core, double thick_rim, double thick_face, double length) 
     2static double 
     3form_volume(double r_minor, 
     4        double x_core, 
     5        double thick_rim, 
     6        double thick_face, 
     7        double length) 
    308{ 
    31     return M_PI*(radius+thick_rim)*(radius*x_core+thick_rim)*(length+2.0*thick_face); 
     9    return M_PI*(r_minor+thick_rim)*(r_minor*x_core+thick_rim)*(length+2.0*thick_face); 
    3210} 
    3311 
    34 double  
    35                 Iq(double qq, 
    36                    double rad, 
    37                    double x_core, 
    38                    double radthick, 
    39                    double facthick, 
    40                    double length, 
    41                    double rhoc, 
    42                    double rhoh, 
    43                    double rhor, 
    44                    double rhosolv) 
     12static double 
     13Iq(double q, 
     14        double r_minor, 
     15        double x_core, 
     16        double thick_rim, 
     17        double thick_face, 
     18        double length, 
     19        double rhoc, 
     20        double rhoh, 
     21        double rhor, 
     22        double rhosolv) 
    4523{ 
    4624    double si1,si2,be1,be2; 
    4725     // core_shell_bicelle_elliptical, RKH Dec 2016, based on elliptical_cylinder and core_shell_bicelle 
    48      // tested against limiting cases of cylinder, elliptical_cylinder and core_shell_bicelle 
     26     // tested against limiting cases of cylinder, elliptical_cylinder, stacked_discs, and core_shell_bicelle 
    4927     //    const double uplim = M_PI_4; 
    5028    const double halfheight = 0.5*length; 
     
    5533    //const double vbj=M_PI; 
    5634 
    57     const double radius_major = rad * x_core; 
    58     const double rA = 0.5*(square(radius_major) + square(rad)); 
    59     const double rB = 0.5*(square(radius_major) - square(rad)); 
    60     const double dr1 = (rhoc-rhoh)   *M_PI*rad*radius_major*(2.0*halfheight);; 
    61     const double dr2 = (rhor-rhosolv)*M_PI*(rad+radthick)*(radius_major+radthick)*2.0*(halfheight+facthick); 
    62     const double dr3 = (rhoh-rhor)   *M_PI*rad*radius_major*2.0*(halfheight+facthick); 
    63     //const double vol1 = M_PI*rad*radius_major*(2.0*halfheight); 
    64     //const double vol2 = M_PI*(rad+radthick)*(radius_major+radthick)*2.0*(halfheight+facthick); 
    65     //const double vol3 = M_PI*rad*radius_major*2.0*(halfheight+facthick); 
     35    const double r_major = r_minor * x_core; 
     36    const double r2A = 0.5*(square(r_major) + square(r_minor)); 
     37    const double r2B = 0.5*(square(r_major) - square(r_minor)); 
     38    const double dr1 = (rhoc-rhoh)   *M_PI*r_minor*r_major*(2.0*halfheight);; 
     39    const double dr2 = (rhor-rhosolv)*M_PI*(r_minor+thick_rim)*(r_major+thick_rim)*2.0*(halfheight+thick_face); 
     40    const double dr3 = (rhoh-rhor)   *M_PI*r_minor*r_major*2.0*(halfheight+thick_face); 
     41    //const double vol1 = M_PI*r_minor*r_major*(2.0*halfheight); 
     42    //const double vol2 = M_PI*(r_minor+thick_rim)*(r_major+thick_rim)*2.0*(halfheight+thick_face); 
     43    //const double vol3 = M_PI*r_minor*r_major*2.0*(halfheight+thick_face); 
    6644 
    6745    //initialize integral 
     
    7452        const double sin_alpha = sqrt(1.0 - cos_alpha*cos_alpha); 
    7553        double inner_sum=0; 
    76         double sinarg1 = qq*halfheight*cos_alpha; 
    77         double sinarg2 = qq*(halfheight+facthick)*cos_alpha; 
     54        double sinarg1 = q*halfheight*cos_alpha; 
     55        double sinarg2 = q*(halfheight+thick_face)*cos_alpha; 
    7856        si1 = sas_sinx_x(sinarg1); 
    7957        si2 = sas_sinx_x(sinarg2); 
     
    8260            //const double beta = ( Gauss76Z[j]*(vbj-vaj) + vaj + vbj )/2.0; 
    8361            const double beta = ( Gauss76Z[j] +1.0)*M_PI_2; 
    84             const double rr = sqrt(rA - rB*cos(beta)); 
    85             double besarg1 = qq*rr*sin_alpha; 
    86             double besarg2 = qq*(rr+radthick)*sin_alpha; 
     62            const double rr = sqrt(r2A - r2B*cos(beta)); 
     63            double besarg1 = q*rr*sin_alpha; 
     64            double besarg2 = q*(rr+thick_rim)*sin_alpha; 
    8765            be1 = sas_2J1x_x(besarg1); 
    8866            be2 = sas_2J1x_x(besarg2); 
     
    9876} 
    9977 
    100 double  
     78static double 
    10179Iqxy(double qx, double qy, 
    102           double rad, 
     80          double r_minor, 
    10381          double x_core, 
    104           double radthick, 
    105           double facthick, 
     82          double thick_rim, 
     83          double thick_face, 
    10684          double length, 
    10785          double rhoc, 
     
    11492{ 
    11593       // THIS NEEDS TESTING 
    116     double qq, cos_val, cos_mu, cos_nu; 
    117     ORIENT_ASYMMETRIC(qx, qy, theta, phi, psi, qq, cos_val, cos_mu, cos_nu); 
     94    double q, xhat, yhat, zhat; 
     95    ORIENT_ASYMMETRIC(qx, qy, theta, phi, psi, q, xhat, yhat, zhat); 
    11896    const double dr1 = rhoc-rhoh; 
    11997    const double dr2 = rhor-rhosolv; 
    12098    const double dr3 = rhoh-rhor; 
    121     const double radius_major = rad*x_core; 
     99    const double r_major = r_minor*x_core; 
    122100    const double halfheight = 0.5*length; 
    123     const double vol1 = M_PI*rad*radius_major*length; 
    124     const double vol2 = M_PI*(rad+radthick)*(radius_major+radthick)*2.0*(halfheight+facthick); 
    125     const double vol3 = M_PI*rad*radius_major*2.0*(halfheight+facthick); 
     101    const double vol1 = M_PI*r_minor*r_major*length; 
     102    const double vol2 = M_PI*(r_minor+thick_rim)*(r_major+thick_rim)*2.0*(halfheight+thick_face); 
     103    const double vol3 = M_PI*r_minor*r_major*2.0*(halfheight+thick_face); 
    126104 
    127     // Compute:  r = sqrt((radius_major*cos_nu)^2 + (radius_minor*cos_mu)^2) 
    128     // Given:    radius_major = r_ratio * radius_minor   
    129     // ASSUME the sin_alpha is included in the separate integration over orientation of rod angle 
    130     const double r = rad*sqrt(square(x_core*cos_nu) + cos_mu*cos_mu); 
    131     const double be1 = sas_2J1x_x( qq*r ); 
    132     const double be2 = sas_2J1x_x( qq*(r + radthick ) ); 
    133     const double si1 = sas_sinx_x( qq*halfheight*cos_val ); 
    134     const double si2 = sas_sinx_x( qq*(halfheight + facthick)*cos_val ); 
     105    // Compute effective radius in rotated coordinates 
     106    const double r_hat = sqrt(square(r_major*xhat) + square(r_minor*yhat)); 
     107    const double rshell_hat = sqrt(square((r_major+thick_rim)*xhat) 
     108                                   + square((r_minor+thick_rim)*yhat)); 
     109    const double be1 = sas_2J1x_x( q*r_hat ); 
     110    const double be2 = sas_2J1x_x( q*rshell_hat ); 
     111    const double si1 = sas_sinx_x( q*halfheight*zhat ); 
     112    const double si2 = sas_sinx_x( q*(halfheight + thick_face)*zhat ); 
    135113    const double Aq = square( vol1*dr1*si1*be1 + vol2*dr2*si2*be2 +  vol3*dr3*si2*be1); 
    136     //const double vol = form_volume(radius_minor, r_ratio, length); 
    137114    return 1.0e-4 * Aq; 
    138115} 
Note: See TracChangeset for help on using the changeset viewer.