source:sasmodels/sasmodels/models/rpa.py@055ec4f

core_shell_microgelsmagnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 055ec4f was 055ec4f, checked in by smk78, 14 months ago

Tweaks to docs

• Property mode set to 100644
File size: 5.6 KB
Line
1r"""
2Definition
3----------
4
5Calculates the macroscopic scattering intensity for a multi-component
6homogeneous mixture of polymers using the Random Phase Approximation.
7This general formalism contains 10 specific cases
8
9Case 0: C/D binary mixture of homopolymers
10
11Case 1: C-D diblock copolymer
12
13Case 2: B/C/D ternary mixture of homopolymers
14
15Case 3: C/C-D mixture of a homopolymer B and a diblock copolymer C-D
16
17Case 4: B-C-D triblock copolymer
18
19Case 5: A/B/C/D quaternary mixture of homopolymers
20
21Case 6: A/B/C-D mixture of two homopolymers A/B and a diblock C-D
22
23Case 7: A/B-C-D mixture of a homopolymer A and a triblock B-C-D
24
25Case 8: A-B/C-D mixture of two diblock copolymers A-B and C-D
26
27Case 9: A-B-C-D tetra-block copolymer
28
29.. note::
30    These case numbers are different from those in the NIST SANS package!
31
32The models are based on the papers by Akcasu *et al.* [1] and by
33Hammouda [2] assuming the polymer follows Gaussian statistics such
34that $R_g^2 = n b^2/6$ where $b$ is the statistical segment length and $n$ is
35the number of statistical segment lengths. A nice tutorial on how these are
36constructed and implemented can be found in chapters 28, 31 and 34, and Part H,
37of Hammouda's 'SANS Toolbox' [3].
38
39In brief, the macroscopic cross sections are derived from the general forms
40for homopolymer scattering and the multiblock cross-terms while the inter,
41polymer cross terms are described in the usual way by the $\chi$ parameter.
42
43USAGE NOTES:
44
45* Only one case can be used at any one time.
46* The RPA (mean field) formalism only applies only when the multicomponent
47  polymer mixture is in the homogeneous mixed-phase region.
48* **Component D is assumed to be the "background" component (ie, all contrasts
49  are calculated with respect to component D).** So the scattering contrast
50  for a C/D blend $\rho_{C/D} = [\rho_C - \rho_D]$\ :sup:2.
51* Depending on which case is being used, the number of fitting parameters can
52  vary.
53
54  .. Note::
55    * In general the degrees of polymerization, the volume
56      fractions, the molar volumes, and the neutron scattering lengths for each
57      component are obtained from other methods and held fixed while The *scale*
58      parameter should be held equal to unity.
59    * The variables are normally the segment lengths ($b_a$, $b_b$,
60      etc.) and $\chi$ parameters ($K_{ab}$, $K_{ac}$, etc).
61
62References
63----------
64
65.. [#] A Z Akcasu, R Klein and B Hammouda, *Macromolecules*, 26 (1993) 4136
66.. [#] B. Hammouda, *Advances in Polymer Science* 106 (1993) 87
67.. [#] B. Hammouda, *SANS Toolbox* https://www.ncnr.nist.gov/staff/hammouda/the_sans_toolbox.pdf.
68
69Source
70------
71
72rpa.py <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/rpa.py>_
73
74rpa.c <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/rpa.c>_
75
76Authorship and Verification
77----------------------------
78
79* **Author:** Boualem Hammouda - NIST IGOR/DANSE **Date:** pre 2010
80* **Converted to sasmodels by:** Paul Kienzle **Date:** July 18, 2016
81* **Last Modified by:** Paul Butler **Date:** March 12, 2017
82* **Last Reviewed by:** Steve King **Date:** March 27, 2019
83* **Source added by :** Steve King **Date:** March 25, 2019
84"""
85
86from numpy import inf
87
88name = "rpa"
89title = "Random Phase Approximation"
90description = """
91This formalism applies to multicomponent polymer mixtures in the
92homogeneous (mixed) phase region only.
93Case 0: C/D binary mixture of homopolymers
94Case 1: C-D diblock copolymer
95Case 2: B/C/D ternary mixture of homopolymers
96Case 3: B/C-D mixture of homopolymer b and diblock copolymer C-D
97Case 4: B-C-D triblock copolymer
98Case 5: A/B/C/D quaternary mixture of homopolymers
99Case 6: A/B/C-D mixture of two homopolymers A/B and a diblock C-D
100Case 7: A/B-C-D mixture of a homopolymer A and a triblock B-C-D
101Case 8: A-B/C-D mixture of two diblock copolymers A-B and C-D
102Case 9: A-B-C-D four-block copolymer
103See details in the model function help
104"""
105category = "shape-independent"
106
107CASES = [
108    "C+D binary mixture",
109    "C:D diblock copolymer",
110    "B+C+D ternary mixture",
111    "B+C:D binary mixture",
112    "B:C:D triblock copolymer",
113    "A+B+C+D quaternary mixture",
114    "A+B+C:D ternary mixture",
115    "A+B:C:D binary mixture",
116    "A:B+C:D binary mixture",
117    "A:B:C:D quadblock copolymer",
118]
119
120#   ["name", "units", default, [lower, upper], "type","description"],
121parameters = [
122    ["case_num", "", 1, [CASES], "", "Component organization"],
123
124    ["N[4]", "", 1000.0, [1, inf], "", "Degree of polymerization"],
125    ["Phi[4]", "", 0.25, [0, 1], "", "volume fraction"],
126    ["v[4]", "mL/mol", 100.0, [0, inf], "", "molar volume"],
127    ["L[4]", "fm", 10.0, [-inf, inf], "", "scattering length"],
128    ["b[4]", "Ang", 5.0, [0, inf], "", "segment length"],
129
130    ["K12", "", -0.0004, [-inf, inf], "", "A:B interaction parameter"],
131    ["K13", "", -0.0004, [-inf, inf], "", "A:C interaction parameter"],
132    ["K14", "", -0.0004, [-inf, inf], "", "A:D interaction parameter"],
133    ["K23", "", -0.0004, [-inf, inf], "", "B:C interaction parameter"],
134    ["K24", "", -0.0004, [-inf, inf], "", "B:D interaction parameter"],
135    ["K34", "", -0.0004, [-inf, inf], "", "C:D interaction parameter"],
136]
137
138
139source = ["rpa.c"]
140single = False
141
142control = "case_num"
143HIDE_ALL = set("Phi4".split())
144HIDE_A = set("N1 Phi1 v1 L1 b1 K12 K13 K14".split()).union(HIDE_ALL)
145HIDE_AB = set("N2 Phi2 v2 L2 b2 K23 K24".split()).union(HIDE_A)
146def hidden(case_num):
147    """
148    Return a list of parameters to hide depending on the multiplicity parameter.
149    """
150    case_num = int(case_num+0.5)
151    if case_num < 2:
152        return HIDE_AB
153    elif case_num < 5:
154        return HIDE_A
155    else:
156        return HIDE_ALL
157
158# TODO: no random parameters generated for RPA
Note: See TracBrowser for help on using the repository browser.