Changeset e481a39 in sasmodels
- Timestamp:
- Mar 20, 2016 7:06:10 AM (9 years ago)
- 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:
- 3f12f59
- Parents:
- dff1088
- Location:
- sasmodels/models
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/binary_hard_sphere.c
r115d0f0 re481a39 13 13 ); 14 14 15 intcalculate_psfs(double qval,15 void calculate_psfs(double qval, 16 16 double r2, double nf2, 17 17 double aa, double phi, … … 34 34 double phi1,phi2,phr,a3; 35 35 double v1,v2,n1,n2,qr1,qr2,b1,b2,sc1,sc2; 36 int err;37 36 38 37 r2 = lg_radius; … … 52 51 nf2 = phr*a3/(1.0-phr+phr*a3); 53 52 // 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); 55 54 56 55 // /* do form factor calculations */ … … 103 102 } 104 103 105 intcalculate_psfs(double qval,104 void calculate_psfs(double qval, 106 105 double r2, double nf2, 107 106 double aa, double phi, … … 112 111 113 112 // calculate constant terms 114 double s 1,s2,v,a3,v1,v2,g11,g12,g22,wmv,wmv3,wmv4;113 double s2,v,a3,v1,v2,g11,g12,g22,wmv,wmv3,wmv4; 115 114 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; 117 116 double c11,c22,c12,f12,f22,ttt1,ttt2,ttt3,ttt4,yl,y13; 118 117 double t21,t22,t23,t31,t32,t33,t41,t42,yl3,wma3,y1; 119 118 120 119 s2 = 2.0*r2; 121 s1 = aa*s2; 120 // s1 = aa*s2; why is this never used? check original paper? 122 121 v = phi; 123 122 a3 = aa*aa*aa; … … 189 188 *s12=-c12/((1.+c11)*(1.+c22)-(c12)*(c12)); 190 189 191 return (err);190 return; 192 191 } 193 192 -
sasmodels/models/binary_hard_sphere.py
r115d0f0 re481a39 1 1 r""" 2 2 3 Definition 4 ---------- 3 5 The binary hard sphere model provides the scattering intensity, for binary 4 6 mixture of hard spheres including hard sphere interaction between those 5 7 particles, using rhw Percus-Yevick closure. The calculation is an exact 6 8 multi-component solution that properly accounts for the 3 partial structure 7 factors. 8 9 Definition 10 ---------- 9 factors as follows: 11 10 12 11 .. math:: 13 12 14 13 \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) 17 16 \end{eqnarray} 18 17 … … 26 25 27 26 \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} \\ 30 30 \alpha &=& R_1/R_2 = \text{size ratio} 31 31 \end{eqnarray} … … 69 69 **Author:** N/A **on:** 70 70 71 ** Modified by:** Paul Butler **on:** March 18, 201671 **Last Modified by:** Paul Butler **on:** March 20, 2016 72 72 73 ** Reviewed by:** Paul Butler **on:** March 18, 201673 **Last Reviewed by:** Paul Butler **on:** March 20, 2016 74 74 """ 75 75 76 import numpy as np 77 from numpy import pi, inf 76 from numpy import inf 77 78 category = "shape:sphere" 79 single = False # double precision only! 78 80 79 81 name = "binary_hard_sphere" … … 90 92 sld_solvent: solvent scattering length density. 91 93 """ 92 category = "shape:sphere"93 94 94 # ["name", "units", default, [lower, upper], "type", "description"], 95 95 parameters = [["radius_lg", "Ang", 100, [0, inf], "", … … 112 112 113 113 # 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, 114 demo = dict(sld_lg=3.5, sld_sm=0.5, sld_solvent=6.36, 116 115 radius_lg=100, radius_sm=20, 117 116 volfraction_lg=0.1, volfraction_sm=0.2) … … 125 124 126 125 # NOTE: test results taken from values returned by SasView 3.1.2 127 tests = [[{ 'scale':1.0}, 0.001, 25.8927262013]]126 tests = [[{}, 0.001, 25.8927262013]] 128 127
Note: See TracChangeset
for help on using the changeset viewer.