1 | # Note: model title and parameter table are inserted automatically |
---|
2 | r"""This calculates the interparticle structure factor for monodisperse spherical particles interacting through hard |
---|
3 | sphere (excluded volume) interactions. |
---|
4 | |
---|
5 | The calculation uses the Percus-Yevick closure where the interparticle potential is |
---|
6 | |
---|
7 | .. image:: img/HardSphere_223.PNG |
---|
8 | |
---|
9 | where *r* is the distance from the center of the sphere of a radius *R*. |
---|
10 | |
---|
11 | For a 2D plot, the wave transfer is defined as |
---|
12 | |
---|
13 | .. math:: |
---|
14 | |
---|
15 | Q = \sqrt{Q_x^2 + Q_y^2} |
---|
16 | |
---|
17 | |
---|
18 | ============== ======== ============= |
---|
19 | Parameter name Units Default value |
---|
20 | ============== ======== ============= |
---|
21 | effect_radius |Ang| 50.0 |
---|
22 | volfraction None 0.2 |
---|
23 | ============== ======== ============= |
---|
24 | |
---|
25 | .. image:: img/HardSphere_224.jpg |
---|
26 | |
---|
27 | *Figure. 1D plot using the default values (in linear scale).* |
---|
28 | |
---|
29 | REFERENCE |
---|
30 | |
---|
31 | J K Percus, J Yevick, *J. Phys. Rev.*, 110, (1958) 1 |
---|
32 | """ |
---|
33 | |
---|
34 | from numpy import pi, inf |
---|
35 | |
---|
36 | name = "hardsphere" |
---|
37 | title = "Hard sphere structure factor, with Percus-Yevick closure" |
---|
38 | description = """\ |
---|
39 | [Hard sphere structure factor, with Percus-Yevick closure] |
---|
40 | Interparticle S(Q) for random, non-interacting spheres. |
---|
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 | """ |
---|
48 | |
---|
49 | parameters = [ |
---|
50 | # [ "name", "units", default, [lower, upper], "type", |
---|
51 | # "description" ], |
---|
52 | [ "effect_radius", "Ang", 50.0, [0, inf], "volume", |
---|
53 | "effective radius of hard sphere" ], |
---|
54 | [ "volfraction", "", 0.2, [0, 0.74], "", |
---|
55 | "volume fraction of hard spheres" ], |
---|
56 | ] |
---|
57 | |
---|
58 | # No volume normalization despite having a volume parameter |
---|
59 | # This should perhaps be volume normalized? |
---|
60 | form_volume = """ |
---|
61 | return 1.0; |
---|
62 | """ |
---|
63 | |
---|
64 | Iq = """ |
---|
65 | double denom,dnum,alpha,beta,gamm,a,asq,ath,afor,rca,rsa; |
---|
66 | double calp,cbeta,cgam,prefac,c,vstruc; |
---|
67 | double struc; |
---|
68 | |
---|
69 | // compute constants |
---|
70 | denom = pow((1.0-volfraction),4); |
---|
71 | dnum = pow((1.0 + 2.0*volfraction),2); |
---|
72 | alpha = dnum/denom; |
---|
73 | beta = -6.0*volfraction*pow((1.0 + volfraction/2.0),2)/denom; |
---|
74 | gamm = 0.50*volfraction*dnum/denom; |
---|
75 | // |
---|
76 | // calculate the structure factor |
---|
77 | // |
---|
78 | a = 2.0*q*effect_radius; |
---|
79 | asq = a*a; |
---|
80 | ath = asq*a; |
---|
81 | afor = ath*a; |
---|
82 | SINCOS(a,rsa,rca); |
---|
83 | //rca = cos(a); |
---|
84 | //rsa = sin(a); |
---|
85 | calp = alpha*(rsa/asq - rca/a); |
---|
86 | cbeta = beta*(2.0*rsa/asq - (asq - 2.0)*rca/ath - 2.0/ath); |
---|
87 | cgam = gamm*(-rca/a + (4.0/a)*((3.0*asq - 6.0)*rca/afor + (asq - 6.0)*rsa/ath + 6.0/afor)); |
---|
88 | prefac = -24.0*volfraction/a; |
---|
89 | c = prefac*(calp + cbeta + cgam); |
---|
90 | vstruc = 1.0/(1.0-c); |
---|
91 | struc = vstruc; |
---|
92 | |
---|
93 | return(struc); |
---|
94 | """ |
---|
95 | |
---|
96 | Iqxy = """ |
---|
97 | // never called since no orientation or magnetic parameters. |
---|
98 | return -1.0; |
---|
99 | """ |
---|
100 | |
---|
101 | # ER defaults to 0.0 |
---|
102 | # VR defaults to 1.0 |
---|
103 | |
---|
104 | demo = dict(effect_radius = 200,volfraction = 0.2,effect_radius_pd = 0.1,effect_radius_pd_n = 40) |
---|
105 | oldname = 'HardsphereStructure' |
---|
106 | oldpars = dict() |
---|
107 | |
---|