Ignore:
Timestamp:
Oct 15, 2016 5:49:53 PM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
e30d645
Parents:
ed0827a
Message:

code cleanup for rectangular prism models

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/hollow_rectangular_prism_thin_walls.py

    ra807206 rab2aea8  
    33r""" 
    44 
    5 This model provides the form factor, *P(q)*, for a hollow rectangular 
     5This model provides the form factor, $P(q)$, for a hollow rectangular 
    66prism with infinitely thin walls. It computes only the 1D scattering, not the 2D. 
    77 
     
    1414 
    1515Assuming a hollow parallelepiped with infinitely thin walls, edge lengths 
    16 :math:`A \le B \le C` and presenting an orientation with respect to the 
    17 scattering vector given by |theta| and |phi|, where |theta| is the angle 
    18 between the *z* axis and the longest axis of the parallelepiped *C*, and 
    19 |phi| is the angle between the scattering vector (lying in the *xy* plane) 
    20 and the *y* axis, the form factor is given by 
     16$A \le B \le C$ and presenting an orientation with respect to the 
     17scattering vector given by $\theta$ and $\phi$, where $\theta$ is the angle 
     18between the $z$ axis and the longest axis of the parallelepiped $C$, and 
     19$\phi$ is the angle between the scattering vector (lying in the $xy$ plane) 
     20and the $y$ axis, the form factor is given by 
    2121 
    2222.. math:: 
    23   P(q) =  \frac{1}{V^2} \frac{2}{\pi} \int_0^{\frac{\pi}{2}} 
    24   \int_0^{\frac{\pi}{2}} [A_L(q)+A_T(q)]^2 \sin\theta d\theta d\phi 
     23 
     24    P(q) = \frac{1}{V^2} \frac{2}{\pi} \int_0^{\frac{\pi}{2}} 
     25           \int_0^{\frac{\pi}{2}} [A_L(q)+A_T(q)]^2 \sin\theta\,d\theta\,d\phi 
    2526 
    2627where 
    2728 
    2829.. math:: 
    29   V = 2AB + 2AC + 2BC 
    3030 
    31 .. math:: 
    32   A_L(q) =  8 \times \frac{ \sin \bigl( q \frac{A}{2} \sin\phi \sin\theta \bigr) 
    33                               \sin \bigl( q \frac{B}{2} \cos\phi \sin\theta \bigr) 
    34                               \cos \bigl( q \frac{C}{2} \cos\theta \bigr) } 
    35                             {q^2 \, \sin^2\theta \, \sin\phi \cos\phi} 
    36  
    37 .. math:: 
    38   A_T(q) =  A_F(q) \times \frac{2 \, \sin \bigl( q \frac{C}{2} \cos\theta \bigr)}{q \, \cos\theta} 
     31    V &= 2AB + 2AC + 2BC \\ 
     32    A_L(q) &=  8 \times \frac{ 
     33            \sin \left( \tfrac{1}{2} q A \sin\phi \sin\theta \right) 
     34            \sin \left( \tfrac{1}{2} q B \cos\phi \sin\theta \right) 
     35            \cos \left( \tfrac{1}{2} q C \cos\theta \right) 
     36        }{q^2 \, \sin^2\theta \, \sin\phi \cos\phi} \\ 
     37    A_T(q) &=  A_F(q) \times 
     38      \frac{2\,\sin \left( \tfrac{1}{2} q C \cos\theta \right)}{q\,\cos\theta} 
    3939 
    4040and 
    4141 
    4242.. math:: 
    43   A_F(q) =  4 \frac{ \cos \bigl( q \frac{A}{2} \sin\phi \sin\theta \bigr) 
    44                        \sin \bigl( q \frac{B}{2} \cos\phi \sin\theta \bigr) } 
     43 
     44  A_F(q) =  4 \frac{ \cos \left( \tfrac{1}{2} q A \sin\phi \sin\theta \right) 
     45                       \sin \left( \tfrac{1}{2} q B \cos\phi \sin\theta \right) } 
    4546                     {q \, \cos\phi \, \sin\theta} + 
    46               4 \frac{ \sin \bigl( q \frac{A}{2} \sin\phi \sin\theta \bigr) 
    47                        \cos \bigl( q \frac{B}{2} \cos\phi \sin\theta \bigr) } 
     47              4 \frac{ \sin \left( \tfrac{1}{2} q A \sin\phi \sin\theta \right) 
     48                       \cos \left( \tfrac{1}{2} q B \cos\phi \sin\theta \right) } 
    4849                     {q \, \sin\phi \, \sin\theta} 
    4950 
     
    5152 
    5253.. math:: 
    53   I(q) = \mbox{scale} \times V \times (\rho_{\mbox{p}} - \rho_{\mbox{solvent}})^2 \times P(q) 
    5454 
    55 where *V* is the volume of the rectangular prism, :math:`\rho_{\mbox{p}}` 
    56 is the scattering length of the parallelepiped, :math:`\rho_{\mbox{solvent}}` 
     55  I(q) = \text{scale} \times V \times (\rho_\text{p} - \rho_\text{solvent})^2 \times P(q) 
     56 
     57where $V$ is the volume of the rectangular prism, $\rho_\text{p}$ 
     58is the scattering length of the parallelepiped, $\rho_\text{solvent}$ 
    5759is the scattering length of the solvent, and (if the data are in absolute 
    5860units) *scale* represents the volume fraction (which is unitless). 
     
    127129# parameters for demo 
    128130demo = dict(scale=1, background=0, 
    129             sld=6.3e-6, sld_solvent=1.0e-6, 
     131            sld=6.3, sld_solvent=1.0, 
    130132            length_a=35, b2a_ratio=1, c2a_ratio=1, 
    131133            length_a_pd=0.1, length_a_pd_n=10, 
Note: See TracChangeset for help on using the changeset viewer.