[a84a0ca] | 1 | # Note: model title and parameter table are inserted automatically |
---|
| 2 | r""" |
---|
| 3 | This calculates the interparticle structure factor for a square well fluid spherical particles. The mean spherical |
---|
| 4 | approximation (MSA) closure was used for this calculation, and is not the most appropriate closure for an attractive |
---|
| 5 | interparticle potential. This solution has been compared to Monte Carlo simulations for a square well fluid, showing |
---|
| 6 | this calculation to be limited in applicability to well depths |epsilon| < 1.5 kT and volume fractions |phi| < 0.08. |
---|
| 7 | |
---|
| 8 | Positive well depths correspond to an attractive potential well. Negative well depths correspond to a potential |
---|
| 9 | "shoulder", which may or may not be physically reasonable. The stickyhardsphere model may be a better choice in |
---|
| 10 | some circumstances. Computed values may behave badly at extremely small $qR$. |
---|
| 11 | |
---|
| 12 | The well width (|lambda| ) is defined as multiples of the particle diameter (2\*\ *R*\ ) |
---|
| 13 | |
---|
| 14 | The interaction potential is: |
---|
| 15 | |
---|
[aa9e4e3] | 16 | .. image:: img/squarewell.png |
---|
[a84a0ca] | 17 | |
---|
| 18 | .. math:: |
---|
| 19 | |
---|
| 20 | U(r) = \begin{cases} |
---|
| 21 | \infty & r < 2R \\ |
---|
| 22 | -\epsilon & 2R \leq r < 2R\lambda \\ |
---|
| 23 | 0 & r \geq 2R\lambda |
---|
| 24 | \end{cases} |
---|
| 25 | |
---|
| 26 | where $r$ is the distance from the center of the sphere of a radius $R$. |
---|
| 27 | |
---|
| 28 | In sasview the effective radius may be calculated from the parameters |
---|
| 29 | used in the form factor $P(q)$ that this $S(q)$ is combined with. |
---|
| 30 | |
---|
| 31 | For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as |
---|
| 32 | |
---|
| 33 | .. math:: |
---|
| 34 | |
---|
| 35 | q = \sqrt{q_x^2 + q_y^2} |
---|
| 36 | |
---|
[2f63032] | 37 | References |
---|
| 38 | ---------- |
---|
[a84a0ca] | 39 | |
---|
[2f63032] | 40 | R V Sharma, K C Sharma, *Physica*, 89A (1977) 213. |
---|
[a84a0ca] | 41 | |
---|
| 42 | """ |
---|
| 43 | from numpy import inf |
---|
| 44 | |
---|
| 45 | name = "squarewell" |
---|
| 46 | title = "Square well structure factor, with MSA closure" |
---|
| 47 | description = """\ |
---|
| 48 | [Square well structure factor, with MSA closure] |
---|
| 49 | Interparticle structure factor S(Q)for a hard sphere fluid with |
---|
| 50 | a narrow attractive well. Fits are prone to deliver non-physical |
---|
| 51 | parameters, use with care and read the references in the full manual. |
---|
| 52 | In sasview the effective radius will be calculated from the |
---|
| 53 | parameters used in P(Q). |
---|
| 54 | """ |
---|
| 55 | category = "structure-factor" |
---|
| 56 | structure_factor = True |
---|
[b812972] | 57 | single = False |
---|
[a84a0ca] | 58 | |
---|
| 59 | #single = False |
---|
| 60 | # ["name", "units", default, [lower, upper], "type","description"], |
---|
| 61 | parameters = [ |
---|
| 62 | # [ "name", "units", default, [lower, upper], "type", |
---|
| 63 | # "description" ], |
---|
| 64 | ["radius_effective", "Ang", 50.0, [0, inf], "volume", |
---|
| 65 | "effective radius of hard sphere"], |
---|
| 66 | ["volfraction", "", 0.04, [0, 0.08], "", |
---|
| 67 | "volume fraction of spheres"], |
---|
| 68 | ["welldepth", "kT", 1.5, [0.0, 1.5], "", |
---|
| 69 | "depth of well, epsilon"], |
---|
| 70 | ["wellwidth", "diameters", 1.2, [1.0, inf], "", |
---|
| 71 | "width of well in diameters (=2R) units, must be > 1"], |
---|
| 72 | ] |
---|
| 73 | |
---|
| 74 | # No volume normalization despite having a volume parameter |
---|
| 75 | # This should perhaps be volume normalized? |
---|
| 76 | form_volume = """ |
---|
| 77 | return 1.0; |
---|
| 78 | """ |
---|
| 79 | |
---|
| 80 | Iq = """ |
---|
| 81 | // single precision is very poor at extreme small Q, would need a Taylor series |
---|
| 82 | double req,phis,edibkb,lambda,struc; |
---|
| 83 | double sigma,eta,eta2,eta3,eta4,etam1,etam14,alpha,beta,gamm; |
---|
| 84 | double x,sk,sk2,sk3,sk4,t1,t2,t3,t4,ck; |
---|
| 85 | double S,C,SL,CL; |
---|
| 86 | x= q; |
---|
| 87 | |
---|
| 88 | req = radius_effective; |
---|
| 89 | phis = volfraction; |
---|
| 90 | edibkb = welldepth; |
---|
| 91 | lambda = wellwidth; |
---|
| 92 | |
---|
| 93 | sigma = req*2.; |
---|
| 94 | eta = phis; |
---|
| 95 | eta2 = eta*eta; |
---|
| 96 | eta3 = eta*eta2; |
---|
| 97 | eta4 = eta*eta3; |
---|
| 98 | etam1 = 1. - eta; |
---|
| 99 | etam14 = etam1*etam1*etam1*etam1; |
---|
| 100 | // temp borrow sk for an intermediate calc |
---|
| 101 | sk = 1.0 +2.0*eta; |
---|
| 102 | sk *= sk; |
---|
| 103 | alpha = ( sk + eta3*( eta-4.0 ) )/etam14; |
---|
| 104 | beta = -(eta/3.0) * ( 18. + 20.*eta - 12.*eta2 + eta4 )/etam14; |
---|
| 105 | gamm = 0.5*eta*( sk + eta3*(eta-4.) )/etam14; |
---|
| 106 | |
---|
| 107 | // calculate the structure factor |
---|
| 108 | |
---|
| 109 | sk = x*sigma; |
---|
| 110 | sk2 = sk*sk; |
---|
| 111 | sk3 = sk*sk2; |
---|
| 112 | sk4 = sk3*sk; |
---|
| 113 | SINCOS(sk,S,C); |
---|
| 114 | SINCOS(lambda*sk,SL,CL); |
---|
| 115 | t1 = alpha * sk3 * ( S - sk * C ); |
---|
| 116 | t2 = beta * sk2 * 2.0*( sk*S - (0.5*sk2 - 1.)*C - 1.0 ); |
---|
| 117 | t3 = gamm*( ( 4.0*sk3 - 24.*sk ) * S - ( sk4 - 12.0*sk2 + 24.0 )*C + 24.0 ); |
---|
| 118 | t4 = -edibkb*sk3*(SL +sk*(C - lambda*CL) - S ); |
---|
| 119 | ck = -24.0*eta*( t1 + t2 + t3 + t4 )/sk3/sk3; |
---|
| 120 | struc = 1./(1.-ck); |
---|
| 121 | |
---|
| 122 | return(struc); |
---|
| 123 | """ |
---|
| 124 | |
---|
| 125 | # ER defaults to 0.0 |
---|
| 126 | # VR defaults to 1.0 |
---|
| 127 | |
---|
| 128 | demo = dict(radius_effective=50, volfraction=0.04, welldepth=1.5, |
---|
| 129 | wellwidth=1.2, radius_effective_pd=0, radius_effective_pd_n=0) |
---|
| 130 | # |
---|
| 131 | tests = [ |
---|
| 132 | [ {'scale': 1.0, 'background' : 0.0, 'radius_effective' : 50.0, 'volfraction' : 0.04,'welldepth' : 1.5, 'wellwidth' : 1.2, |
---|
| 133 | 'radius_effective_pd' : 0}, [0.001], [0.97665742]] |
---|
| 134 | ] |
---|
| 135 | # ADDED by: converting from sasview RKH ON: 16Mar2016 |
---|
| 136 | |
---|