Changeset 3e428ec in sasmodels for sasmodels/models/hardsphere.py
- Timestamp:
- Mar 9, 2015 3:14:03 PM (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:
- ddfe69c
- Parents:
- 485aee2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/hardsphere.py
r3c56da87 r3e428ec 37 37 title = "Hard sphere structure factor, with Percus-Yevick closure" 38 38 description = """\ 39 39 [Hard sphere structure factor, with Percus-Yevick closure] 40 40 Interparticle S(Q) for random, non-interacting spheres. 41 42 43 systems. Though strictly the maths needs to be modified - 44 45 46 41 May be a reasonable approximation for other shapes of 42 particles that freely rotate, and for moderately polydisperse 43 systems. Though strictly the maths needs to be modified - 44 which sasview does not do yet. 45 effect_radius is the hard sphere radius 46 volfraction is the volume fraction occupied by the spheres. 47 47 """ 48 48 category = "structure-factor" 49 49 50 parameters = [ 51 # [ "name", "units", default, [lower, upper], "type", 52 # "description" ], 53 [ "effect_radius", "Ang", 50.0, [0, inf], "volume", 54 "effective radius of hard sphere" ], 55 [ "volfraction", "", 0.2, [0, 0.74], "", 56 "volume fraction of hard spheres" ], 57 ] 50 # ["name", "units", default, [lower, upper], "type","description"], 51 parameters = [["effect_radius", "Ang", 50.0, [0, inf], "volume", 52 "effective radius of hard sphere"], 53 ["volfraction", "", 0.2, [0, 0.74], "", 54 "volume fraction of hard spheres"], 55 ] 58 56 59 57 # No volume normalization despite having a volume parameter … … 64 62 65 63 Iq = """ 66 67 68 69 70 71 72 73 74 75 76 77 78 // 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 64 double denom,dnum,alpha,beta,gamm,a,asq,ath,afor,rca,rsa; 65 double calp,cbeta,cgam,prefac,c,vstruc; 66 double struc; 67 68 // compute constants 69 denom = pow((1.0-volfraction),4); 70 dnum = pow((1.0 + 2.0*volfraction),2); 71 alpha = dnum/denom; 72 beta = -6.0*volfraction*pow((1.0 + volfraction/2.0),2)/denom; 73 gamm = 0.50*volfraction*dnum/denom; 74 // 75 // calculate the structure factor 76 // 77 a = 2.0*q*effect_radius; 78 asq = a*a; 79 ath = asq*a; 80 afor = ath*a; 81 SINCOS(a,rsa,rca); 82 //rca = cos(a); 83 //rsa = sin(a); 84 calp = alpha*(rsa/asq - rca/a); 85 cbeta = beta*(2.0*rsa/asq - (asq - 2.0)*rca/ath - 2.0/ath); 86 cgam = gamm*(-rca/a + (4.0/a)*((3.0*asq - 6.0)*rca/afor + (asq - 6.0)*rsa/ath + 6.0/afor)); 87 prefac = -24.0*volfraction/a; 88 c = prefac*(calp + cbeta + cgam); 89 vstruc = 1.0/(1.0-c); 90 struc = vstruc; 91 92 return(struc); 95 93 """ 96 94 … … 103 101 # VR defaults to 1.0 104 102 105 demo = dict(effect_radius = 200,volfraction = 0.2,effect_radius_pd = 0.1,effect_radius_pd_n =40)103 demo = dict(effect_radius=200, volfraction=0.2, effect_radius_pd=0.1, effect_radius_pd_n=40) 106 104 oldname = 'HardsphereStructure' 107 105 oldpars = dict()
Note: See TracChangeset
for help on using the changeset viewer.