source: sasmodels/sasmodels/models/hardsphere.py @ eb69cce

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since eb69cce was eb69cce, checked in by Paul Kienzle <pkienzle@…>, 8 years ago

make model docs more consistent; build pdf docs

  • Property mode set to 100644
File size: 3.0 KB
RevLine 
[301e096]1# Note: model title and parameter table are inserted automatically
[529b8b4]2r"""Calculate the interparticle structure factor for monodisperse
3spherical particles interacting through hard sphere (excluded volume)
4interactions.
[301e096]5
[529b8b4]6The calculation uses the Percus-Yevick closure where the interparticle
7potential is
[301e096]8
[eb69cce]9.. math::
[529b8b4]10
11    U(r) = \begin{cases}
12    \infty & r < 2R \\
13    0 & r \geq 2R
14    \end{cases}
[301e096]15
[eb69cce]16where $r$ is the distance from the center of the sphere of a radius $R$.
[301e096]17
18For a 2D plot, the wave transfer is defined as
19
20.. math::
21
[529b8b4]22    q = \sqrt{q_x^2 + q_y^2}
[301e096]23
24
[eb69cce]25.. figure:: img/HardSphere_1d.jpg
[301e096]26
[eb69cce]27    1D plot using the default values (in linear scale).
[301e096]28
[eb69cce]29References
30----------
[301e096]31
32J K Percus, J Yevick, *J. Phys. Rev.*, 110, (1958) 1
33"""
34
[3c56da87]35from numpy import inf
[301e096]36
37name = "hardsphere"
38title = "Hard sphere structure factor, with Percus-Yevick closure"
39description = """\
[3e428ec]40    [Hard sphere structure factor, with Percus-Yevick closure]
[301e096]41        Interparticle S(Q) for random, non-interacting spheres.
[3e428ec]42    May be a reasonable approximation for other shapes of
43    particles that freely rotate, and for moderately polydisperse
44        systems. Though strictly the maths needs to be modified -
45    which sasview does not do yet.
46    effect_radius is the hard sphere radius
47    volfraction is the volume fraction occupied by the spheres.
[301e096]48"""
[a5d0d00]49category = "structure-factor"
[301e096]50
[3e428ec]51#             ["name", "units", default, [lower, upper], "type","description"],
52parameters = [["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             ]
[301e096]57
58# No volume normalization despite having a volume parameter
59# This should perhaps be volume normalized?
60form_volume = """
61    return 1.0;
62    """
63
64Iq = """
[3e428ec]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);
[301e096]94   """
95
96Iqxy = """
97    // never called since no orientation or magnetic parameters.
[529b8b4]98    return Iq(sqrt(qx*qx+qy*qy), IQ_PARAMETERS);
[301e096]99    """
100
101# ER defaults to 0.0
102# VR defaults to 1.0
103
[3e428ec]104demo = dict(effect_radius=200, volfraction=0.2, effect_radius_pd=0.1, effect_radius_pd_n=40)
[301e096]105oldname = 'HardsphereStructure'
106oldpars = dict()
107
Note: See TracBrowser for help on using the repository browser.