/** This software was developed by the University of Tennessee as part of the Distributed Data Analysis of Neutron Scattering Experiments (DANSE) project funded by the US National Science Foundation. If you use DANSE applications to do scientific research that leads to publication, we ask that you acknowledge the use of the software with the following sentence: "This work benefited from DANSE software developed under NSF award DMR-0520547." copyright 2008, University of Tennessee */ /** * Scattering model classes * The classes use the IGOR library found in * sansmodels/src/libigor * */ #include #include "parameters.hh" #include using namespace std; #include "DiamEllip.h" extern "C" { #include "libStructureFactor.h" } DiamEllipFunc :: DiamEllipFunc() { radius_a = Parameter(20.0, true); radius_a.set_min(0.0); radius_b = Parameter(400, true); radius_b.set_min(0.0); } /** * Function to evaluate 1D scattering function * The NIST IGOR library is used for the actual calculation. * @param q: q-value * @return: function value */ double DiamEllipFunc :: operator()(double q) { double dp[2]; // Fill parameter array for IGOR library // Add the background after averaging dp[0] = radius_a(); dp[1] = radius_b(); // Get the dispersion points for the radius a vector weights_rad_a; radius_a.get_weights(weights_rad_a); // Get the dispersion points for the radius b vector weights_rad_b; radius_b.get_weights(weights_rad_b); // Perform the computation, with all weight points double sum = 0.0; double norm = 0.0; // Loop over radius weight points for(size_t i=0; i