Changes in / [98d6cfc:3f12f59] in sasmodels


Ignore:
Location:
sasmodels/models
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/binary_hard_sphere.c

    r115d0f0 re481a39  
    1313    ); 
    1414 
    15 int calculate_psfs(double qval, 
     15void calculate_psfs(double qval, 
    1616    double r2, double nf2, 
    1717    double aa, double phi, 
     
    3434    double phi1,phi2,phr,a3; 
    3535    double v1,v2,n1,n2,qr1,qr2,b1,b2,sc1,sc2; 
    36     int err; 
    3736     
    3837    r2 = lg_radius; 
     
    5251    nf2 = phr*a3/(1.0-phr+phr*a3); 
    5352    // calculate the PSF's here 
    54     err = calculate_psfs(q,r2,nf2,aa,phi,&psf11,&psf22,&psf12); 
     53    calculate_psfs(q,r2,nf2,aa,phi,&psf11,&psf22,&psf12); 
    5554     
    5655    // /* do form factor calculations  */ 
     
    103102} 
    104103 
    105 int calculate_psfs(double qval, 
     104void calculate_psfs(double qval, 
    106105    double r2, double nf2, 
    107106    double aa, double phi, 
     
    112111     
    113112    //   calculate constant terms 
    114     double s1,s2,v,a3,v1,v2,g11,g12,g22,wmv,wmv3,wmv4; 
     113    double s2,v,a3,v1,v2,g11,g12,g22,wmv,wmv3,wmv4; 
    115114    double a1,a2i,a2,b1,b2,b12,gm1,gm12; 
    116     double err=0.0,yy,ay,ay2,ay3,t1,t2,t3,f11,y2,y3,tt1,tt2,tt3; 
     115    double yy,ay,ay2,ay3,t1,t2,t3,f11,y2,y3,tt1,tt2,tt3; 
    117116    double c11,c22,c12,f12,f22,ttt1,ttt2,ttt3,ttt4,yl,y13; 
    118117    double t21,t22,t23,t31,t32,t33,t41,t42,yl3,wma3,y1; 
    119118     
    120119    s2 = 2.0*r2; 
    121     s1 = aa*s2; 
     120//    s1 = aa*s2;  why is this never used?  check original paper? 
    122121    v = phi; 
    123122    a3 = aa*aa*aa; 
     
    189188    *s12=-c12/((1.+c11)*(1.+c22)-(c12)*(c12));    
    190189     
    191     return(err); 
     190    return; 
    192191} 
    193192 
  • sasmodels/models/binary_hard_sphere.py

    r115d0f0 re481a39  
    11r""" 
    22 
     3Definition 
     4---------- 
    35The binary hard sphere model provides the scattering intensity, for binary 
    46mixture of hard spheres including hard sphere interaction between those 
    57particles, using rhw Percus-Yevick closure. The calculation is an exact 
    68multi-component solution that properly accounts for the 3 partial structure 
    7 factors. 
    8  
    9 Definition 
    10 ---------- 
     9factors as follows: 
    1110 
    1211.. math:: 
    1312 
    1413    \begin{eqnarray} 
    15     I(q) = (1-x)f_1^2(q) S_{11}(q) + 2[x(1-x)]^{1/2} f_1(q)f_2(q)S_{12}(q) + \\ 
    16     x\,f_2^2(q)S_{22}(q) \\ 
     14    I(q) = (1-x)f_1^2(q) S_{11}(q) + 2[x(1-x)]^{1/2} f_1(q)f_2(q)S_{12}(q) + 
     15    x\,f_2^2(q)S_{22}(q) 
    1716    \end{eqnarray} 
    1817 
     
    2625 
    2726    \begin{eqnarray} 
    28     x &=& \frac{(\phi_2 / \phi)\alpha^3}{(1-(\phi_2/\phi) + (\phi_2/\phi) \\ 
    29     \alpha^3)} \phi &=& \phi_1 + \phi_2 = \text{total volume fraction} \\ 
     27    x &=& \frac{(\phi_2 / \phi)\alpha^3}{(1-(\phi_2/\phi) + (\phi_2/\phi) 
     28    \alpha^3)} \\ 
     29    \phi &=& \phi_1 + \phi_2 = \text{total volume fraction} \\ 
    3030    \alpha &=& R_1/R_2 = \text{size ratio} 
    3131    \end{eqnarray} 
     
    6969**Author:** N/A **on:** 
    7070 
    71 **Modified by:** Paul Butler **on:** March 18, 2016 
     71**Last Modified by:** Paul Butler **on:** March 20, 2016 
    7272 
    73 **Reviewed by:** Paul Butler **on:** March 18, 2016 
     73**Last Reviewed by:** Paul Butler **on:** March 20, 2016 
    7474""" 
    7575 
    76 import numpy as np 
    77 from numpy import pi, inf 
     76from numpy import inf 
     77 
     78category = "shape:sphere" 
     79single = False  # double precision only! 
    7880 
    7981name = "binary_hard_sphere" 
     
    9092        sld_solvent: solvent scattering length density. 
    9193""" 
    92 category = "shape:sphere" 
    93  
    9494#             ["name", "units", default, [lower, upper], "type", "description"], 
    9595parameters = [["radius_lg", "Ang", 100, [0, inf], "", 
     
    112112 
    113113# parameters for demo and documentation 
    114 demo = dict(scale=1, background=0, 
    115             sld_lg=3.5, sld_sm=0.5, sld_solvent=6.36, 
     114demo = dict(sld_lg=3.5, sld_sm=0.5, sld_solvent=6.36, 
    116115            radius_lg=100, radius_sm=20, 
    117116            volfraction_lg=0.1, volfraction_sm=0.2) 
     
    125124 
    126125# NOTE: test results taken from values returned by SasView 3.1.2 
    127 tests = [[{'scale':1.0}, 0.001, 25.8927262013]] 
     126tests = [[{}, 0.001, 25.8927262013]] 
    128127 
Note: See TracChangeset for help on using the changeset viewer.