1 | ############################################################################## |
---|
2 | # This software was developed by the University of Tennessee as part of the |
---|
3 | # Distributed Data Analysis of Neutron Scattering Experiments (DANSE) |
---|
4 | # project funded by the US National Science Foundation. |
---|
5 | # |
---|
6 | # If you use DANSE applications to do scientific research that leads to |
---|
7 | # publication, we ask that you acknowledge the use of the software with the |
---|
8 | # following sentence: |
---|
9 | # |
---|
10 | # This work benefited from DANSE software developed under NSF award DMR-0520547 |
---|
11 | # |
---|
12 | # Copyright 2008-2011, University of Tennessee |
---|
13 | ############################################################################## |
---|
14 | |
---|
15 | """ |
---|
16 | Provide functionality for a C extension model |
---|
17 | |
---|
18 | .. WARNING:: |
---|
19 | |
---|
20 | THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY |
---|
21 | DO NOT MODIFY THIS FILE, MODIFY |
---|
22 | src\sans\models\include\HayterMSA.h |
---|
23 | AND RE-RUN THE GENERATOR SCRIPT |
---|
24 | """ |
---|
25 | |
---|
26 | from sans.models.BaseComponent import BaseComponent |
---|
27 | from sans.models.sans_extension.c_models import CHayterMSAStructure |
---|
28 | |
---|
29 | def create_HayterMSAStructure(): |
---|
30 | """ |
---|
31 | Create a model instance |
---|
32 | """ |
---|
33 | obj = HayterMSAStructure() |
---|
34 | # CHayterMSAStructure.__init__(obj) is called by |
---|
35 | # the HayterMSAStructure constructor |
---|
36 | return obj |
---|
37 | |
---|
38 | class HayterMSAStructure(CHayterMSAStructure, BaseComponent): |
---|
39 | """ |
---|
40 | Class that evaluates a HayterMSAStructure model. |
---|
41 | This file was auto-generated from src\sans\models\include\HayterMSA.h. |
---|
42 | Refer to that file and the structure it contains |
---|
43 | for details of the model. |
---|
44 | |
---|
45 | List of default parameters: |
---|
46 | |
---|
47 | * effect_radius = 20.75 [A] |
---|
48 | * charge = 19.0 |
---|
49 | * volfraction = 0.0192 |
---|
50 | * temperature = 318.16 [K] |
---|
51 | * saltconc = 0.0 [M] |
---|
52 | * dielectconst = 71.08 |
---|
53 | |
---|
54 | """ |
---|
55 | |
---|
56 | def __init__(self, multfactor=1): |
---|
57 | """ Initialization """ |
---|
58 | self.__dict__ = {} |
---|
59 | |
---|
60 | # Initialize BaseComponent first, then sphere |
---|
61 | BaseComponent.__init__(self) |
---|
62 | #apply(CHayterMSAStructure.__init__, (self,)) |
---|
63 | |
---|
64 | CHayterMSAStructure.__init__(self) |
---|
65 | self.is_multifunc = False |
---|
66 | |
---|
67 | ## Name of the model |
---|
68 | self.name = "HayterMSAStructure" |
---|
69 | ## Model description |
---|
70 | self.description = """ |
---|
71 | To calculate the structure factor (the Fourier transform of the |
---|
72 | pair correlation function g(r)) for a system of |
---|
73 | charged, spheroidal objects in a dielectric |
---|
74 | medium. |
---|
75 | When combined with an appropriate form |
---|
76 | factor, this allows for inclusion of |
---|
77 | the interparticle interference effects |
---|
78 | due to screened coulomb repulsion between |
---|
79 | charged particles. |
---|
80 | (Note: charge > 0 required.) |
---|
81 | |
---|
82 | Ref: JP Hansen and JB Hayter, Molecular |
---|
83 | Physics 46, 651-656 (1982). |
---|
84 | |
---|
85 | """ |
---|
86 | |
---|
87 | ## Parameter details [units, min, max] |
---|
88 | self.details = {} |
---|
89 | self.details['effect_radius'] = ['[A]', None, None] |
---|
90 | self.details['charge'] = ['', None, None] |
---|
91 | self.details['volfraction'] = ['', None, None] |
---|
92 | self.details['temperature'] = ['[K]', None, None] |
---|
93 | self.details['saltconc'] = ['[M]', None, None] |
---|
94 | self.details['dielectconst'] = ['', None, None] |
---|
95 | |
---|
96 | ## fittable parameters |
---|
97 | self.fixed = ['effect_radius.width'] |
---|
98 | |
---|
99 | ## non-fittable parameters |
---|
100 | self.non_fittable = [] |
---|
101 | |
---|
102 | ## parameters with orientation |
---|
103 | self.orientation_params = [] |
---|
104 | |
---|
105 | ## parameters with magnetism |
---|
106 | self.magnetic_params = [] |
---|
107 | |
---|
108 | self.category = None |
---|
109 | self.multiplicity_info = None |
---|
110 | |
---|
111 | def __setstate__(self, state): |
---|
112 | """ |
---|
113 | restore the state of a model from pickle |
---|
114 | """ |
---|
115 | self.__dict__, self.params, self.dispersion = state |
---|
116 | |
---|
117 | def __reduce_ex__(self, proto): |
---|
118 | """ |
---|
119 | Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of |
---|
120 | c model. |
---|
121 | """ |
---|
122 | state = (self.__dict__, self.params, self.dispersion) |
---|
123 | return (create_HayterMSAStructure, tuple(), state, None, None) |
---|
124 | |
---|
125 | def clone(self): |
---|
126 | """ Return a identical copy of self """ |
---|
127 | return self._clone(HayterMSAStructure()) |
---|
128 | |
---|
129 | def run(self, x=0.0): |
---|
130 | """ |
---|
131 | Evaluate the model |
---|
132 | |
---|
133 | :param x: input q, or [q,phi] |
---|
134 | |
---|
135 | :return: scattering function P(q) |
---|
136 | |
---|
137 | """ |
---|
138 | return CHayterMSAStructure.run(self, x) |
---|
139 | |
---|
140 | def runXY(self, x=0.0): |
---|
141 | """ |
---|
142 | Evaluate the model in cartesian coordinates |
---|
143 | |
---|
144 | :param x: input q, or [qx, qy] |
---|
145 | |
---|
146 | :return: scattering function P(q) |
---|
147 | |
---|
148 | """ |
---|
149 | return CHayterMSAStructure.runXY(self, x) |
---|
150 | |
---|
151 | def evalDistribution(self, x): |
---|
152 | """ |
---|
153 | Evaluate the model in cartesian coordinates |
---|
154 | |
---|
155 | :param x: input q[], or [qx[], qy[]] |
---|
156 | |
---|
157 | :return: scattering function P(q[]) |
---|
158 | |
---|
159 | """ |
---|
160 | return CHayterMSAStructure.evalDistribution(self, x) |
---|
161 | |
---|
162 | def calculate_ER(self): |
---|
163 | """ |
---|
164 | Calculate the effective radius for P(q)*S(q) |
---|
165 | |
---|
166 | :return: the value of the effective radius |
---|
167 | |
---|
168 | """ |
---|
169 | return CHayterMSAStructure.calculate_ER(self) |
---|
170 | |
---|
171 | def calculate_VR(self): |
---|
172 | """ |
---|
173 | Calculate the volf ratio for P(q)*S(q) |
---|
174 | |
---|
175 | :return: the value of the volf ratio |
---|
176 | |
---|
177 | """ |
---|
178 | return CHayterMSAStructure.calculate_VR(self) |
---|
179 | |
---|
180 | def set_dispersion(self, parameter, dispersion): |
---|
181 | """ |
---|
182 | Set the dispersion object for a model parameter |
---|
183 | |
---|
184 | :param parameter: name of the parameter [string] |
---|
185 | :param dispersion: dispersion object of type DispersionModel |
---|
186 | |
---|
187 | """ |
---|
188 | return CHayterMSAStructure.set_dispersion(self, |
---|
189 | parameter, dispersion.cdisp) |
---|
190 | |
---|
191 | |
---|
192 | # End of file |
---|
193 | |
---|