Changes in / [0c2da4b:acfb094] in sasmodels


Ignore:
Location:
sasmodels
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/conversion_table.py

    rd3e3f756 rbb584b3  
    549549            "radius": "core_radius", 
    550550            "sld_solvent": "core_sld", 
    551             "n_shells": "n_pairs", 
     551            "n_pairs": "n_pairs", 
    552552            "thick_shell": "s_thickness", 
    553553            "sld": "shell_sld", 
  • sasmodels/models/multilayer_vesicle.c

    rec1d4bc r925ad6e  
    1 static double 
    2 form_volume(double radius, 
    3           double thick_shell, 
    4           double thick_solvent, 
    5           double fp_n_shells) 
    6 { 
    7     int n_shells = (int)(fp_n_shells + 0.5); 
    8     double R_N = radius + n_shells*(thick_shell+thick_solvent) - thick_solvent; 
    9     return M_4PI_3*cube(R_N); 
    10 } 
    11  
    12 static double 
    13 multilayer_vesicle_kernel(double q, 
     1static 
     2double multilayer_vesicle_kernel(double q, 
    143          double volfraction, 
    154          double radius, 
     
    187          double sld_solvent, 
    198          double sld, 
    20           int n_shells) 
     9          double n_pairs) 
    2110{ 
    2211    //calculate with a loop, two shells at a time 
     
    4029 
    4130        //do 2 layers at a time 
    42         ii++; 
     31        ii += 1; 
    4332 
    44     } while(ii <= n_shells-1);  //change to make 0 < n_shells < 2 correspond to 
     33    } while(ii <= n_pairs-1);  //change to make 0 < n_pairs < 2 correspond to 
    4534                               //unilamellar vesicles (C. Glinka, 11/24/03) 
    4635 
    47     return 1.0e-4*volfraction*fval*fval;  // Volume normalization happens in caller 
     36    fval *= volfraction*1.0e-4*fval/voli; 
     37 
     38    return(fval); 
    4839} 
    4940 
    50 static double 
    51 Iq(double q, 
     41static 
     42double Iq(double q, 
    5243          double volfraction, 
    5344          double radius, 
     
    5647          double sld_solvent, 
    5748          double sld, 
    58           double fp_n_shells) 
     49          double n_pairs) 
    5950{ 
    60     int n_shells = (int)(fp_n_shells + 0.5); 
    6151    return multilayer_vesicle_kernel(q, 
    6252           volfraction, 
     
    6656           sld_solvent, 
    6757           sld, 
    68            n_shells); 
     58           n_pairs); 
    6959} 
    7060 
  • sasmodels/models/multilayer_vesicle.py

    rec1d4bc r925ad6e  
    2020.. math:: 
    2121 
    22     P(q) = \text{scale}\frac{\phi}{V(R_N)} F^2(q) + \text{background} 
     22    P(q) = \frac{\text{scale.volfraction}}{V_t} F^2(q) + \text{background} 
    2323 
    2424where 
     
    2626.. math:: 
    2727 
    28      F(q) = (\rho_\text{shell}-\rho_\text{solv}) \sum_{i=1}^{N} \left[ 
    29      3V(r_i)\frac{\sin(qr_i) - qr_i\cos(qr_i)}{(qr_i)^3} 
    30      - 3V(R_i)\frac{\sin(qR_i) - qR_i\cos(qR_i)}{(qR_i)^3} 
     28     F(q) = (\rho_{shell}-\rho_{solv}) \sum_{i=1}^{n\_pairs} \left[ 
     29     3V(R_i)\frac{\sin(qR_i)-qR_i\cos(qR_i)}{(qR_i)^3} \\ 
     30      - 3V(R_i+t_s)\frac{\sin(q(R_i+t_s))-q(R_i+t_s)\cos(q(R_i+t_s))}{(q(R_i+t_s))^3} 
    3131     \right] 
    3232 
    33 for 
    3433 
    35 .. math:: 
     34where $R_i = r_c + (i-1)(t_s + t_w)$ 
     35    
     36where $V_t$ is the volume of the whole particle, $V(R)$ is the volume of a sphere 
     37of radius $R$, $r_c$ is the radius of the core, $\rho_{shell}$ is the scattering length  
     38density of a shell, $\rho_{solv}$ is the scattering length density of the solvent. 
    3639 
    37      r_i &= r_c + (i-1)(t_s + t_w) && \text{ solvent radius before shell } i \\ 
    38      R_i &= r_i + t_s && \text{ shell radius for shell } i 
    39  
    40 $\phi$ is the volume fraction of particles, $V(r)$ is the volume of a sphere 
    41 of radius $r$, $r_c$ is the radius of the core, $t_s$ is the thickness of 
    42 the shell, $t_w$ is the thickness of the solvent layer between the shells, 
    43 $\rho_\text{shell}$ is the scattering length density of a shell, and 
    44 $\rho_\text{solv}$ is the scattering length density of the solvent. 
    4540 
    4641The 2D scattering intensity is the same as 1D, regardless of the orientation 
     
    5146    q = \sqrt{q_x^2 + q_y^2} 
    5247 
    53 The outer-most shell radius $R_N$ is used as the effective radius 
    54 for $P(Q)$ when $P(Q) * S(Q)$ is applied. 
     48 
     49The outer most radius 
     50 
     51$radius + n\_pairs * thick\_shell + (n\_pairs- 1) * thick\_solvent$ 
     52 
     53is used for both the volume fraction normalization and for the  
     54effective radius for *S(Q)* when $P(Q) * S(Q)$ is applied. 
    5555 
    5656For information about polarised and magnetic scattering, see 
     
    8989    sld_solvent: solvent scattering length density 
    9090    sld: shell scattering length density 
    91     n_shells:number of "shell plus solvent" layer pairs 
     91    n_pairs:number of "shell plus solvent" layer pairs 
    9292    background: incoherent background 
    9393        """ 
     
    9898parameters = [ 
    9999    ["volfraction", "",  0.05, [0.0, 1],  "", "volume fraction of vesicles"], 
    100     ["radius", "Ang", 60.0, [0.0, inf],  "volume", "radius of solvent filled core"], 
    101     ["thick_shell", "Ang",        10.0, [0.0, inf],  "volume", "thickness of one shell"], 
    102     ["thick_solvent", "Ang",        10.0, [0.0, inf],  "volume", "solvent thickness between shells"], 
     100    ["radius", "Ang", 60.0, [0.0, inf],  "", "radius of solvent filled core"], 
     101    ["thick_shell", "Ang",        10.0, [0.0, inf],  "", "thickness of one shell"], 
     102    ["thick_solvent", "Ang",        10.0, [0.0, inf],  "", "solvent thickness between shells"], 
    103103    ["sld_solvent",    "1e-6/Ang^2",  6.4, [-inf, inf], "sld", "solvent scattering length density"], 
    104104    ["sld",   "1e-6/Ang^2",  0.4, [-inf, inf], "sld", "Shell scattering length density"], 
    105     ["n_shells",     "",            2.0, [1.0, inf],  "volume", "Number of shell plus solvent layer pairs"], 
     105    ["n_pairs",     "",            2.0, [1.0, inf],  "", "Number of shell plus solvent layer pairs"], 
    106106    ] 
    107107# pylint: enable=bad-whitespace, line-too-long 
     
    109109source = ["lib/sas_3j1x_x.c", "multilayer_vesicle.c"] 
    110110 
    111 def ER(radius, thick_shell, thick_solvent, n_shells): 
    112     n_shells = int(n_shells+0.5) 
    113     return radius + n_shells * (thick_shell + thick_solvent) - thick_solvent 
     111polydispersity = ["radius", "n_pairs"] 
    114112 
    115113demo = dict(scale=1, background=0, 
     
    120118            sld_solvent=6.4, 
    121119            sld=0.4, 
    122             n_shells=2.0) 
     120            n_pairs=2.0) 
    123121 
    124122tests = [ 
     
    129127      'sld_solvent': 6.4, 
    130128      'sld': 0.4, 
    131       'n_shells': 2.0, 
     129      'n_pairs': 2.0, 
    132130      'scale': 1.0, 
    133131      'background': 0.001, 
     
    140138      'sld_solvent': 6.4, 
    141139      'sld': 0.4, 
    142       'n_shells': 2.0, 
     140      'n_pairs': 2.0, 
    143141      'scale': 1.0, 
    144142      'background': 0.001, 
Note: See TracChangeset for help on using the changeset viewer.