source: sasview/src/sans/models/HayterMSAStructure.py @ 81b524f

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 81b524f was 81b524f, checked in by Jeff Krzywon <jeffery.krzywon@…>, 11 years ago

This branch is now merged with the latest trunk release. I will merge them next.

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