source: sasview/sansmodels/src/sans/models/c_models/lamellarFF_HG.cpp @ 97603c0

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 97603c0 was f9bf661, checked in by Jae Cho <jhjcho@…>, 15 years ago

updated documents

  • 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 *      TODO: refactor so that we pull in the old sansmodels.c_extensions
21 */
22
23#include <math.h>
24#include "models.hh"
25#include "parameters.hh"
26#include <stdio.h>
27using namespace std;
28
29extern "C" {
30        #include "libCylinder.h"
31        #include "lamellarFF_HG.h"
32}
33
34LamellarFFHGModel :: LamellarFFHGModel() {
35        scale      = Parameter(1.0);
36        t_length     = Parameter(15.0, true);
37        t_length.set_min(0.0);
38        h_thickness    = Parameter(10.0, true);
39        h_thickness.set_min(0.0);
40        sld_tail   = Parameter(4e-7);
41        sld_head  = Parameter(3e-6);
42        sld_solvent    = Parameter(6e-6);
43        background = Parameter(0.0);
44
45}
46
47/**
48 * Function to evaluate 1D scattering function
49 * The NIST IGOR library is used for the actual calculation.
50 * @param q: q-value
51 * @return: function value
52 */
53double LamellarFFHGModel :: operator()(double q) {
54        double dp[7];
55
56        // Fill parameter array for IGOR library
57        // Add the background after averaging
58        dp[0] = scale();
59        dp[1] = t_length();
60        dp[2] = h_thickness();
61        dp[3] = sld_tail();
62        dp[4] = sld_head();
63        dp[5] = sld_solvent();
64        dp[6] = 0.0;
65
66        // Get the dispersion points for the tail length
67        vector<WeightPoint> weights_t_length;
68        t_length.get_weights(weights_t_length);
69
70        // Get the dispersion points for the head thickness
71        vector<WeightPoint> weights_h_thickness;
72        h_thickness.get_weights(weights_h_thickness);
73
74        // Perform the computation, with all weight points
75        double sum = 0.0;
76        double norm = 0.0;
77
78        // Loop over semi axis A weight points
79        for(int i=0; i< (int)weights_t_length.size(); i++) {
80                dp[1] = weights_t_length[i].value;
81
82                for (int j=0; j< (int)weights_h_thickness.size(); j++){
83                        dp[2] = weights_h_thickness[j].value;
84
85                        sum += weights_t_length[i].weight* weights_h_thickness[j].weight*LamellarFF_HG(dp, q);
86                        norm += weights_t_length[i].weight* weights_h_thickness[j].weight;
87                }
88
89        }
90        return sum/norm + background();
91}
92
93/**
94 * Function to evaluate 2D scattering function
95 * @param q_x: value of Q along x
96 * @param q_y: value of Q along y
97 * @return: function value
98 */
99
100double LamellarFFHGModel :: operator()(double qx, double qy) {
101        double q = sqrt(qx*qx + qy*qy);
102        return (*this).operator()(q);
103}
104
105/**
106 * Function to evaluate 2D scattering function
107 * @param pars: parameters of the lamellar
108 * @param q: q-value
109 * @param phi: angle phi
110 * @return: function value
111 */
112double LamellarFFHGModel :: evaluate_rphi(double q, double phi) {
113        return (*this).operator()(q);
114}
115/**
116 * Function to calculate effective radius
117 * @return: effective radius value
118 */
119double LamellarFFHGModel :: calculate_ER() {
120//NOT implemented yet!!!
121}
Note: See TracBrowser for help on using the repository browser.