/** 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 "models.hh" #include "parameters.hh" #include using namespace std; extern "C" { #include "libSphere.h" #include "corefourshell.h" } CoreFourShellModel :: CoreFourShellModel() { scale = Parameter(1.0); rad_core0 = Parameter(60.0, true); rad_core0.set_min(0.0); sld_core0 = Parameter(6.4e-6); thick_shell1 = Parameter(10.0, true); thick_shell1.set_min(0.0); sld_shell1 = Parameter(1.0e-6); thick_shell2 = Parameter(10.0, true); thick_shell2.set_min(0.0); sld_shell2 = Parameter(2.0e-6); thick_shell3 = Parameter(10.0, true); thick_shell3.set_min(0.0); sld_shell3 = Parameter(3.0e-6); thick_shell4 = Parameter(10.0, true); thick_shell4.set_min(0.0); sld_shell4 = Parameter(4.0e-6); sld_solv = Parameter(6.4e-6); background = Parameter(0.001); } /** * Function to evaluate 1D scattering function * The NIST IGOR library is used for the actual calculation. * @param q: q-value * @return: function value */ double CoreFourShellModel :: operator()(double q) { double dp[13]; // Fill parameter array for IGOR library // Add the background after averaging dp[0] = scale(); dp[1] = rad_core0(); dp[2] = sld_core0(); dp[3] = thick_shell1(); dp[4] = sld_shell1(); dp[5] = thick_shell2(); dp[6] = sld_shell2(); dp[7] = thick_shell3(); dp[8] = sld_shell3(); dp[9] = thick_shell4(); dp[10] = sld_shell4(); dp[11] = sld_solv(); dp[12] = 0.0; // Get the dispersion points for the radius vector weights_rad; rad_core0.get_weights(weights_rad); // Get the dispersion points for the thick 1 vector weights_s1; thick_shell1.get_weights(weights_s1); // Get the dispersion points for the thick 2 vector weights_s2; thick_shell2.get_weights(weights_s2); // Get the dispersion points for the thick 3 vector weights_s3; thick_shell3.get_weights(weights_s3); // Get the dispersion points for the thick 4 vector weights_s4; thick_shell4.get_weights(weights_s4); // Perform the computation, with all weight points double sum = 0.0; double norm = 0.0; double vol = 0.0; // Loop over radius weight points for(size_t i=0; i weights_rad; rad_core0.get_weights(weights_rad); // Get the dispersion points for the thick 1 vector weights_s1; thick_shell1.get_weights(weights_s1); // Get the dispersion points for the thick 2 vector weights_s2; thick_shell2.get_weights(weights_s2); // Get the dispersion points for the thick 3 vector weights_s3; thick_shell3.get_weights(weights_s3); // Get the dispersion points for the thick 4 vector weights_s4; thick_shell4.get_weights(weights_s4); double rad_out = 0.0; // 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