Changeset 7d4428c in sasmodels
- Timestamp:
- Feb 18, 2016 7:21:11 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:
- d507c3a
- Parents:
- 66d119f (diff), 6abd46f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Files:
-
- 21 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
.gitignore
r66ebdd6 r4a82d4d 1 1 /build/ 2 2 /dist/ 3 /logs/ 3 4 /*.csv 4 5 *.pyc … … 16 17 /.project 17 18 /.pydevproject 19 /.idea 20 /sasmodels.egg-info/ -
doc/rst_prolog
r19dcb933 r0a4628d 60 60 .. |g/cm^3| replace:: g\ |cdot|\ cm\ :sup:`-3` 61 61 .. |fm^2| replace:: fm\ :sup:`2` 62 .. |Ang*cm^-1| replace:: |Ang|\ |cdot|\ cm\ :sup:`-1` -
multi_compare.sh
r5753e4e r0a4628d 1 #!/bin/ sh1 #!/bin/bash 2 2 3 3 sasview=( ../sasview/build/lib.* ) -
sasmodels/convert.py
r3964f92 r34d6cab 10 10 'broad_peak', 11 11 'two_lorentzian', 12 "two_power_law", 12 13 'gel_fit', 13 14 'gauss_lorentz_gel', … … 151 152 pars['string_thickness_pd_n'] = 0 152 153 pars['number_of_pearls_pd_n'] = 0 154 elif name == 'line': 155 pars['scale'] = 1 156 pars['background'] = 0 153 157 elif name == 'rpa': 154 158 pars['case_num'] = int(pars['case_num']) -
sasmodels/generate.py
reafc9fa r0a4628d 233 233 "degrees": "degree", 234 234 "1/cm": "|cm^-1|", 235 "Ang/cm": "|Ang*cm^-1|", 235 236 "": "None", 236 237 } -
sasmodels/models/hardsphere.py
r13ed84c r093f754 35 35 from numpy import inf 36 36 37 name = "hardsphere "38 title = "Hard sphere structure factor , with Percus-Yevick closure"37 name = "hardsphere_fish" 38 title = "Hard sphere structure factor from FISH, with Percus-Yevick closure" 39 39 description = """\ 40 40 [Hard sphere structure factor, with Percus-Yevick closure] … … 55 55 "volume fraction of hard spheres"], 56 56 ] 57 single = False58 57 59 58 # No volume normalization despite having a volume parameter … … 64 63 65 64 Iq = """ 66 double denom,dnum,alpha,beta,gamm,a,asq,ath,afor,rca,rsa; 67 double calp,cbeta,cgam,prefac,c,vstruc; 68 double struc; 65 double D,A,B,G,X,X2,X4,S,C,FF,HARDSPH; 69 66 70 // compute constants 71 denom = pow((1.0-volfraction),4); 72 dnum = pow((1.0 + 2.0*volfraction),2); 73 alpha = dnum/denom; 74 beta = -6.0*volfraction*pow((1.0 + volfraction/2.0),2)/denom; 75 gamm = 0.50*volfraction*dnum/denom; 76 // 77 // calculate the structure factor 78 // 79 a = 2.0*q*effect_radius; 80 asq = a*a; 81 ath = asq*a; 82 afor = ath*a; 83 SINCOS(a,rsa,rca); 84 //rca = cos(a); 85 //rsa = sin(a); 86 calp = alpha*(rsa/asq - rca/a); 87 cbeta = beta*(2.0*rsa/asq - (asq - 2.0)*rca/ath - 2.0/ath); 88 cgam = gamm*(-rca/a + (4.0/a)*((3.0*asq - 6.0)*rca/afor + (asq - 6.0)*rsa/ath + 6.0/afor)); 89 prefac = -24.0*volfraction/a; 90 c = prefac*(calp + cbeta + cgam); 91 vstruc = 1.0/(1.0-c); 92 struc = vstruc; 67 if(fabs(effect_radius) < 1.E-12) { 68 HARDSPH=1.0; 69 return(HARDSPH); 70 } 71 D=pow((1.-volfraction),2); 72 A=pow((1.+2.*volfraction)/D, 2); 73 X=fabs(q*effect_radius*2.0); 93 74 94 return(struc); 75 if(X < 5.E-06) { 76 HARDSPH=1./A; 77 return(HARDSPH); 78 } 79 X2=pow(X,2); 80 X4=pow(X2,2); 81 B=-6.*volfraction* pow((1.+0.5*volfraction)/D ,2); 82 G=0.5*volfraction*A; 83 84 if(X < 0.2) { 85 // use Taylor series expansion for small X, IT IS VERY PICKY ABOUT THE X CUT OFF VALUE, ought to be lower in double. 86 // No obvious way to rearrange the equations to avoid needing a very high number of significant figures. 87 // Series expansion found using Mathematica software. Numerical test in .xls showed terms to X^2 are sufficient 88 // for 5 or 6 significant figures but I put the X^4 one in anyway 89 FF = 8*A +6*B + 4*G - (0.8*A +2.0*B/3.0 +0.5*G)*X2 +(A/35. +B/40. +G/50.)*X4; 90 // combining the terms makes things worse at smallest Q in single precision 91 //FF = (8-0.8*X2)*A +(3.0-X2/3.)*2*B + (4+0.5*X2)*G +(A/35. +B/40. +G/50.)*X4; 92 // note that G = -volfraction*A/2, combining this makes no further difference at smallest Q 93 //FF = (8 +2.*volfraction + ( volfraction/4. -0.8 +(volfraction/100. -1./35.)*X2 )*X2 )*A + (3.0 -X2/3. +X4/40)*2*B; 94 HARDSPH= 1./(1. + volfraction*FF ); 95 return(HARDSPH); 96 } 97 SINCOS(X,S,C); 98 99 // RKH Feb 2016, use version from FISH code as it is better than original sasview one at small Q in single precision 100 FF=A*(S-X*C)/X + B*(2.*X*S -(X2-2.)*C -2.)/X2 + G*( (4.*X2*X -24.*X)*S -(X4 -12.*X2 +24.)*C +24. )/X4; 101 HARDSPH= 1./(1. + 24.*volfraction*FF/X2 ); 102 103 // rearrange the terms, is now about same as sasmodels 104 // FF=A*(S/X-C) + B*(2.*S/X - C +2.0*(C-1.0)/X2) + G*( (4./X -24./X3)*S -(1.0 -12./X2 +24./X4)*C +24./X4 ); 105 // HARDSPH= 1./(1. + 24.*volfraction*FF/X2 ); 106 // remove 1/X2 from final line, take more powers of X inside the brackets, stil bad 107 // FF=A*(S/X3-C/X2) + B*(2.*S/X3 - C/X2 +2.0*(C-1.0)/X4) + G*( (4./X -24./X3)*S -(1.0 -12./X2 +24./X4)*C +24./X4 )/X2; 108 // HARDSPH= 1./(1. + 24.*volfraction*FF ); 109 return(HARDSPH); 95 110 """ 96 111 … … 106 121 oldname = 'HardsphereStructure' 107 122 oldpars = dict() 108 123 # Q=0.001 is in the Taylor series, low Q part, so add Q=0.1, assuming double precision sasview is correct 109 124 tests = [ 110 125 [ {'scale': 1.0, 'background' : 0.0, 'effect_radius' : 50.0, 'volfraction' : 0.2, 111 'effect_radius_pd' : 0}, [0.001 ], [0.209128]]126 'effect_radius_pd' : 0}, [0.001,0.1], [0.209128,0.930587]] 112 127 ] 113 128 -
setup.py
r040575f r3eb3312 11 11 version = "1.0.0a", 12 12 description = "sasmodels package", 13 long_description=open('README. rst').read(),13 long_description=open('README.md').read(), 14 14 author = "SasView Collaboration", 15 15 author_email = "management@sasview.org", -
sasmodels/models/lib/gauss76.c
r994d77f r66d119f 7 7 * 8 8 */ 9 #define N_POINTS_76 76 9 10 10 11 // Gaussians 11 constant double Gauss76Wt[ 76]={12 constant double Gauss76Wt[N_POINTS_76]={ 12 13 .00126779163408536, //0 13 14 .00294910295364247, … … 88 89 }; 89 90 90 constant double Gauss76Z[ 76]={91 constant double Gauss76Z[N_POINTS_76]={ 91 92 -.999505948362153, //0 92 93 -.997397786355355,
Note: See TracChangeset
for help on using the changeset viewer.