source: sasview/sansmodels/src/sans/models/c_models/rpa.cpp @ 8f20419d

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 8f20419d was 35aface, checked in by Jae Cho <jhjcho@…>, 14 years ago

addede new models and attr. non_fittable

  • Property mode set to 100644
File size: 3.2 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, University of Tennessee
13 */
14
15/**
16 * Scattering model classes
17 * The classes use the IGOR library found in
18 *   sansmodels/src/libigor
19 *
20 */
21
22#include <math.h>
23#include "models.hh"
24#include "parameters.hh"
25#include <stdio.h>
26using namespace std;
27
28extern "C" {
29        #include "rpa.h"
30}
31
32RPAModel :: RPAModel() {
33        lcase_n = Parameter(0.0);
34        ba = Parameter(5.0);
35        bb = Parameter(5.0);
36        bc = Parameter(5.0);
37        bd = Parameter(5.0);
38
39    Kab = Parameter(-0.0004);
40    Kac = Parameter(-0.0004);
41    Kad = Parameter(-0.0004);
42    Kbc = Parameter(-0.0004);
43    Kbd = Parameter(-0.0004);
44    Kcd = Parameter(-0.0004);
45
46    scale = Parameter(1.0);
47    background = Parameter(0.0);
48
49    Na = Parameter(1000.0);
50    Phia = Parameter(0.25);
51    va = Parameter(100.0);
52    La = Parameter(1.0e-012);
53
54    Nb = Parameter(1000.0);
55    Phib = Parameter(0.25);
56    vb = Parameter(100.0);
57    Lb = Parameter(1.0e-012);
58
59    Nc = Parameter(1000.0);
60    Phic = Parameter(0.25);
61    vc = Parameter(100.0);
62    Lc = Parameter(1.0e-012);
63
64    Nd = Parameter(1000.0);
65    Phid = Parameter(0.25);
66    vd = Parameter(100.0);
67    Ld = Parameter(0.0e-012);
68
69}
70
71/**
72 * Function to evaluate 1D scattering function
73 * The NIST IGOR library is used for the actual calculation.
74 * @param q: q-value
75 * @return: function value
76 */
77double RPAModel :: operator()(double q) {
78        double dp[29];
79        // Fill parameter array for IGOR library
80        // Add the background after averaging
81        //Fittable parameters
82        dp[0] = lcase_n();
83
84        dp[1] = ba();
85        dp[2] = bb();
86        dp[3] = bc();
87        dp[4] = bd();
88
89        dp[5] = Kab();
90        dp[6] = Kac();
91        dp[7] = Kad();
92        dp[8] = Kbc();
93        dp[9] = Kbd();
94        dp[10] = Kcd();
95
96        dp[11] = scale();
97        dp[12] = background();
98
99        //Fixed parameters
100        dp[13] = Na();
101        dp[14] = Phia();
102        dp[15] = va();
103        dp[16] = La();
104
105        dp[17] = Nb();
106        dp[18] = Phib();
107        dp[19] = vb();
108        dp[20] = Lb();
109
110        dp[21] = Nc();
111        dp[22] = Phic();
112        dp[23] = vc();
113        dp[24] = Lc();
114
115        dp[25] = Nd();
116        dp[26] = Phid();
117        dp[27] = vd();
118        dp[28] = Ld();
119
120        return rpa_kernel(dp,q);
121}
122
123/**
124 * Function to evaluate 2D scattering function
125 * @param q_x: value of Q along x
126 * @param q_y: value of Q along y
127 * @return: function value
128 */
129double RPAModel :: operator()(double qx, double qy) {
130        double q = sqrt(qx*qx + qy*qy);
131        return (*this).operator()(q);
132}
133
134/**
135 * Function to evaluate 2D scattering function
136 * @param pars: parameters of the sphere
137 * @param q: q-value
138 * @param phi: angle phi
139 * @return: function value
140 */
141double RPAModel :: evaluate_rphi(double q, double phi) {
142        return (*this).operator()(q);
143}
144
145/**
146 * Function to calculate effective radius
147 * @return: effective radius value
148 */
149double RPAModel :: calculate_ER() {
150//NOT implemented!!!
151}
Note: See TracBrowser for help on using the repository browser.