source: sasview/sansmodels/src/sans/models/c_models/lamellar.cpp @ 87615a48

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

updated documents

  • Property mode set to 100644
File size: 2.7 KB
RevLine 
[34c3020]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" {
[c1c29b6]30//      #include "libCylinder.h"
[34c3020]31        #include "lamellar.h"
32}
33
34LamellarModel :: LamellarModel() {
35        scale      = Parameter(1.0);
[975ec8e]36        bi_thick     = Parameter(50.0, true);
37        bi_thick.set_min(0.0);
38        sld_bi    = Parameter(1.0e-6);
39        sld_sol    = Parameter(6.3e-6);
[34c3020]40        background = Parameter(0.0);
41
42}
43
44/**
45 * Function to evaluate 1D scattering function
46 * The NIST IGOR library is used for the actual calculation.
47 * @param q: q-value
48 * @return: function value
49 */
50double LamellarModel :: operator()(double q) {
51        double dp[5];
52
53        // Fill parameter array for IGOR library
54        // Add the background after averaging
55        dp[0] = scale();
[975ec8e]56        dp[1] = bi_thick();
57        dp[2] = sld_bi();
58        dp[3] = sld_sol();
59        dp[4] = 0.0;
[34c3020]60
[975ec8e]61        // Get the dispersion points for the bi_thick
62        vector<WeightPoint> weights_bi_thick;
63        bi_thick.get_weights(weights_bi_thick);
64        // Perform the computation, with all weight points
65        double sum = 0.0;
66        double norm = 0.0;
67
68        // Loop over short_edgeA weight points
69        for(int i=0; i< (int)weights_bi_thick.size(); i++) {
70                dp[1] = weights_bi_thick[i].value;
71
72                sum += weights_bi_thick[i].weight * lamellar_kernel(dp, q);
73                norm += weights_bi_thick[i].weight;
74
75        }
76
77        return sum/norm + background();
[34c3020]78}
79
80/**
81 * Function to evaluate 2D scattering function
82 * @param q_x: value of Q along x
83 * @param q_y: value of Q along y
84 * @return: function value
85 */
86
87double LamellarModel :: operator()(double qx, double qy) {
[42f193a]88        double q = sqrt(qx*qx + qy*qy);
89        return (*this).operator()(q);
[34c3020]90}
91
92/**
93 * Function to evaluate 2D scattering function
94 * @param pars: parameters of the lamellar
95 * @param q: q-value
96 * @param phi: angle phi
97 * @return: function value
98 */
99double LamellarModel :: evaluate_rphi(double q, double phi) {
[42f193a]100        return (*this).operator()(q);
[34c3020]101}
[5eb9154]102/**
103 * Function to calculate effective radius
104 * @return: effective radius value
105 */
106double LamellarModel :: calculate_ER() {
107//NOT implemented yet!!!
108}
Note: See TracBrowser for help on using the repository browser.