Ignore:
Timestamp:
Jan 20, 2016 4:50:50 AM (8 years ago)
Author:
piotr
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
7ed702f
Parents:
30b4ddf
Message:

Code review issues from PK addressed.

Added Taylor expansion utility function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/polymer_excl_volume.py

    r23d3b41 r513efc5  
    11r""" 
    2 This model describes the scattering from polymer chains subject to excluded volume effects 
    3 and has been used as a template for describing mass fractals. 
     2This model describes the scattering from polymer chains subject to excluded 
     3volume effects and has been used as a template for describing mass fractals. 
    44 
    55Definition 
    66---------- 
    77 
    8 The form factor was originally presented in the following integral form (Benoit, 1957) 
     8The form factor was originally presented in the following integral form 
     9(Benoit, 1957) 
    910 
    1011.. math:: 
     
    1617$a$ is the statistical segment length of the polymer chain, 
    1718and $n$ is the degree of polymerization. 
    18 This integral was later put into an almost analytical form as follows (Hammouda, 1993) 
     19This integral was later put into an almost analytical form as follows 
     20(Hammouda, 1993) 
    1921 
    2022.. math:: 
     
    4345Note that this model applies only in the mass fractal range (ie, $5/3<=m<=3$ ) 
    4446and **does not apply** to surface fractals ( $3<m<=4$ ). 
    45 It also does not reproduce the rigid rod limit (m=1) because it assumes chain flexibility 
    46 from the outset. It may cover a portion of the semi-flexible chain range ( $1<m<5/3$ ). 
     47It also does not reproduce the rigid rod limit (m=1) because it assumes chain 
     48flexibility from the outset. It may cover a portion of the semi-flexible chain 
     49range ( $1<m<5/3$ ). 
    4750 
    48 A low-Q expansion yields the Guinier form and a high-Q expansion yields the Porod form 
    49 which is given by 
     51A low-Q expansion yields the Guinier form and a high-Q expansion yields the 
     52Porod form which is given by 
    5053 
    5154.. math:: 
    5255 
    53     P(Q\rightarrow \infty) = \frac{1}{\nu U^{1/2\nu}}\Gamma\left(\frac{1}{2\nu}\right) - 
    54     \frac{1}{\nu U^{1/\nu}}\Gamma\left(\frac{1}{\nu}\right) 
     56    P(Q\rightarrow \infty) = \frac{1}{\nu U^{1/2\nu}}\Gamma\left( 
     57    \frac{1}{2\nu}\right) - \frac{1}{\nu U^{1/\nu}}\Gamma\left( 
     58    \frac{1}{\nu}\right) 
    5559 
    5660Here $\Gamma(x) = \gamma(x,\infty)$ is the gamma function. 
     
    102106name = "polymer_excl_volume" 
    103107title = "Polymer Excluded Volume model" 
    104 description = """Compute the scattering intensity from polymers with excluded volume effects. 
     108description = """Compute the scattering intensity from polymers with excluded 
     109                volume effects. 
    105110                rg:         radius of gyration 
    106111                porod_exp:  Porod exponent 
     
    127132 
    128133    intensity = ((1.0/(nu*power(u, o2nu))) * (gamma(o2nu)*gammainc(o2nu, u) - 
    129                  1.0/power(u, o2nu) * gamma(porod_exp)*gammainc(porod_exp, u)))*(q > 0) + \ 
    130                  1.0*(q <= 0) 
     134                  1.0/power(u, o2nu) * gamma(porod_exp) * 
     135                  gammainc(porod_exp, u))) * (q > 0) + 1.0*(q <= 0) 
    131136 
    132137    return intensity 
     
    156161         [{'rg': 2.2, 'porod_exp': 22.0, 'background': 100.0}, 5.0, 100.0], 
    157162 
    158          [{'rg': 1.1, 'porod_exp': 1, 'background': 10.0, 'scale': 1.25}, 20000., 10.0000712097] 
     163         [{'rg': 1.1, 'porod_exp': 1, 'background': 10.0, 'scale': 1.25}, 
     164         20000., 10.0000712097] 
    159165         ] 
Note: See TracChangeset for help on using the changeset viewer.