source: sasmodels/sasmodels/models/rpa.py @ eb63414

core_shell_microgelscostrafo411magnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since eb63414 was eb63414, checked in by Paul Kienzle <pkienzle@…>, 3 years ago

Merge branch 'master' into ticket-815

  • Property mode set to 100644
File size: 4.2 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
32USAGE NOTES:
33
34* Only one case can be used at any one time.
35* The RPA (mean field) formalism only applies only when the multicomponent
36  polymer mixture is in the homogeneous mixed-phase region.
37* **Component D is assumed to be the "background" component (ie, all contrasts
38  are calculated with respect to component D).** So the scattering contrast
39  for a C/D blend = [SLD(component C) - SLD(component D)]\ :sup:`2`.
40* Depending on which case is being used, the number of fitting parameters can
41  vary.  Note that in general the degrees of polymerization, the volume
42  fractions, the molar volumes, and the neutron scattering lengths for each
43  component are obtained from other methods and held fixed while the segment
44  lengths (b\ :sub:`a`, b\ :sub:`b`, etc) and $\chi$ parameters (K\ :sub:`ab`,
45  K\ :sub:`ac`, etc). The *scale* parameter should be held equal to unity.
46
47
48References
49----------
50
51.. [#] A Z Akcasu, R Klein and B Hammouda, *Macromolecules*, 26 (1993) 4136
52"""
53
54from numpy import inf
55
56name = "rpa"
57title = "Random Phase Approximation"
58description = """
59This formalism applies to multicomponent polymer mixtures in the
60homogeneous (mixed) phase region only.
61Case 0: C/D binary mixture of homopolymers
62Case 1: C-D diblock copolymer
63Case 2: B/C/D ternary mixture of homopolymers
64Case 3: B/C-D mixture of homopolymer b and diblock copolymer C-D
65Case 4: B-C-D triblock copolymer
66Case 5: A/B/C/D quaternary mixture of homopolymers
67Case 6: A/B/C-D mixture of two homopolymers A/B and a diblock C-D
68Case 7: A/B-C-D mixture of a homopolymer A and a triblock B-C-D
69Case 8: A-B/C-D mixture of two diblock copolymers A-B and C-D
70Case 9: A-B-C-D four-block copolymer
71See details in the model function help
72"""
73category = "shape-independent"
74
75CASES = [
76    "C+D binary mixture",
77    "C:D diblock copolymer",
78    "B+C+D ternary mixture",
79    "B+C:D binary mixture",
80    "B:C:D triblock copolymer",
81    "A+B+C+D quaternary mixture",
82    "A+B+C:D ternary mixture",
83    "A+B:C:D binary mixture",
84    "A:B+C:D binary mixture",
85    "A:B:C:D quadblock copolymer",
86]
87
88#   ["name", "units", default, [lower, upper], "type","description"],
89parameters = [
90    ["case_num", "", 1, [CASES], "", "Component organization"],
91
92    ["N[4]", "", 1000.0, [1, inf], "", "Degree of polymerization"],
93    ["Phi[4]", "", 0.25, [0, 1], "", "volume fraction"],
94    ["v[4]", "mL/mol", 100.0, [0, inf], "", "molar volume"],
95    ["L[4]", "fm", 10.0, [-inf, inf], "", "scattering length"],
96    ["b[4]", "Ang", 5.0, [0, inf], "", "segment length"],
97
98    ["K12", "", -0.0004, [-inf, inf], "", "A:B interaction parameter"],
99    ["K13", "", -0.0004, [-inf, inf], "", "A:C interaction parameter"],
100    ["K14", "", -0.0004, [-inf, inf], "", "A:D interaction parameter"],
101    ["K23", "", -0.0004, [-inf, inf], "", "B:C interaction parameter"],
102    ["K24", "", -0.0004, [-inf, inf], "", "B:D interaction parameter"],
103    ["K34", "", -0.0004, [-inf, inf], "", "C:D interaction parameter"],
104]
105
106
107source = ["rpa.c"]
108single = False
109
110control = "case_num"
111HIDE_ALL = set("Phi4".split())
112HIDE_A = set("N1 Phi1 v1 L1 b1 K12 K13 K14".split()).union(HIDE_ALL)
113HIDE_AB = set("N2 Phi2 v2 L2 b2 K23 K24".split()).union(HIDE_A)
114def hidden(case_num):
115    """
116    Return a list of parameters to hide depending on the multiplicity parameter.
117    """
118    case_num = int(case_num+0.5)
119    if case_num < 2:
120        return HIDE_AB
121    elif case_num < 5:
122        return HIDE_A
123    else:
124        return HIDE_ALL
125
Note: See TracBrowser for help on using the repository browser.