1 | #!/usr/bin/env python |
---|
2 | |
---|
3 | ############################################################################## |
---|
4 | # This software was developed by the University of Tennessee as part of the |
---|
5 | # Distributed Data Analysis of Neutron Scattering Experiments (DANSE) |
---|
6 | # project funded by the US National Science Foundation. |
---|
7 | # |
---|
8 | # If you use DANSE applications to do scientific research that leads to |
---|
9 | # publication, we ask that you acknowledge the use of the software with the |
---|
10 | # following sentence: |
---|
11 | # |
---|
12 | # "This work benefited from DANSE software developed under NSF award DMR-0520547." |
---|
13 | # |
---|
14 | # copyright 2008, University of Tennessee |
---|
15 | ############################################################################## |
---|
16 | |
---|
17 | |
---|
18 | """ |
---|
19 | Provide functionality for a C extension model |
---|
20 | |
---|
21 | :WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY |
---|
22 | DO NOT MODIFY THIS FILE, MODIFY ..\c_extensions\rpa.h |
---|
23 | AND RE-RUN THE GENERATOR SCRIPT |
---|
24 | |
---|
25 | """ |
---|
26 | |
---|
27 | from sans.models.BaseComponent import BaseComponent |
---|
28 | from sans_extension.c_models import CRPAModel |
---|
29 | import copy |
---|
30 | |
---|
31 | def create_RPAModel(): |
---|
32 | obj = RPAModel() |
---|
33 | #CRPAModel.__init__(obj) is called by RPAModel constructor |
---|
34 | return obj |
---|
35 | |
---|
36 | class RPAModel(CRPAModel, BaseComponent): |
---|
37 | """ |
---|
38 | Class that evaluates a RPAModel model. |
---|
39 | This file was auto-generated from ..\c_extensions\rpa.h. |
---|
40 | Refer to that file and the structure it contains |
---|
41 | for details of the model. |
---|
42 | List of default parameters: |
---|
43 | lcase_n = 0.0 |
---|
44 | ba = 5.0 |
---|
45 | bb = 5.0 |
---|
46 | bc = 5.0 |
---|
47 | bd = 5.0 |
---|
48 | Kab = -0.0004 |
---|
49 | Kac = -0.0004 |
---|
50 | Kad = -0.0004 |
---|
51 | Kbc = -0.0004 |
---|
52 | Kbd = -0.0004 |
---|
53 | Kcd = -0.0004 |
---|
54 | scale = 1.0 |
---|
55 | background = 0.0 [1/cm] |
---|
56 | Na = 1000.0 |
---|
57 | Phia = 0.25 |
---|
58 | va = 100.0 |
---|
59 | La = 1e-012 |
---|
60 | Nb = 1000.0 |
---|
61 | Phib = 0.25 |
---|
62 | vb = 100.0 |
---|
63 | Lb = 1e-012 |
---|
64 | Nc = 1000.0 |
---|
65 | Phic = 0.25 |
---|
66 | vc = 100.0 |
---|
67 | Lc = 1e-012 |
---|
68 | Nd = 1000.0 |
---|
69 | Phid = 0.25 |
---|
70 | vd = 100.0 |
---|
71 | Ld = 0.0 |
---|
72 | |
---|
73 | """ |
---|
74 | |
---|
75 | def __init__(self): |
---|
76 | """ Initialization """ |
---|
77 | |
---|
78 | # Initialize BaseComponent first, then sphere |
---|
79 | BaseComponent.__init__(self) |
---|
80 | #apply(CRPAModel.__init__, (self,)) |
---|
81 | CRPAModel.__init__(self) |
---|
82 | |
---|
83 | ## Name of the model |
---|
84 | self.name = "RPAModel" |
---|
85 | ## Model description |
---|
86 | self.description =""" THIS FORMALISM APPLIES TO MULTICOMPONENT POLYMER MIXTURES IN THE |
---|
87 | HOMOGENEOUS (MIXED) PHASE REGION ONLY.; |
---|
88 | CASE 0: C/D BINARY MIXTURE OF HOMOPOLYMERS |
---|
89 | CASE 1: C-D DIBLOCK COPOLYMER |
---|
90 | CASE 2: B/C/D TERNARY MIXTURE OF HOMOPOLYMERS |
---|
91 | CASE 3: B/C-D MIXTURE OF HOMOPOLYMER B AND |
---|
92 | DIBLOCK COPOLYMER C-D |
---|
93 | CASE 4: B-C-D TRIBLOCK COPOLYMER |
---|
94 | CASE 5: A/B/C/D QUATERNARY MIXTURE OF HOMOPOLYMERS |
---|
95 | CASE 6: A/B/C-D MIXTURE OF TWO HOMOPOLYMERS A/B |
---|
96 | AND A DIBLOCK C-D |
---|
97 | CASE 7: A/B-C-D MIXTURE OF A HOMOPOLYMER A AND A |
---|
98 | TRIBLOCK B-C-D |
---|
99 | CASE 8: A-B/C-D MIXTURE OF TWO DIBLOCK COPOLYMERS |
---|
100 | A-B AND C-D |
---|
101 | CASE 9: A-B-C-D FOUR-BLOCK COPOLYMER |
---|
102 | See details in the model function help""" |
---|
103 | |
---|
104 | ## Parameter details [units, min, max] |
---|
105 | self.details = {} |
---|
106 | self.details['lcase_n'] = ['', None, None] |
---|
107 | self.details['ba'] = ['', None, None] |
---|
108 | self.details['bb'] = ['', None, None] |
---|
109 | self.details['bc'] = ['', None, None] |
---|
110 | self.details['bd'] = ['', None, None] |
---|
111 | self.details['Kab'] = ['', None, None] |
---|
112 | self.details['Kac'] = ['', None, None] |
---|
113 | self.details['Kad'] = ['', None, None] |
---|
114 | self.details['Kbc'] = ['', None, None] |
---|
115 | self.details['Kbd'] = ['', None, None] |
---|
116 | self.details['Kcd'] = ['', None, None] |
---|
117 | self.details['scale'] = ['', None, None] |
---|
118 | self.details['background'] = ['[1/cm]', None, None] |
---|
119 | self.details['Na'] = ['', None, None] |
---|
120 | self.details['Phia'] = ['', None, None] |
---|
121 | self.details['va'] = ['', None, None] |
---|
122 | self.details['La'] = ['', None, None] |
---|
123 | self.details['Nb'] = ['', None, None] |
---|
124 | self.details['Phib'] = ['', None, None] |
---|
125 | self.details['vb'] = ['', None, None] |
---|
126 | self.details['Lb'] = ['', None, None] |
---|
127 | self.details['Nc'] = ['', None, None] |
---|
128 | self.details['Phic'] = ['', None, None] |
---|
129 | self.details['vc'] = ['', None, None] |
---|
130 | self.details['Lc'] = ['', None, None] |
---|
131 | self.details['Nd'] = ['', None, None] |
---|
132 | self.details['Phid'] = ['', None, None] |
---|
133 | self.details['vd'] = ['', None, None] |
---|
134 | self.details['Ld'] = ['', None, None] |
---|
135 | |
---|
136 | ## fittable parameters |
---|
137 | self.fixed=[] |
---|
138 | |
---|
139 | ## non-fittable parameters |
---|
140 | self.non_fittable = ['lcase_n', 'Na', 'Phia', 'va', 'La', 'Nb', 'Phib', 'vb', 'Lb', 'Nc', 'Phic', 'vc', 'Lc', 'Nd', 'Phid', 'vd', 'Ld'] |
---|
141 | |
---|
142 | ## parameters with orientation |
---|
143 | self.orientation_params = [] |
---|
144 | |
---|
145 | def __reduce_ex__(self, proto): |
---|
146 | """ |
---|
147 | Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of |
---|
148 | c model. |
---|
149 | """ |
---|
150 | return (create_RPAModel,tuple()) |
---|
151 | |
---|
152 | def clone(self): |
---|
153 | """ Return a identical copy of self """ |
---|
154 | return self._clone(RPAModel()) |
---|
155 | |
---|
156 | |
---|
157 | def run(self, x=0.0): |
---|
158 | """ |
---|
159 | Evaluate the model |
---|
160 | |
---|
161 | :param x: input q, or [q,phi] |
---|
162 | |
---|
163 | :return: scattering function P(q) |
---|
164 | |
---|
165 | """ |
---|
166 | |
---|
167 | return CRPAModel.run(self, x) |
---|
168 | |
---|
169 | def runXY(self, x=0.0): |
---|
170 | """ |
---|
171 | Evaluate the model in cartesian coordinates |
---|
172 | |
---|
173 | :param x: input q, or [qx, qy] |
---|
174 | |
---|
175 | :return: scattering function P(q) |
---|
176 | |
---|
177 | """ |
---|
178 | |
---|
179 | return CRPAModel.runXY(self, x) |
---|
180 | |
---|
181 | def evalDistribution(self, x=[]): |
---|
182 | """ |
---|
183 | Evaluate the model in cartesian coordinates |
---|
184 | |
---|
185 | :param x: input q[], or [qx[], qy[]] |
---|
186 | |
---|
187 | :return: scattering function P(q[]) |
---|
188 | |
---|
189 | """ |
---|
190 | return CRPAModel.evalDistribution(self, x) |
---|
191 | |
---|
192 | def calculate_ER(self): |
---|
193 | """ |
---|
194 | Calculate the effective radius for P(q)*S(q) |
---|
195 | |
---|
196 | :return: the value of the effective radius |
---|
197 | |
---|
198 | """ |
---|
199 | return CRPAModel.calculate_ER(self) |
---|
200 | |
---|
201 | def set_dispersion(self, parameter, dispersion): |
---|
202 | """ |
---|
203 | Set the dispersion object for a model parameter |
---|
204 | |
---|
205 | :param parameter: name of the parameter [string] |
---|
206 | :param dispersion: dispersion object of type DispersionModel |
---|
207 | |
---|
208 | """ |
---|
209 | return CRPAModel.set_dispersion(self, parameter, dispersion.cdisp) |
---|
210 | |
---|
211 | |
---|
212 | # End of file |
---|