Changes in / [9b79f29:48438f9] in sasmodels


Ignore:
Files:
1 added
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/core_shell_bicelle_elliptical.c

    rf4f85b3 r44e8a93  
    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 Iq(double q, 
    35           double rad, 
    36           double x_core, 
    37           double radthick, 
    38           double facthick, 
    39           double length, 
    40           double rhoc, 
    41           double rhoh, 
    42           double rhor, 
    43           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) 
    4423{ 
    4524    double si1,si2,be1,be2; 
     
    5433    //const double vbj=M_PI; 
    5534 
    56     const double radius_major = rad * x_core; 
    57     const double rA = 0.5*(square(radius_major) + square(rad)); 
    58     const double rB = 0.5*(square(radius_major) - square(rad)); 
    59     const double dr1 = (rhoc-rhoh)   *M_PI*rad*radius_major*(2.0*halfheight);; 
    60     const double dr2 = (rhor-rhosolv)*M_PI*(rad+radthick)*(radius_major+radthick)*2.0*(halfheight+facthick); 
    61     const double dr3 = (rhoh-rhor)   *M_PI*rad*radius_major*2.0*(halfheight+facthick); 
    62     //const double vol1 = M_PI*rad*radius_major*(2.0*halfheight); 
    63     //const double vol2 = M_PI*(rad+radthick)*(radius_major+radthick)*2.0*(halfheight+facthick); 
    64     //const double vol3 = M_PI*rad*radius_major*2.0*(halfheight+facthick); 
     35    const double r_major = r_minor * x_core; 
     36    const double rA = 0.5*(square(r_major) + square(r_minor)); 
     37    const double rB = 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); 
    6544 
    6645    //initialize integral 
     
    7453        double inner_sum=0; 
    7554        double sinarg1 = q*halfheight*cos_alpha; 
    76         double sinarg2 = q*(halfheight+facthick)*cos_alpha; 
     55        double sinarg2 = q*(halfheight+thick_face)*cos_alpha; 
    7756        si1 = sas_sinx_x(sinarg1); 
    7857        si2 = sas_sinx_x(sinarg2); 
     
    8362            const double rr = sqrt(rA - rB*cos(beta)); 
    8463            double besarg1 = q*rr*sin_alpha; 
    85             double besarg2 = q*(rr+radthick)*sin_alpha; 
     64            double besarg2 = q*(rr+thick_rim)*sin_alpha; 
    8665            be1 = sas_2J1x_x(besarg1); 
    8766            be2 = sas_2J1x_x(besarg2); 
     
    9776} 
    9877 
    99 double  
     78static double 
    10079Iqxy(double qx, double qy, 
    101           double rad, 
     80          double r_minor, 
    10281          double x_core, 
    103           double radthick, 
    104           double facthick, 
     82          double thick_rim, 
     83          double thick_face, 
    10584          double length, 
    10685          double rhoc, 
     
    11897    const double dr2 = rhor-rhosolv; 
    11998    const double dr3 = rhoh-rhor; 
    120     const double radius_major = rad*x_core; 
     99    const double r_major = r_minor*x_core; 
    121100    const double halfheight = 0.5*length; 
    122     const double vol1 = M_PI*rad*radius_major*length; 
    123     const double vol2 = M_PI*(rad+radthick)*(radius_major+radthick)*2.0*(halfheight+facthick); 
    124     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); 
    125104 
    126     // Compute:  r = sqrt((radius_major*zhat)^2 + (radius_minor*yhat)^2) 
    127     // Given:    radius_major = r_ratio * radius_minor   
    128     // ASSUME the sin_alpha is included in the separate integration over orientation of rod angle 
    129     const double rad_minor = rad; 
    130     const double rad_major = rad*x_core; 
    131     const double r_hat = sqrt(square(rad_major*xhat) + square(rad_minor*yhat)); 
    132     const double rshell_hat = sqrt(square((rad_major+radthick)*xhat) 
    133                                    + square((rad_minor+radthick)*yhat)); 
     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)); 
    134109    const double be1 = sas_2J1x_x( q*r_hat ); 
    135110    const double be2 = sas_2J1x_x( q*rshell_hat ); 
    136111    const double si1 = sas_sinx_x( q*halfheight*zhat ); 
    137     const double si2 = sas_sinx_x( q*(halfheight + facthick)*zhat ); 
     112    const double si2 = sas_sinx_x( q*(halfheight + thick_face)*zhat ); 
    138113    const double Aq = square( vol1*dr1*si1*be1 + vol2*dr2*si2*be2 +  vol3*dr3*si2*be1); 
    139     //const double vol = form_volume(radius_minor, r_ratio, length); 
    140114    return 1.0e-4 * Aq; 
    141115} 
  • sasmodels/models/parallelepiped.py

    r9b79f29 r9b79f29  
    2323 
    2424   The edge of the solid used to have to satisfy the condition that $A < B < C$. 
    25    After some improvements to the effective radius calculation, used with an S(Q), 
    26    it is beleived that this is no longer the case. 
     25   After some improvements to the effective radius calculation, used with 
     26   an S(Q), it is beleived that this is no longer the case. 
    2727 
    2828The 1D scattering intensity $I(q)$ is calculated as: 
     
    7272 
    7373NB: The 2nd virial coefficient of the parallelepiped is calculated based on 
    74 the averaged effective radius, after appropriately 
    75 sorting the three dimensions, to give an oblate or prolate particle, $(=\sqrt{A B / \pi})$ and 
     74the averaged effective radius, after appropriately sorting the three 
     75dimensions, to give an oblate or prolate particle, $(=\sqrt{AB/\pi})$ and 
    7676length $(= C)$ values, and used as the effective radius for 
    7777$S(q)$ when $P(q) \cdot S(q)$ is applied. 
     
    106106.. figure:: img/parallelepiped_angle_definition.png 
    107107 
    108     Definition of the angles for oriented parallelepiped, shown with $A < B < C$. 
     108    Definition of the angles for oriented parallelepiped, shown with $A<B<C$. 
    109109 
    110110.. figure:: img/parallelepiped_angle_projection.png 
     
    167167---------------------------- 
    168168 
    169 * **Author:** This model is based on form factor calculations implemented in a c-library 
    170 provided by the NIST Center for Neutron Research (Kline, 2006). 
     169* **Author:** This model is based on form factor calculations implemented 
     170in a c-library provided by the NIST Center for Neutron Research (Kline, 2006). 
    171171* **Last Modified by:**  Paul Kienzle **Date:** April 05, 2017 
    172172* **Last Reviewed by:**  Richard Heenan **Date:** April 06, 2017 
  • sasmodels/models/sc_paracrystal.py

    r9b79f29 r9b79f29  
    8585.. figure:: img/parallelepiped_angle_definition.png 
    8686 
    87     Orientation of the crystal with respect to the scattering plane, when  
     87    Orientation of the crystal with respect to the scattering plane, when 
    8888    $\theta = \phi = 0$ the $c$ axis is along the beam direction (the $z$ axis). 
    8989 
  • sasmodels/models/stacked_disks.py

    r9b79f29 r9b79f29  
    5858and $\sigma_d$ = the Gaussian standard deviation of the d-spacing (*sigma_d*). 
    5959Note that $D\cos(\alpha)$ is the component of $D$ parallel to $q$ and the last 
    60 term in the equation above is effectively a Debye-Waller factor term.  
     60term in the equation above is effectively a Debye-Waller factor term. 
    6161 
    6262.. note:: 
     
    158158tests = [ 
    159159# Accuracy tests based on content in test/utest_extra_models.py. 
    160 # Added 2 tests with n_stacked = 5 using SasView 3.1.2 - PDB; for which alas q=0.001 values seem closer to n_stacked=1 not 5, changed assuming my 4.1 code OK, RKH 
     160# Added 2 tests with n_stacked = 5 using SasView 3.1.2 - PDB; 
     161# for which alas q=0.001 values seem closer to n_stacked=1 not 5, 
     162# changed assuming my 4.1 code OK, RKH 
    161163    [{'thick_core': 10.0, 
    162164      'thick_layer': 15.0, 
  • sasmodels/models/triaxial_ellipsoid.py

    r9b79f29 r9b79f29  
    1616    \frac{X^2}{R_a^2} + \frac{Y^2}{R_b^2} + \frac{Z^2}{R_c^2} = 1 
    1717 
    18 the scattering for randomly oriented particles is defined by the average over all orientations $\Omega$ of: 
     18the scattering for randomly oriented particles is defined by the average over 
     19all orientations $\Omega$ of: 
    1920 
    2021.. math:: 
    2122 
    22     P(q) = \text{scale}(\Delta\rho)^2\frac{V}{4 \pi}\int_\Omega \Phi^2(qr) d\Omega + \text{background} 
     23    P(q) = \text{scale}(\Delta\rho)^2\frac{V}{4 \pi}\int_\Omega\Phi^2(qr)\,d\Omega 
     24           + \text{background} 
    2325 
    2426where 
     
    3840 .. math:: 
    3941 
    40      \langle\Phi^2\rangle = \int_0^{2\pi} \int_{-\pi/2}^{\pi/2} \Phi^2(qr) \cos \gamma\,d\gamma d\phi 
     42     \langle\Phi^2\rangle = \int_0^{2\pi} \int_{-\pi/2}^{\pi/2} \Phi^2(qr) 
     43                                                \cos \gamma\,d\gamma d\phi 
    4144 
    4245with $e = \cos\gamma \sin\phi$, $f = \cos\gamma \cos\phi$ and $g = \sin\gamma$. 
     
    6972.. figure:: img/elliptical_cylinder_angle_definition.png 
    7073 
    71     Definition of angles for oriented triaxial ellipsoid, where radii shown here are $a < b << c$ 
    72     and angle $\Psi$ is a rotation around the axis of the particle. 
     74    Definition of angles for oriented triaxial ellipsoid, where radii shown 
     75    here are $a < b << c$ and angle $\Psi$ is a rotation around the axis 
     76    of the particle. 
    7377 
    7478The angle $\psi$ is the rotational angle around its own $c$ axis 
     
    115119* **Last Reviewed by:** Paul Kienzle & Richard Heenan **Date:**  April 4, 2017 
    116120 
    117 """ 
    118  
    119121from numpy import inf, sin, cos, pi 
    120122 
     
    122124title = "Ellipsoid of uniform scattering length density with three independent axes." 
    123125 
    124 description = """\ 
     126description = """ 
    125127Note: During fitting ensure that the inequality ra<rb<rc is not 
    126128        violated. Otherwise the calculation will 
     
    157159    from .ellipsoid import ER as ellipsoid_ER 
    158160 
    159     # now that radii can be in any size order, radii need sorting a,b,c where a~b and c is either much smaller 
    160     # or much larger 
     161    # now that radii can be in any size order, radii need sorting a,b,c 
     162    # where a~b and c is either much smaller or much larger 
    161163    radii = np.vstack((radius_equat_major, radius_equat_minor, radius_polar)) 
    162164    radii = np.sort(radii, axis=0) 
     
    178180 
    179181q = 0.1 
    180 # april 6 2017, rkh add unit tests, NOT compared with any other calc method, assume correct! 
     182# april 6 2017, rkh add unit tests 
     183#     NOT compared with any other calc method, assume correct! 
    181184# add 2d test after pull #890 
    182185qx = q*cos(pi/6.0) 
Note: See TracChangeset for help on using the changeset viewer.