source: sasview/sansmodels/src/sans/models/c_models/lamellarPS.cpp @ 484faf7

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

updated documents

  • Property mode set to 100644
File size: 3.1 KB
RevLine 
[27a0771]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 *      TODO: add 2D function
22 */
23
24#include <math.h>
25#include "models.hh"
26#include "parameters.hh"
27#include <stdio.h>
28using namespace std;
29
30extern "C" {
31        #include "libCylinder.h"
32        #include "lamellarPS.h"
33}
34
35LamellarPSModel :: LamellarPSModel() {
36        scale      = Parameter(1.0);
[b4679de]37        spacing    = Parameter(400.0, true);
38        spacing.set_min(0.0);
39        delta     = Parameter(30.0);
[27a0771]40        delta.set_min(0.0);
41        contrast   = Parameter(5.3e-6);
42        n_plates     = Parameter(20.0);
43        caille = Parameter(0.1);
44        background = Parameter(0.0);
45
46}
47
48/**
49 * Function to evaluate 1D scattering function
50 * The NIST IGOR library is used for the actual calculation.
51 * @param q: q-value
52 * @return: function value
53 */
54double LamellarPSModel :: operator()(double q) {
[c1c29b6]55        double dp[7];
[27a0771]56
57        // Fill parameter array for IGOR library
58        // Add the background after averaging
59        dp[0] = scale();
60        dp[1] = spacing();
61        dp[2] = delta();
[c1c29b6]62        dp[3] = contrast();
63        dp[4] = n_plates();
64        dp[5] = caille();
65        dp[6] = 0.0;
[b4679de]66
[27a0771]67
[c1c29b6]68        // Get the dispersion points for spacing and delta (thickness)
[b4679de]69        vector<WeightPoint> weights_spacing;
70        spacing.get_weights(weights_spacing);
[c1c29b6]71        vector<WeightPoint> weights_delta;
72        delta.get_weights(weights_delta);
[b4679de]73
[27a0771]74        // Perform the computation, with all weight points
75        double sum = 0.0;
76        double norm = 0.0;
[b4679de]77
[27a0771]78        // Loop over short_edgeA weight points
[b4679de]79        for(int i=0; i< (int)weights_spacing.size(); i++) {
80                dp[1] = weights_spacing[i].value;
[c1c29b6]81                for(int j=0; j< (int)weights_spacing.size(); j++) {
82                        dp[2] = weights_delta[i].value;
[b4679de]83
[c1c29b6]84                        sum += weights_spacing[i].weight * weights_delta[j].weight * LamellarPS_kernel(dp, q);
85                        norm += weights_spacing[i].weight * weights_delta[j].weight;
86                }
[27a0771]87        }
88        return sum/norm + background();
89}
90/**
91 * Function to evaluate 2D scattering function
92 * @param q_x: value of Q along x
93 * @param q_y: value of Q along y
94 * @return: function value
95 */
96double LamellarPSModel :: operator()(double qx, double qy) {
[b4679de]97        double q = sqrt(qx*qx + qy*qy);
98        return (*this).operator()(q);
[27a0771]99}
100
101/**
102 * Function to evaluate 2D scattering function
103 * @param pars: parameters of the cylinder
104 * @param q: q-value
105 * @param phi: angle phi
106 * @return: function value
107 */
108double LamellarPSModel :: evaluate_rphi(double q, double phi) {
[b4679de]109        return (*this).operator()(q);
[27a0771]110}
[5eb9154]111/**
112 * Function to calculate effective radius
113 * @return: effective radius value
114 */
115double LamellarPSModel :: calculate_ER() {
116//NOT implemented yet!!!
117}
[c1c29b6]118
Note: See TracBrowser for help on using the repository browser.